diff --git a/CALIBRATION/bcm_current_calib/README b/CALIBRATION/bcm_current_map/README similarity index 100% rename from CALIBRATION/bcm_current_calib/README rename to CALIBRATION/bcm_current_map/README diff --git a/CALIBRATION/bcm_current_calib/ScalerCalib.C b/CALIBRATION/bcm_current_map/ScalerCalib.C similarity index 86% rename from CALIBRATION/bcm_current_calib/ScalerCalib.C rename to CALIBRATION/bcm_current_map/ScalerCalib.C index 2a6cbff59344b6476b4371b1405dbb05af6427b5..8e56b990fc7629c2536f0de26293ac063ae05011 100644 --- a/CALIBRATION/bcm_current_calib/ScalerCalib.C +++ b/CALIBRATION/bcm_current_map/ScalerCalib.C @@ -5,6 +5,9 @@ using namespace std; +const double kBig = 1.e38; +const int NBCM = 5; + ofstream outfile; //_________________________________ @@ -37,8 +40,18 @@ int ScalerCalib::Run() return -1; } - int pos = filename.find("scalers_"); - runstr = (filename.substr(pos+8)).substr(0,4); + int pos; + pos = filename.find("scalers_"); + + if(pos == -1) + { + pos = filename.find("production_"); + runstr = (filename.substr(pos+11)).substr(0,4); + } + else + { + runstr = (filename.substr(pos+8)).substr(0,4); + } ofilename = "bcmcurrent_" + runstr + ".param"; outfile.open(ofilename.c_str()); @@ -71,7 +84,7 @@ int ScalerCalib::Run() outfile << "scal_read_event = "; PrintContainer(evnum); - // outfile.close(); + outfile.close(); return 0; @@ -129,13 +142,15 @@ int ScalerCalib::FillContainer() return -1; } - if(! file->GetListOfKeys()->Contains("TSH") ) + string tname = "TS" + fName; + + if(! file->GetListOfKeys()->Contains(tname.c_str()) ) { cout << "ERROR: Couldn't find the Scaler Tree" << endl; return -1; } - TTree* T = (TTree*)file->Get("TSH"); + TTree* T = (TTree*)file->Get(tname.c_str()); double evnumber; double bcm1_current; @@ -144,14 +159,14 @@ int ScalerCalib::FillContainer() double bcm4b_current; double bcm17_current; - string bname[5]; - string sarray[5] = {".BCM1.scalerCurrent", + string bname[NBCM]; + string sarray[NBCM] = {".BCM1.scalerCurrent", ".BCM2.scalerCurrent", ".BCM4A.scalerCurrent", ".BCM4B.scalerCurrent", ".BCM17.scalerCurrent"}; - for(int i=0; i<5; i++) + for(int i=0; i<NBCM; i++) { bname[i] = ""; bname[i] += fName; @@ -165,8 +180,6 @@ int ScalerCalib::FillContainer() T->SetBranchAddress(bname[3].c_str(), &bcm4b_current); T->SetBranchAddress(bname[4].c_str(), &bcm17_current); - const double kBig = 1.e38; - Long64_t nentries = T->GetEntries(); for(Long64_t ientry=0; ientry<nentries; ientry++) { diff --git a/CALIBRATION/bcm_current_calib/ScalerCalib.h b/CALIBRATION/bcm_current_map/ScalerCalib.h similarity index 100% rename from CALIBRATION/bcm_current_calib/ScalerCalib.h rename to CALIBRATION/bcm_current_map/ScalerCalib.h diff --git a/CALIBRATION/bcm_current_calib/run.C b/CALIBRATION/bcm_current_map/run.C similarity index 65% rename from CALIBRATION/bcm_current_calib/run.C rename to CALIBRATION/bcm_current_map/run.C index 56b580e2af65a49846feaba2c6ce13830032c8be..8df3c0925e9f4e517828ca90239e918ae06b7361 100644 --- a/CALIBRATION/bcm_current_calib/run.C +++ b/CALIBRATION/bcm_current_map/run.C @@ -1,10 +1,10 @@ R__LOAD_LIBRARY(ScalerCalib_C) -void run(string fin="fin.root") +void run(string fin="fin.root", string spec_name="H") { //H: HMS, P: SHMS - ScalerCalib scalib("H"); + ScalerCalib scalib(spec_name); scalib.SetInputFile(fin); scalib.SetPrintFlag(1); //0: bcm1 and bcm2 only, 1: all scalib.Run(); diff --git a/CALIBRATION/bcm_current_map/run4shms.sh b/CALIBRATION/bcm_current_map/run4shms.sh new file mode 100755 index 0000000000000000000000000000000000000000..46ce4c25a474438672c084218099dd92f85914b3 --- /dev/null +++ b/CALIBRATION/bcm_current_map/run4shms.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +list=$1 + +while read line +do + +fname=/home/cdaq/hallc-online/hallc_replay/ROOTfiles/shms_replay_production_${line}_-1.root + +root -b<<EOF +.x run.C("${fname}", "P") +EOF + +[ ! -d "shms" ] && `mkdir shms` + +mv bcmcurrent* ./shms/ + +done < ${list}