Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Vertex.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Vertex.h
1 #ifndef VERTEX_H
2 #define VERTEX_H
3 
4 #include <Riostream.h>
5 #include <fstream>
6 #include <iostream>
7 #include <map>
8 #include <numeric>
9 #include <stdlib.h>
10 #include <vector>
11 
12 #include <TCanvas.h>
13 #include <TFile.h>
14 #include <TGaxis.h>
15 #include <TH1F.h>
16 #include <TH2F.h>
17 #include <TLatex.h>
18 #include <TLegend.h>
19 #include <TLine.h>
20 #include <TMarker.h>
21 #include <TRandom3.h>
22 #include <TText.h>
23 #include <TTree.h>
24 #include <TVector3.h>
25 
26 #include "/sphenix/user/hjheng/TrackletAna/analysis/plot/sPHENIXStyle/sPhenixStyle.C"
27 
28 #define NZGAP 0
29 
30 using namespace std;
31 
32 struct VtxData
33 {
34  bool isdata;
35  int event, NClusLayer1, NTruthVtx;
36  float TruthPV_x, TruthPV_y, TruthPV_z;
37  float PV_x, PV_y, PV_z;
38  float Centrality_bimp, Centrality_impactparam, Centrality_mbd, Centrality_mbdquantity;
39 };
40 
41 void SetVtxMinitree(TTree *outTree, VtxData &vtxdata)
42 {
43  outTree->Branch("event", &vtxdata.event);
44  outTree->Branch("NClusLayer1", &vtxdata.NClusLayer1);
45  if (!vtxdata.isdata)
46  {
47  outTree->Branch("NTruthVtx", &vtxdata.NTruthVtx);
48  outTree->Branch("TruthPV_x", &vtxdata.TruthPV_x);
49  outTree->Branch("TruthPV_y", &vtxdata.TruthPV_y);
50  outTree->Branch("TruthPV_z", &vtxdata.TruthPV_z);
51  outTree->Branch("Centrality_bimp", &vtxdata.Centrality_bimp);
52  outTree->Branch("Centrality_impactparam", &vtxdata.Centrality_impactparam);
53  }
54  outTree->Branch("Centrality_mbd", &vtxdata.Centrality_mbd);
55  outTree->Branch("Centrality_mbdquantity", &vtxdata.Centrality_mbdquantity);
56  outTree->Branch("PV_x", &vtxdata.PV_x);
57  outTree->Branch("PV_y", &vtxdata.PV_y);
58  outTree->Branch("PV_z", &vtxdata.PV_z);
59 }
60 
61 std::map<int, vector<float>> EvtVtx_map_tklcluster(const char *vtxfname)
62 {
63  std::map<int, vector<float>> EvtVtx_map;
64 
65  TFile *f = new TFile(vtxfname, "READ");
66  TTree *t = (TTree *)f->Get("minitree");
67  int event;
68  float PV_x, PV_y, PV_z;
69  t->SetBranchAddress("event", &event);
70  t->SetBranchAddress("PV_x", &PV_x);
71  t->SetBranchAddress("PV_y", &PV_y);
72  t->SetBranchAddress("PV_z", &PV_z);
73  for (int ev = 0; ev < t->GetEntriesFast(); ev++)
74  {
75  t->GetEntry(ev);
76  EvtVtx_map[event] = {PV_x, PV_y, PV_z};
77  }
78 
79  return EvtVtx_map;
80 }
81 
82 #endif