ATLAS Offline Software
Loading...
Searching...
No Matches
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 HGetHisto_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 }
@ PileUp
Pile-up vertex.
@ PriVtx
Primary vertex.
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ 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 }
std::unique_ptr< const H > GetHisto_impl(TFile &file, const TString &hname)
TFile * file

◆ 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 }
#define H(x, y, z)
Definition MD5.cxx:114
Header file for AthHistogramAlgorithm.

◆ setTree()

TTree * JetCalibUtils::setTree ( TTree * tree)

Definition at line 62 of file JetCalibUtils.cxx.

62{ return tree; }
TChain * 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 }
std::vector< TString > StrV

◆ 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 }