Classes | Public Member Functions | Protected Attributes | List of all members
calib::ThresholdCorrMap Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/Calibration/func/ThresholdCorrMap.h"

Classes

struct  Coeffs
 

Public Member Functions

 ThresholdCorrMap (novadaq::cnv::DetId det, std::string const &fileName, bool FiberBrightness=false)
 
 ~ThresholdCorrMap ()
 
double ThresholdCorrAt (int view, int cell, double w) const
 
double ThresholdCorrAt (int view, int cell, double w, int fiberbrightness) const
 

Protected Attributes

double fCellMax
 
double fCutW [4]
 
double fCutWMax [4]
 
int fNa
 
int fNb
 
int fNflag
 
std::vector< CoeffsfCoeffs [4][12]
 

Detailed Description

Definition at line 19 of file ThresholdCorrMap.h.

Constructor & Destructor Documentation

calib::ThresholdCorrMap::ThresholdCorrMap ( novadaq::cnv::DetId  det,
std::string const &  fileName,
bool  FiberBrightness = false 
)

Definition at line 21 of file ThresholdCorrMap.cxx.

References ana::assert(), calib::ThresholdCorrMap::Coeffs::cellpow, calib::ThresholdCorrMap::Coeffs::coeff, om::cout, lem_server::cs, fillBadChanDBTables::det, allTimeWatchdog::endl, fCellMax, fCoeffs, fCutW, fCutWMax, fNa, fNb, fNflag, novadaq::cnv::kFARDET, novadaq::cnv::kNEARDET, novadaq::cnv::kTESTBEAM, calib::ThresholdCorrMap::Coeffs::modpow, getGoodRuns4SAM::n, make_root_from_grid_output::tr, POTSpillRate::view, and calib::ThresholdCorrMap::Coeffs::wpow.

24  {
25  std::cout << "ThresholdCorrMap fileName: " << fileName << std::endl;
26 
27  /* std::string fname;
28  std::string filePath("Calibration/");
29  filePath += fileName;
30  cet::search_path sp("FW_SEARCH_PATH");
31  sp.find_file(filePath.c_str(), fname);
32 
33  std::cout << "sp.find_file(" << filePath.c_str() << ", " << fname << std::endl;
34  */
35 
36  switch(det){
38  if(fileName.find("nd") == std::string::npos)//was filePath
39  throw cet::exception("ThresholdCorrMap")
40  << "threshold correction map file " << fileName //was filePath
41  << " does not appear to be valid for current detector"
42  << det;
43  break;
45  if(fileName.find("fd") == std::string::npos)//was filePath
46  throw cet::exception("ThresholdCorrMap")
47  << "threshold correction map file " << fileName //was filePath
48  << " does not appear to be valid for current detector"
49  << det;
50  break;
52  if(fileName.find("tb") == std::string::npos)//was filePath
53  throw cet::exception("ThresholdCorrMap")
54  << "threshold correction map file " << fileName //was filePath
55  << " does not appear to be valid for current detector"
56  << det;
57  break;
58 
59  default:
60  assert(0 && "Unhandled detector, tb test");
61  }
62  assert(!fileName.empty());//was fname
63 
64  TFile corrFile(fileName.c_str());//was fname
65  assert(!corrFile.IsZombie());
66 
67  TTree* tr = (TTree*)corrFile.Get("tree");
68  int view;
69  int fiberbrightness=0;
70  tr->SetBranchAddress("view", &view);
71  if(FiberBrightnessMode) tr->SetBranchAddress("fiberbrightness", &fiberbrightness);
72  Coeffs cs;
73  double cutw, cutwmax;
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);
84 
85  for(int n = 0; n < tr->GetEntries(); ++n){
86  tr->GetEntry(n);
87  fCoeffs[view][fiberbrightness].push_back(cs);
88  fCutW[view] = cutw;
89  fCutWMax[view] = cutwmax;
90  }
91 
92  corrFile.Close();
93  }
fileName
Definition: plotROC.py:78
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
Far Detector at Ash River, MN.
std::vector< Coeffs > fCoeffs[4][12]
Near Detector in the NuMI cavern.
OStream cout
Definition: OStream.cxx:6
assert(nhit_max >=nhit_nbins)
calib::ThresholdCorrMap::~ThresholdCorrMap ( )

Definition at line 96 of file ThresholdCorrMap.cxx.

References a, b, MECModelEnuComparisons::i, util::ipow(), and runNovaSAM::ret.

97  {
98  }

Member Function Documentation

double calib::ThresholdCorrMap::ThresholdCorrAt ( int  view,
int  cell,
double  w 
) const

Definition at line 111 of file ThresholdCorrMap.cxx.

Referenced by calib::AttenFit::ApplyThresholdCorrection(), and calib::AttenuationFit::ApplyThresholdCorrection().

112  {
113  return ThresholdCorrAt(view,cell,w,0);
114  }
double ThresholdCorrAt(int view, int cell, double w) const
Float_t w
Definition: plot.C:20
double calib::ThresholdCorrMap::ThresholdCorrAt ( int  view,
int  cell,
double  w,
int  fiberbrightness 
) const

Definition at line 117 of file ThresholdCorrMap.cxx.

References a, b, om::cout, allTimeWatchdog::endl, fCellMax, fCoeffs, fCutW, fCutWMax, fNa, fNb, APDHVSetting::mod, cet::pow(), runNovaSAM::ret, gen_flatrecord::size, and POTSpillRate::view.

118  {
119 
120  double kMaxW = fCutWMax[view];
121  double kCutW = fCutW[view];
122  if(w < -kMaxW) w = -kMaxW;
123  if(w > +kCutW) w = +kCutW;
124 
125  const int mod = cell%32; // Position within module
126  double ret = 0;
127 
128  if(fCoeffs[view][fiberbrightness].size()){
129  for(int a = 0; a < fNa; ++a){
130  for(int b = 0; b < fNb; ++b){
131  ret += fCoeffs[view][fiberbrightness][fNb*a+b].coeff*pow(w/kMaxW, a)*pow(cell/fCellMax, b);
132  }
133  }
134  ret+=fCoeffs[view][fiberbrightness][fNa*fNb+mod].coeff;
135  }
136  std::cout << "ThresholdCorrMapAt(" << view << "," << cell << "," << w << "," << fiberbrightness << ") returns " << ret << std::endl;
137 
138  return ret;
139 
140  }
constexpr T pow(T x)
Definition: pow.h:75
const double a
std::vector< Coeffs > fCoeffs[4][12]
OStream cout
Definition: OStream.cxx:6
const hit & b
Definition: hits.cxx:21
Float_t w
Definition: plot.C:20

Member Data Documentation

double calib::ThresholdCorrMap::fCellMax
protected

Definition at line 35 of file ThresholdCorrMap.h.

Referenced by ThresholdCorrAt(), and ThresholdCorrMap().

std::vector<Coeffs> calib::ThresholdCorrMap::fCoeffs[4][12]
protected

Definition at line 42 of file ThresholdCorrMap.h.

Referenced by ThresholdCorrAt(), and ThresholdCorrMap().

double calib::ThresholdCorrMap::fCutW[4]
protected

Definition at line 36 of file ThresholdCorrMap.h.

Referenced by ThresholdCorrAt(), and ThresholdCorrMap().

double calib::ThresholdCorrMap::fCutWMax[4]
protected

Definition at line 37 of file ThresholdCorrMap.h.

Referenced by ThresholdCorrAt(), and ThresholdCorrMap().

int calib::ThresholdCorrMap::fNa
protected

Definition at line 38 of file ThresholdCorrMap.h.

Referenced by ThresholdCorrAt(), and ThresholdCorrMap().

int calib::ThresholdCorrMap::fNb
protected

Definition at line 39 of file ThresholdCorrMap.h.

Referenced by ThresholdCorrAt(), and ThresholdCorrMap().

int calib::ThresholdCorrMap::fNflag
protected

Definition at line 40 of file ThresholdCorrMap.h.

Referenced by ThresholdCorrMap().


The documentation for this class was generated from the following files: