16 #include "cetlib_except/exception.h" 23 bool FiberBrightnessMode)
38 if(fileName.find(
"nd") == std::string::npos)
40 <<
"threshold correction map file " << fileName
41 <<
" does not appear to be valid for current detector" 45 if(fileName.find(
"fd") == std::string::npos)
47 <<
"threshold correction map file " << fileName
48 <<
" does not appear to be valid for current detector" 52 if(fileName.find(
"tb") == std::string::npos)
54 <<
"threshold correction map file " << fileName
55 <<
" does not appear to be valid for current detector" 60 assert(0 &&
"Unhandled detector, tb test");
64 TFile corrFile(fileName.c_str());
65 assert(!corrFile.IsZombie());
67 TTree*
tr = (TTree*)corrFile.Get(
"tree");
69 int fiberbrightness=0;
70 tr->SetBranchAddress(
"view", &view);
71 if(FiberBrightnessMode) tr->SetBranchAddress(
"fiberbrightness", &fiberbrightness);
74 tr->SetBranchAddress(
"Na",&
fNa);
75 tr->SetBranchAddress(
"Nb",&
fNb);
76 tr->SetBranchAddress(
"Nflag",&
fNflag);
77 tr->SetBranchAddress(
"wpow", &cs.
wpow);
78 tr->SetBranchAddress(
"cellpow", &cs.
cellpow);
79 tr->SetBranchAddress(
"modpow", &cs.
modpow);
80 tr->SetBranchAddress(
"coeff", &cs.
coeff);
81 tr->SetBranchAddress(
"dcellMax", &
fCellMax);
82 tr->SetBranchAddress(
"dcutW", &cutw);
83 tr->SetBranchAddress(
"dcutWMax", &cutwmax);
85 for(
int n = 0;
n < tr->GetEntries(); ++
n){
102 inline double ipow(
double a,
int b)
105 for(
int i = 0;
i <
b; ++
i) ret *= a;
122 if(w < -kMaxW) w = -kMaxW;
123 if(w > +kCutW) w = +kCutW;
125 const int mod = cell%32;
129 for(
int a = 0;
a <
fNa; ++
a){
130 for(
int b = 0;
b <
fNb; ++
b){
136 std::cout <<
"ThresholdCorrMapAt(" << view <<
"," << cell <<
"," << w <<
"," << fiberbrightness <<
") returns " << ret <<
std::endl;
ThresholdCorrMap(novadaq::cnv::DetId det, std::string const &fileName, bool FiberBrightness=false)
double ThresholdCorrAt(int view, int cell, double w) const
::xsd::cxx::tree::exception< char > exception
Far Detector at Ash River, MN.
std::vector< Coeffs > fCoeffs[4][12]
Near Detector in the NuMI cavern.
T ipow(T x, unsigned int n)
More efficient exponentiation function than pow(x,n) for small n.
assert(nhit_max >=nhit_nbins)