ATLAS Offline Software
Loading...
Searching...
No Matches
JetCalibUtils.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef JETCALIBUTILS_H
6#define JETCALIBUTILS_H
7
8#include "TFile.h"
9#include "TTree.h"
10#include "TString.h"
11#include "TObjString.h"
12#include "TH1.h"
13#include "TH2.h"
14#include "TH3.h"
15#include <cmath>
16#include <vector>
17#include <memory>
18#include "xAODTracking/Vertex.h"
19
20#define CHECK_THEN_ERROR( checkcode, message) if( checkcode ) { ATH_MSG_ERROR( message ) ; return StatusCode::FAILURE;}
21
22typedef std::vector<TString> StrV;
23typedef std::vector<double> VecD;
24
25namespace JetCalibUtils {
26
27 // Vectorizing functions and associated typedefs
28 StrV Vectorize (const TString& str, const TString& sep=" ");
29 VecD VectorizeD(const TString& str, const TString& sep=" ");
30
31 // Read histogram from file and transfer ownership
32 std::unique_ptr<const TH1> GetHisto(TFile& file, const TString& hname);
33 std::unique_ptr<const TH2> GetHisto2(TFile& file, const TString& hname);
34 std::unique_ptr<const TH3> GetHisto3(TFile& file, const TString& hname);
35
36 TTree *setTree(TTree *tree);
37
38 template<typename VXCONT>
39 int countNPV(const VXCONT& vxCont){
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 }
46
47}
48
49#endif
std::vector< double > VecD
std::vector< TString > StrV
StrV Vectorize(const TString &str, const TString &sep=" ")
int countNPV(const VXCONT &vxCont)
std::unique_ptr< const TH2 > GetHisto2(TFile &file, const TString &hname)
VecD VectorizeD(const TString &str, const TString &sep=" ")
std::unique_ptr< const TH1 > GetHisto(TFile &file, const TString &hname)
TTree * setTree(TTree *tree)
std::unique_ptr< const TH3 > GetHisto3(TFile &file, const TString &hname)
@ PileUp
Pile-up vertex.
@ PriVtx
Primary vertex.
Vertex_v1 Vertex
Define the latest version of the vertex class.
TChain * tree
TFile * file