CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
AcceptanceTableHelper Class Reference

Access to acceptance tables stored in ROOT file. More...

#include <AcceptanceTableHelper.h>

Public Member Functions

 AcceptanceTableHelper ()
 Default constructor. More...
 
float GetAcceptance (float, float, float)
 Acceptance as a function of t, xi and phi. More...
 
void Init (TFile &, const std::string)
 Get acceptance tables from root file. More...
 
 ~AcceptanceTableHelper ()
 Delete acceptance histograms. More...
 

Private Attributes

TH3F * h_log10t_log10Xi_Phi
 Table for low t: acceptance as a function of log10(t), log10(Xi) and Phi. More...
 
TH3F * h_t_log10Xi_Phi
 Table for high t: acceptance as a function of -t, log10(Xi) and Phi. More...
 

Detailed Description

Access to acceptance tables stored in ROOT file.

Helper class to get actual values from acceptance tables stored as TH3F. The class can provide acceptance values for a near-beam detector or a combination (e.g. 420+220).

A class instance is initialized from a root file with TH3F-type histograms of acceptance: for low t: acceptance as function of log10(-t), log10(xi) and phi; for high t: acceptance as function of -t, log10(xi) and phi.

The acceptance can be extracted from tables for given t,xi,phi with a dedicated method.

Author: Dmitry Zaborov

Definition at line 27 of file AcceptanceTableHelper.h.

Constructor & Destructor Documentation

◆ AcceptanceTableHelper()

AcceptanceTableHelper::AcceptanceTableHelper ( )
inline

Default constructor.

Definition at line 30 of file AcceptanceTableHelper.h.

30 : h_log10t_log10Xi_Phi(nullptr), h_t_log10Xi_Phi(nullptr) { ; }
TH3F * h_log10t_log10Xi_Phi
Table for low t: acceptance as a function of log10(t), log10(Xi) and Phi.
TH3F * h_t_log10Xi_Phi
Table for high t: acceptance as a function of -t, log10(Xi) and Phi.

◆ ~AcceptanceTableHelper()

AcceptanceTableHelper::~AcceptanceTableHelper ( )
inline

Delete acceptance histograms.

Definition at line 33 of file AcceptanceTableHelper.h.

References h_log10t_log10Xi_Phi, and h_t_log10Xi_Phi.

33  {
35  delete h_log10t_log10Xi_Phi;
36  if (h_t_log10Xi_Phi)
37  delete h_t_log10Xi_Phi;
38  }
TH3F * h_log10t_log10Xi_Phi
Table for low t: acceptance as a function of log10(t), log10(Xi) and Phi.
TH3F * h_t_log10Xi_Phi
Table for high t: acceptance as a function of -t, log10(Xi) and Phi.

Member Function Documentation

◆ GetAcceptance()

float AcceptanceTableHelper::GetAcceptance ( float  t,
float  xi,
float  phi 
)

Acceptance as a function of t, xi and phi.

Return acceptance for given t, xi, phi

Definition at line 47 of file AcceptanceTableHelper.cc.

References h_log10t_log10Xi_Phi, h_t_log10Xi_Phi, phi, submitPVValidationJobs::t, and protons_cff::xi.

Referenced by ProtonTaggerFilter::filter().

47  {
48  float log10t = log10(-t);
49  float log10Xi = log10(xi);
50 
51  float acc = 0;
52 
53  if ((h_log10t_log10Xi_Phi != nullptr) // if table exists
54  && (log10t < h_log10t_log10Xi_Phi->GetXaxis()->GetXmax())) // and t within table range
55  {
56  float log10tMin = h_log10t_log10Xi_Phi->GetXaxis()->GetXmin();
57  if (log10t < log10tMin)
58  log10t = log10tMin; // very small t should go to the lowest t bin
59 
60  acc = h_log10t_log10Xi_Phi->GetBinContent(h_log10t_log10Xi_Phi->FindBin(log10t, log10Xi, phi));
61 
62  } else if (h_t_log10Xi_Phi != nullptr) { // if table exists for high t
63 
64  acc = h_t_log10Xi_Phi->GetBinContent(h_t_log10Xi_Phi->FindBin(-t, log10Xi, phi));
65  }
66 
67  return acc;
68 }
TH3F * h_log10t_log10Xi_Phi
Table for low t: acceptance as a function of log10(t), log10(Xi) and Phi.
TH3F * h_t_log10Xi_Phi
Table for high t: acceptance as a function of -t, log10(Xi) and Phi.

◆ Init()

void AcceptanceTableHelper::Init ( TFile &  f,
const std::string  basename 
)

Get acceptance tables from root file.

Read from root file <f> acceptance tables named <basename> and <basename>_hight

Definition at line 18 of file AcceptanceTableHelper.cc.

References gather_cfg::cout, f, h, h_log10t_log10Xi_Phi, h_t_log10Xi_Phi, hfnoseParametersInitialization_cfi::name2, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ProtonTaggerFilter::beginJob().

18  {
19  // ... read table for low t
20  TH3F* h = (TH3F*)f.Get(basename.c_str());
21 
22  if (h != nullptr) {
23  h_log10t_log10Xi_Phi = (TH3F*)h->Clone();
24  std::cout << "Read ";
25  h_log10t_log10Xi_Phi->SetDirectory(nullptr); // secure it from deleting if the file is eventually closed
26  h_log10t_log10Xi_Phi->Print();
27  } else {
28  std::cout << "Warning: could not get acceptance table " << basename << std::endl;
29  }
30 
31  // ... read table for high t
32  std::string name2 = basename + "_hight";
33  h = (TH3F*)f.Get(name2.c_str());
34 
35  if (h != nullptr) {
36  h_t_log10Xi_Phi = (TH3F*)h->Clone();
37  h_t_log10Xi_Phi->SetDirectory(nullptr); // secure it from deleting if the file is eventually closed
38  std::cout << "Read ";
39  h_t_log10Xi_Phi->Print();
40  } else {
41  std::cout << "Warning: could not get acceptance table " << name2 << std::endl;
42  }
43 }
TH3F * h_log10t_log10Xi_Phi
Table for low t: acceptance as a function of log10(t), log10(Xi) and Phi.
double f[11][100]
TH3F * h_t_log10Xi_Phi
Table for high t: acceptance as a function of -t, log10(Xi) and Phi.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

Member Data Documentation

◆ h_log10t_log10Xi_Phi

TH3F* AcceptanceTableHelper::h_log10t_log10Xi_Phi
private

Table for low t: acceptance as a function of log10(t), log10(Xi) and Phi.

Definition at line 48 of file AcceptanceTableHelper.h.

Referenced by GetAcceptance(), Init(), and ~AcceptanceTableHelper().

◆ h_t_log10Xi_Phi

TH3F* AcceptanceTableHelper::h_t_log10Xi_Phi
private

Table for high t: acceptance as a function of -t, log10(Xi) and Phi.

Definition at line 51 of file AcceptanceTableHelper.h.

Referenced by GetAcceptance(), Init(), and ~AcceptanceTableHelper().