// $Id$ // // File: DBCALEcalib.cc // Created: Mon Jun 6 08:01:33 EDT 2011 // Creator: davidl (on Linux ifarm1101 2.6.18-128.7.1.el5 x86_64) // #include #include using namespace std; #include using namespace jana; #include "DBCALEcalib.h" //--------------------------------- // DBCALEcalib (Constructor) //--------------------------------- DBCALEcalib::DBCALEcalib(JCalibration *jcalib, string namepath) { if(!jcalib)return; jout<<"Reading BCAL energy calibration map from "< > Ecalib_map; jcalib->Get(namepath, Ecalib_map); jout< to make a // histogram of the entries by using the key to hold the extent // so that the number of entries will be equal to the number of // different values. set E_vals; set zvals; E_min = z_min = 1.0E6; E_max = z_max = -1.0E6; for(unsigned int i=0; i &a = Ecalib_map[i]; float &z = a[0]; float &E_raw = a[1]; E_vals.insert(E_raw); zvals.insert(z); if(E_raw < E_min)E_min=E_raw; if(E_raw > E_max)E_max=E_raw; if(z < z_min)z_min=z; if(z > z_max)z_max=z; } N_E = E_vals.size(); N_z = zvals.size(); jout<<" (N_E="< zvec(N_z); for(int i=0; i &a = Ecalib_map[i]; float &z = a[0]; float &E_raw = a[1]; float &E_gen = a[2]; int zindex = (int)floor((z-z_min)/dz); int Eindex = (int)floor((E_raw-E_min)/dE); if(zindex<0 || Eindex<0 || zindex>=N_z || Eindex>=N_E){ _DBG_<<"VALUE OUT OF RANGE: zindex="<