Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CentralityValid.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CentralityValid.cc
1 #include "CentralityValid.h"
2 
4 #include <calotrigger/MinimumBiasInfo.h>
7 
9 #include <phool/PHIODataNode.h>
10 #include <phool/PHNode.h>
11 #include <phool/PHNodeIterator.h>
12 #include <phool/PHObject.h>
13 #include <phool/PHRandomSeed.h>
14 #include <phool/getClass.h>
15 
16 #include <TF1.h>
17 #include <TEfficiency.h>
18 #include <TFile.h>
19 #include <TH2.h>
20 #include <TNtuple.h>
21 #include <TSystem.h>
22 
23 #include <cassert>
24 #include <filesystem>
25 #include <fstream>
26 #include <iostream>
27 #include <sstream>
28 #include <string>
29 #include <vector>
30 
32  : SubsysReco(name)
33 {
34  _hist_filename = hist_name;
35 }
36 
38 {
39  delete hm;
40 }
42 {
43  // Histograms
44 
45  hm = new Fun4AllHistoManager("CENTRALITY_VALIDATION_HIST");
46 
47  _h_centrality_bin = new TH1D("h_centrality_bin", ";Centrality Bin; 1/N{_Events}",20,-0.025, 0.975);
48  _h_centrality_bin_mb = new TH1D("h_centrality_bin_mb", ";Centrality Bin; 1/N{_Events}",20,-0.025, 0.975);
49 
50  _he_min_bias = new TEfficiency("he_min_bias",";Min Bias?; Fraction of Events", 1, 0, 1);
55 }
56 
58 {
59  if (Verbosity())
60  {
61  std::cout << __FILE__ << " :: " << __FUNCTION__ << std::endl;
62  }
63 
65 }
66 
67 
69 {
70  if (Verbosity())
71  {
72  std::cout << __FILE__ << " :: " << __FUNCTION__ << " :: " << __LINE__ << std::endl;
73  }
74 
75  _central = findNode::getClass<CentralityInfo>(topNode, "CentralityInfo");
76 
77  if (!_central)
78  {
79  std::cout << "no centrality node " << std::endl;
81  }
82 
83  _minimumbiasinfo = findNode::getClass<MinimumBiasInfo>(topNode, "MinimumBiasInfo");
84 
85  if (!_minimumbiasinfo)
86  {
87  std::cout << "no minimumbias node " << std::endl;
89  }
90 
91  float centile = (_central->has_centile(CentralityInfo::PROP::mbd_NS)?_central->get_centile(CentralityInfo::PROP::mbd_NS) : -999.99);
92 
93  _h_centrality_bin->Fill(centile);
94 
95  bool isMinBias = _minimumbiasinfo->isAuAuMinimumBias();
96 
97  if (isMinBias)
98  {
99  _h_centrality_bin_mb->Fill(centile);
100  }
101  _he_min_bias->Fill(isMinBias,0);
102 
104 }
105 
107 {
108  hm->dumpHistos(_hist_filename.c_str(), "RECREATE");
109 
110  return 0;
111 }