Skip to content
Snippets Groups Projects
Commit 4002f91c authored by Sanghwa Park's avatar Sanghwa Park Committed by Mark K Jones
Browse files

bcm current map clean up

parent 8e31b828
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
using namespace std; using namespace std;
const double kBig = 1.e38;
const int NBCM = 5;
ofstream outfile; ofstream outfile;
//_________________________________ //_________________________________
...@@ -37,8 +40,18 @@ int ScalerCalib::Run() ...@@ -37,8 +40,18 @@ int ScalerCalib::Run()
return -1; return -1;
} }
int pos = filename.find("scalers_"); int pos;
runstr = (filename.substr(pos+8)).substr(0,4); 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"; ofilename = "bcmcurrent_" + runstr + ".param";
outfile.open(ofilename.c_str()); outfile.open(ofilename.c_str());
...@@ -71,7 +84,7 @@ int ScalerCalib::Run() ...@@ -71,7 +84,7 @@ int ScalerCalib::Run()
outfile << "scal_read_event = "; outfile << "scal_read_event = ";
PrintContainer(evnum); PrintContainer(evnum);
// outfile.close(); outfile.close();
return 0; return 0;
...@@ -129,13 +142,15 @@ int ScalerCalib::FillContainer() ...@@ -129,13 +142,15 @@ int ScalerCalib::FillContainer()
return -1; 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; cout << "ERROR: Couldn't find the Scaler Tree" << endl;
return -1; return -1;
} }
TTree* T = (TTree*)file->Get("TSH"); TTree* T = (TTree*)file->Get(tname.c_str());
double evnumber; double evnumber;
double bcm1_current; double bcm1_current;
...@@ -144,14 +159,14 @@ int ScalerCalib::FillContainer() ...@@ -144,14 +159,14 @@ int ScalerCalib::FillContainer()
double bcm4b_current; double bcm4b_current;
double bcm17_current; double bcm17_current;
string bname[5]; string bname[NBCM];
string sarray[5] = {".BCM1.scalerCurrent", string sarray[NBCM] = {".BCM1.scalerCurrent",
".BCM2.scalerCurrent", ".BCM2.scalerCurrent",
".BCM4A.scalerCurrent", ".BCM4A.scalerCurrent",
".BCM4B.scalerCurrent", ".BCM4B.scalerCurrent",
".BCM17.scalerCurrent"}; ".BCM17.scalerCurrent"};
for(int i=0; i<5; i++) for(int i=0; i<NBCM; i++)
{ {
bname[i] = ""; bname[i] = "";
bname[i] += fName; bname[i] += fName;
...@@ -165,8 +180,6 @@ int ScalerCalib::FillContainer() ...@@ -165,8 +180,6 @@ int ScalerCalib::FillContainer()
T->SetBranchAddress(bname[3].c_str(), &bcm4b_current); T->SetBranchAddress(bname[3].c_str(), &bcm4b_current);
T->SetBranchAddress(bname[4].c_str(), &bcm17_current); T->SetBranchAddress(bname[4].c_str(), &bcm17_current);
const double kBig = 1.e38;
Long64_t nentries = T->GetEntries(); Long64_t nentries = T->GetEntries();
for(Long64_t ientry=0; ientry<nentries; ientry++) for(Long64_t ientry=0; ientry<nentries; ientry++)
{ {
......
R__LOAD_LIBRARY(ScalerCalib_C) 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 //H: HMS, P: SHMS
ScalerCalib scalib("H"); ScalerCalib scalib(spec_name);
scalib.SetInputFile(fin); scalib.SetInputFile(fin);
scalib.SetPrintFlag(1); //0: bcm1 and bcm2 only, 1: all scalib.SetPrintFlag(1); //0: bcm1 and bcm2 only, 1: all
scalib.Run(); scalib.Run();
......
#!/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}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment