#include <FastSimulation/ProtonTaggers/interface/AcceptanceTableHelper.h>
Public Member Functions | |
AcceptanceTableHelper () | |
Default constructor. | |
float | GetAcceptance (float, float, float) |
Acceptance as a function of t, xi and phi. | |
void | Init (TFile &, const std::string) |
Get acceptance tables from root file. | |
~AcceptanceTableHelper () | |
Delete acceptance histograms. | |
Private Attributes | |
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. |
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.
AcceptanceTableHelper::AcceptanceTableHelper | ( | ) | [inline] |
Default constructor.
Definition at line 32 of file AcceptanceTableHelper.h.
00032 : h_log10t_log10Xi_Phi(NULL),h_t_log10Xi_Phi(NULL) {;}
AcceptanceTableHelper::~AcceptanceTableHelper | ( | ) | [inline] |
Delete acceptance histograms.
Definition at line 35 of file AcceptanceTableHelper.h.
References h_log10t_log10Xi_Phi, and h_t_log10Xi_Phi.
00035 { 00036 if (h_log10t_log10Xi_Phi) delete h_log10t_log10Xi_Phi; 00037 if (h_t_log10Xi_Phi) delete h_t_log10Xi_Phi; 00038 }
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 50 of file AcceptanceTableHelper.cc.
References h_log10t_log10Xi_Phi, h_t_log10Xi_Phi, and NULL.
Referenced by ProtonTaggerFilter::filter().
00050 { 00051 00052 float log10t = log10(-t); 00053 float log10Xi = log10(xi); 00054 00055 float acc = 0; 00056 00057 if ((h_log10t_log10Xi_Phi != NULL) // if table exists 00058 && (log10t < h_log10t_log10Xi_Phi->GetXaxis()->GetXmax())) // and t within table range 00059 { 00060 00061 float log10tMin = h_log10t_log10Xi_Phi->GetXaxis()->GetXmin(); 00062 if (log10t < log10tMin) log10t = log10tMin; // very small t should go to the lowest t bin 00063 00064 acc = h_log10t_log10Xi_Phi->GetBinContent(h_log10t_log10Xi_Phi->FindBin(log10t, log10Xi, phi)); 00065 00066 } else if (h_t_log10Xi_Phi != NULL) { // if table exists for high t 00067 00068 acc = h_t_log10Xi_Phi->GetBinContent(h_t_log10Xi_Phi->FindBin(-t, log10Xi, phi)); 00069 } 00070 00071 return acc; 00072 }
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 GenMuonPlsPt100GeV_cfg::cout, lat::endl(), h, h_log10t_log10Xi_Phi, h_t_log10Xi_Phi, and NULL.
Referenced by ProtonTaggerFilter::beginJob().
00019 { 00020 // ... read table for low t 00021 TH3F *h = (TH3F*)f.Get(basename.c_str()); 00022 00023 if (h != NULL) 00024 { 00025 h_log10t_log10Xi_Phi = (TH3F*)h->Clone(); 00026 std::cout << "Read "; 00027 h_log10t_log10Xi_Phi->SetDirectory(0); // secure it from deleting if the file is eventually closed 00028 h_log10t_log10Xi_Phi->Print(); 00029 } else { 00030 std::cout << "Warning: could not get acceptance table " << basename << std::endl; 00031 } 00032 00033 // ... read table for high t 00034 std::string name2 = basename+"_hight"; 00035 h = (TH3F*)f.Get(name2.c_str()); 00036 00037 if (h != NULL) 00038 { 00039 h_t_log10Xi_Phi = (TH3F*)h->Clone(); 00040 h_t_log10Xi_Phi->SetDirectory(0); // secure it from deleting if the file is eventually closed 00041 std::cout << "Read "; 00042 h_t_log10Xi_Phi->Print(); 00043 } else { 00044 std::cout << "Warning: could not get acceptance table " << name2 << std::endl; 00045 } 00046 }
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 49 of file AcceptanceTableHelper.h.
Referenced by GetAcceptance(), Init(), and ~AcceptanceTableHelper().
TH3F* AcceptanceTableHelper::h_t_log10Xi_Phi [private] |
Table for high t: acceptance as a function of -t, log10(Xi) and Phi.
Definition at line 52 of file AcceptanceTableHelper.h.
Referenced by GetAcceptance(), Init(), and ~AcceptanceTableHelper().