ATLAS Offline Software
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 
22 typedef std::vector<TString> StrV;
23 typedef std::vector<double> VecD;
24 
25 namespace 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
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:279
JetCalibUtils::GetHisto2
std::unique_ptr< const TH2 > GetHisto2(TFile &file, const TString &hname)
Definition: JetCalibUtils.cxx:53
tree
TChain * tree
Definition: tile_monitor.h:30
JetCalibUtils::Vectorize
StrV Vectorize(const TString &str, const TString &sep=" ")
Definition: JetCalibUtils.cxx:14
JetCalibUtils
Definition: JetCalibUtils.h:25
JetCalibUtils::setTree
TTree * setTree(TTree *tree)
Definition: JetCalibUtils.cxx:61
JetCalibUtils::GetHisto3
std::unique_ptr< const TH3 > GetHisto3(TFile &file, const TString &hname)
Definition: JetCalibUtils.cxx:57
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:571
file
TFile * file
Definition: tile_monitor.h:29
Vertex.h
grepfile.sep
sep
Definition: grepfile.py:38
xAOD::VxType::PileUp
@ PileUp
Pile-up vertex.
Definition: TrackingPrimitives.h:573
StrV
std::vector< TString > StrV
Definition: JetCalibUtils.h:22
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
str
Definition: BTagTrackIpAccessor.cxx:11
VecD
std::vector< double > VecD
Definition: JetCalibUtils.h:23
JetCalibUtils::VectorizeD
VecD VectorizeD(const TString &str, const TString &sep=" ")
Definition: JetCalibUtils.cxx:25
JetCalibUtils::countNPV
int countNPV(const VXCONT &vxCont)
Definition: JetCalibUtils.h:39
JetCalibUtils::GetHisto
std::unique_ptr< const TH1 > GetHisto(TFile &file, const TString &hname)
Definition: JetCalibUtils.cxx:49