ATLAS Offline Software
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 TH1GetHisto (TFile &file, const TString &hname)
 
std::unique_ptr< const TH2GetHisto2 (TFile &file, const TString &hname)
 
std::unique_ptr< const TH3GetHisto3 (TFile &file, const TString &hname)
 
TTree * setTree (TTree *tree)
 
template<class H >
std::unique_ptr< const H > GetHisto_impl (TFile &file, const TString &hname)
 

Function Documentation

◆ GetHisto()

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

Definition at line 49 of file JetCalibUtils.cxx.

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

◆ GetHisto2()

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

Definition at line 53 of file JetCalibUtils.cxx.

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

◆ GetHisto3()

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

Definition at line 57 of file JetCalibUtils.cxx.

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

◆ GetHisto_impl()

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

Definition at line 37 of file JetCalibUtils.cxx.

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

◆ setTree()

TTree * JetCalibUtils::setTree ( TTree *  tree)

Definition at line 61 of file JetCalibUtils.cxx.

61 { 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  VecD result;
28  TObjArray* tokens = str.Tokenize(sep);
29  TIter istr(tokens);
30  while (TObjString* os=(TObjString*)istr())
31  result.push_back(atof(os->GetString()));
32  delete tokens;
33  return result;
34  }
get_generator_info.result
result
Definition: get_generator_info.py:21
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:272
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
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
StrV
std::vector< TString > StrV
Definition: JetCalibUtils.h:19
h
str
Definition: BTagTrackIpAccessor.cxx:11
VecD
std::vector< double > VecD
Definition: JetCalibUtils.h:20