#include "DLorentzMapCalibDB.h" #include "DLorentzDeflections.h" #include #include using namespace std; //--------------------------------- // DLorentzMapCalibDB (Constructor) //--------------------------------- DLorentzMapCalibDB::DLorentzMapCalibDB(JApplication *japp, unsigned int run_number) { jcalib = japp->GetJCalibration(run_number); int Npoints = GetLorentzDeflections(); if(Npoints==0){ _DBG_<<"Error getting JCalibration object for Lorentz corrections!"<< endl; japp->Quit(); } } //--------------------------------- // DLorentzMapCalibDB (Constructor) //--------------------------------- DLorentzMapCalibDB::DLorentzMapCalibDB(JCalibration *jcalib) { this->jcalib = jcalib; if(GetLorentzDeflections()==0){ _DBG_<<"Error getting JCalibration object for Lorentz corrections!"<< endl; exit(1); } } unsigned int DLorentzMapCalibDB::GetLorentzDeflections(void){ /// Routine for accessing calibration constants adapted from code written by /// David Lawrence. /// The values specified by "namepath" will be read into the array /// "vals". The "vals" array should have enough memory allocated /// to hold *Nvals elements. If not, only the first *Nvals elements /// will be copied and a non-zero value returned. If the number /// of values in the database are less than *Nvals, then all values /// are copied, *Nvals is updated to reflect the number of valid /// elements in "vals", and a value of 0 is returned. // Make sure jcalib is set if(!jcalib){ _DBG_<<"ERROR - GetLorentzDefelections() called when jcalib not set!"< > tvals; jcalib->Get("FDC/lorentz_deflections", tvals); if(tvals.size() != LORENTZ_X_POINTS*LORENTZ_Z_POINTS){ _DBG_<<"ERROR - GetLorentzDefelections() number of elements in calib DB"<::iterator iter; for(iter=tvals[0].begin(); iter!=tvals[0].end(); iter++)jout<first<<" "; jout< &row = tvals[i]; unsigned int xindex = i/LORENTZ_Z_POINTS; unsigned int zindex = i%LORENTZ_Z_POINTS; lorentz_x[xindex] = row["x"]; lorentz_z[zindex] = row["z"]; lorentz_nx[xindex][zindex] = row["nx"]; lorentz_nz[xindex][zindex] = row["nz"]; } return tvals.size(); }