// $Id$ // // Created June 22, 2005 David Lawrence #include #include using namespace std; #include #include #include #include #include #include #include "units.h" #include "HDDM/hddm_s.h" void Smear(s_HDDM_t *hddm_s); void ParseCommandLineArguments(int narg, char* argv[]); void Usage(void); void ctrlCHandle(int x); char *INFILENAME = NULL; char *OUTFILENAME = NULL; int QUIT = 0; extern bool ADD_NOISE; extern bool SMEAR_HITS; extern bool SMEAR_BCAL; extern bool CDC_USE_PARAMETERIZED_SIGMA; extern bool FDC_USE_PARAMETERIZED_SIGMA; extern double CDC_TDRIFT_SIGMA; extern double CDC_TIME_WINDOW; extern double CDC_PEDESTAL_SIGMA; extern double FDC_TDRIFT_SIGMA; extern double FDC_CATHODE_SIGMA; extern double FDC_PED_NOISE; extern bool FDC_ELOSS_OFF; extern double FDC_TIME_WINDOW; extern double FDC_HIT_DROP_FRACTION; extern double FCAL_PHOT_STAT_COEF; extern double FCAL_BLOCK_THRESHOLD; extern double START_SIGMA; // TOF parameters will be read from data base later double TOF_SIGMA = 100.*k_psec; double TOF_PHOTONS_PERMEV = 400.; vector >fdc_smear_parms; TF1 *fdc_smear_function; #include using namespace jana; static JCalibration *jcalib=NULL; // histogram TH2F *fdc_drift_time_smear_hist; TH2F *fdc_drift_dist_smear_hist; TH2F *fdc_drift_time; //----------- // main //----------- int main(int narg,char* argv[]) { // Set up to catch SIGINTs for graceful exits signal(SIGINT,ctrlCHandle); ParseCommandLineArguments(narg, argv); // hist file TFile *hfile = new TFile("smear.root","RECREATE","smearing histograms"); fdc_drift_time_smear_hist=new TH2F("fdc_drift_time_smear_hist","Drift time smearing for FDC", 300,0.0,0.6,400,-200,200); fdc_drift_dist_smear_hist=new TH2F("fdc_drift_dist_smear_hist","Drift distance smearing for FDC", 100,0.0,0.6,400,-0.5,0.5); fdc_drift_time=new TH2F("fdc_drift_time","FDC drift distance vs. time",100,-20,380,100,0,1.); // Create a JCalibration object using the JANA_CALIB_URL environment variable // Right now, we hardwire this to use JCalibrationFile. const char *url = getenv("JANA_CALIB_URL"); if(!url){ _DBG_<<"JANA_CALIB_URL environment not set."< > tvals; jcalib->Get("FDC/drift_smear_parms", tvals); // Notify user cout<<"Read "<::iterator iter; for(iter=tvals[0].begin(); iter!=tvals[0].end(); iter++)cout<first<<" "; cout< &row = tvals[i]; vectordummy; dummy.push_back(row["h0"]); dummy.push_back(row["m0"]); dummy.push_back(row["s0"]); dummy.push_back(row["h1"]); dummy.push_back(row["m1"]); dummy.push_back(row["s1"]); dummy.push_back(row["h2"]); dummy.push_back(row["m2"]); dummy.push_back(row["s2"]); fdc_smear_parms.push_back(dummy); dummy.clear(); } } { cout<<"get tof parameters for smearing from calibDB"< tofparms; jcalib->Get("TOF/tof_parms", tofparms); TOF_SIGMA = tofparms["TOF_SIGMA"]; TOF_PHOTONS_PERMEV = tofparms["TOF_PHOTONS_PERMEV"]; } cout<<" input file: "<Write(); return 0; } //----------- // ParseCommandLineArguments //----------- void ParseCommandLineArguments(int narg, char* argv[]) { bool warn_obsolete = false; for(int i=1; i