From 269bfdb6a1deb5824f6aedb5bffe6dad3fe400ba Mon Sep 17 00:00:00 2001 From: Naomi Jarvis Date: Fri, 20 Nov 2020 15:00:25 -0500 Subject: [PATCH 1/5] CDC dE/dx calibration scripts --- .../monitoring/CDC_dedx/scripts/README.md | 37 ++++ .../monitoring/CDC_dedx/scripts/fit_dedx.C | 163 ++++++++++++++++++ .../monitoring/CDC_dedx/scripts/gaincalibs.py | 157 +++++++++++++++++ 3 files changed, 357 insertions(+) create mode 100644 src/plugins/monitoring/CDC_dedx/scripts/README.md create mode 100644 src/plugins/monitoring/CDC_dedx/scripts/fit_dedx.C create mode 100644 src/plugins/monitoring/CDC_dedx/scripts/gaincalibs.py diff --git a/src/plugins/monitoring/CDC_dedx/scripts/README.md b/src/plugins/monitoring/CDC_dedx/scripts/README.md new file mode 100644 index 000000000..c3a55b085 --- /dev/null +++ b/src/plugins/monitoring/CDC_dedx/scripts/README.md @@ -0,0 +1,37 @@ +# CDC dE/dx calibrations + +These use the histograms from the plugin CDC\_dedx. + +fit\_dedx.C fits gaussians to the dE/dx bands at 0.5 and 1.5 GeV/c +gaincalibs.py runs fit\_dedx.C over all root files in the subdirectory hists. + +gaincalibs.py creates the following directories, containing one file per run: +- mip - mean dE/dx at 1.5 GeV/c +- oldgains - content of ccdb table /CDC/digi\_scales +- newgains - file containing newly calculated gain to be added to ccdb + +It also creates the following files: +- dedx\_mean\_at\_1\_5GeV.txt - run number and mean dE/dx at 1.5 GeV/c +- dedx\_peak\_scan.txt - run number, mean and sigma of dE/dx at 0.5GeV/c (pi+ and proton) and 1.5GeV/c (combined). +- run\_pi\_mean\_sig\_p\_mean\_sig\_both\_mean\_sig.txt - as dedx\_peak\_scan.txt with the additional text removed +- addtoccdb.sh - bash script to add the data to ccdb. + + +**To run the gain calibrations:** + +1. Make a new directory and cd into it +2. Copy gaincalibs.py and fit\_dedx.C into this directory +1. Make a symbolic link from the launch results to a directory hists, eg +```sh +ln -s /work/halld/data\_monitoring/RunPeriod-2019-11/mon\_ver23/rootfiles/ hists +``` +1. Run the gaincalibs script, eg +```sh +python gaincalibs.py +``` +1. Inspect the results in dedx\_peak\_scan.txt +1. Load the new gain constants into ccdb: +```sh +chmod +x addtoccdb.sh +./addtoccdb.sh +``` diff --git a/src/plugins/monitoring/CDC_dedx/scripts/fit_dedx.C b/src/plugins/monitoring/CDC_dedx/scripts/fit_dedx.C new file mode 100644 index 000000000..dd9fa6b5f --- /dev/null +++ b/src/plugins/monitoring/CDC_dedx/scripts/fit_dedx.C @@ -0,0 +1,163 @@ +void fit_dedx(int run=1){ + + // fit dedx in open file, run is the run number + + // if fit at 1.5GeV/c is successful, writes mean dedx to mip/runnnnnn.txt + + // CDC_dedx was not included in the plugins + // have to use monitoring_hists + + + TF1 *g = new TF1("gaus","gaus",0,12); + + double fitstat; + double pars[3]; + + TH1D *p; // projection + float pcut; + int pbin; + + char opfilename[100]; + sprintf(opfilename,"dedx_peak_scan.txt"); + + char meandedxfile[100]; + sprintf(meandedxfile,"dedx_mean_at_1_5GeV.txt"); + + + FILE *outfile = fopen(opfilename,"a"); + FILE *outfilejustnumbers = fopen("run_pi_mean_sig_p_mean_sig_both_mean_sig.txt","a"); + FILE *meanfile = fopen(meandedxfile,"a"); + + const float newdedx = 2.01992; // put the 1.5GeV/c cut at this dE/dx + + const int testing=0; + + TDirectory* tdir = gDirectory->GetDirectory("CDC_dedx"); + + if (!tdir) return; + + tdir->cd(); + + TH2D* h = (TH2D*)gDirectory->Get("dedx_p_pos"); + + if (!h) return; + + + // rootfile->cd("Independent/Hist_DetectorPID/CDC"); + // h = (TH2D*)gDirectory->Get("dEdXVsP_q+"); + if (testing) new TCanvas; + if (testing) h->Draw(); + + + // draw cut through histo at p=1.5 GeV/c + + pcut = 1.5; + pbin = h->GetXaxis()->FindBin(pcut); + + p = h->ProjectionY("p1",pbin,pbin); + + if (p->GetEntries() < 15000) printf("Run %i entries %.0f (most have 30k+)\n",run,p->GetEntries()); + // will need to combine files for empty target runs + + if (testing) p->SetTitle(Form("CDC q+ dE/dx at %.2f GeV/c",pcut)); + if (testing) p->GetXaxis()->SetRangeUser(0,12); + + if (testing) new TCanvas; + if (testing) p->DrawCopy(""); + + fitstat = p->Fit(g,"Q0WE"); // fitstat=0 is good + + double resboth,uboth; + + if (fitstat == 0) { + g->GetParameters(&pars[0]); + + resboth = 2.0*pars[2]/pars[1]; + uboth = pars[1]; + + if (testing) g->DrawCopy("same"); + + //printf("Run %i dE/dx at p=1.5 GeV/c mean %.2f width %.2f res %.2f\n",run,pars[1],2*pars[2],resboth[n]); + //printf("Run %i dE/dx at p=1.5 GeV/c mean %.2f width %.2f res %.2f\n",run,pars[1],2*pars[2],resboth[n]); + fprintf(meanfile,"%06i %.3f\n",run,pars[1]); + + FILE *fdedx = fopen(Form("mip/run_%i.txt",run),"w"); + fprintf(fdedx,"%.3f\n",pars[1]); + fclose(fdedx); + + } else { + printf("Run %i Fit failed\n",run); + } + + if (uboth==0) return; // skip the 0.5 GeV/c fits if the 1.5 GeV/c fit failed + + + // draw cut through histo at p=0.5 GeV/c + + pcut = 0.5; + pbin = h->GetXaxis()->FindBin(pcut); + + p = h->ProjectionY("p1",pbin,pbin); + + if (testing) p->SetTitle(Form("CDC q+ dE/dx at %.2f GeV/c",pcut)); + if (testing) p->GetXaxis()->SetRangeUser(0,12); + + if (testing) new TCanvas; + if (testing) p->DrawCopy(""); + + // fit pion line + + fitstat = p->Fit(g,"Q0WE","",0,2*uboth); // fitstat=0 is good + + double respi,upi; + + if (fitstat == 0) { + g->GetParameters(&pars[0]); + respi = 2.0*pars[2]/pars[1]; + upi = pars[1]; + + if (testing) g->DrawCopy("same"); + + // printf("Run %i dE/dx at p=0.5 GeV/c mean %.2f width %.2f res %.2f\n",run,pars[1],2*pars[2],respi[n]); + + } else { + printf("Fit failed\n"); + respi=0; + upi=0; + } + + // fit p line + + fitstat = p->Fit(g,"Q0WE","",2*uboth,12); // fitstat=0 is good + double resp,up; + + if (fitstat == 0) { + g->GetParameters(&pars[0]); + resp = 2.0*pars[2]/pars[1]; + up = pars[1]; + + if (testing) g->DrawCopy("same"); + + // printf("Run %i dE/dx at p=0.5 GeV/c mean %.2f width %.2f res %.2f\n",run,pars[1],2*pars[2],resp[n]); + + } else { + printf("Fit failed\n"); + resp=0; + up=0; + } + + fprintf(outfile,"%i 0.5GeV/c pi %.2f %.2f p %.2f %.2f 1.5 GeV/c %.2f %.2f\n",run,upi,respi,up,resp,uboth,resboth); + + //# fprintf(addfile,"ccdb add CDC/digi_scales -r %i-%i /home/njarvis/calibfall2019/dedx/ver17/ccdb/new_ascale_%i.txt\n",run,run,run); + + + fclose(outfile); + + fprintf(outfilejustnumbers,"%i %.2f %.2f %.2f %.2f %.2f %.2f\n",run,upi,respi,up,resp,uboth,resboth); + + fclose(outfilejustnumbers); + + + // if (calcnewgains) fclose(addfile); + +} diff --git a/src/plugins/monitoring/CDC_dedx/scripts/gaincalibs.py b/src/plugins/monitoring/CDC_dedx/scripts/gaincalibs.py new file mode 100644 index 000000000..c307ecc24 --- /dev/null +++ b/src/plugins/monitoring/CDC_dedx/scripts/gaincalibs.py @@ -0,0 +1,157 @@ +# This script expects to find the root files loose inside hists or hist_merged, no extra subdirectories +# eg hists/hd_root_071234.root + +import os +import subprocess +import glob +import ccdb +import re + +testing = 1 # just process one file + +calcnewgains = 1 # calculate new gains (slower, pulls old ones from ccdb) + +addfilename = "add_gains_to_ccdb.sh" # gets overwritten + +# ccdb contains gain files + +dirs = ['mip', 'oldgains', 'newgains'] +for d in dirs: + if not os.path.exists(d): + os.makedirs(d) + + +rundir = "" + +if os.path.exists("hists"): + histdir = "hists" +elif os.path.exists("hists_merged"): + histdir = "hists_merged" +else: + exit("Cannot find hists or hists_merged") + + +filelist = subprocess.check_output(["ls", histdir]).splitlines() + +filesdone = 0 + + +if calcnewgains: + addf = open(addfilename,"w") + addf.write("#!/bin/sh\n") + + +for file in filelist: + + print(file) + + runfile = histdir + "/" + file +# runfile = histdir + "/" + rundir + "/" + file + +# if not os.path.isdir(runfile): +# continue + +# if len(os.listdir(runfile)) == 0: +# fbad = open("emptydir.txt", "a") +# fbad.write(runfile) +# fbad.write("\n") +# fbad.close() +# continue + +# newlist = subprocess.check_output(["ls", runfile]).splitlines() + + run = 999 + + #parse the filename to extract the run + # hd_calib_verify_Run071350_001.root + + # run = int(re.findall('\d+',newlist[0])[0]) + findrunnum = re.findall('\d+',runfile) + + if len(findrunnum) == 0: + print 'Cannot find run number in filename' + else: + run = int(findrunnum[0]) + + print 'run number ',run + +# runfile = runfile + "/" + newlist[0] + + scriptname = "fit_dedx.C(" + str(run) + ")" + + + # look to see how many calib files have been made already + nfiles = len(os.listdir("mip")) + #print(nfiles) + + # root -l -b -q runfile fit_dedx.C(run) + subprocess.call(["root", "-l", "-b", "-q", runfile,scriptname]) + + # check whether the script completed & made a new file of calib consts + + #print(len(os.listdir("mip"))) + + if len(os.listdir("mip")) == nfiles: + fbad = open("badfiles.txt", "a") + fbad.write(runfile) + fbad.write("\n") + fbad.close() + + continue + + filesdone = filesdone + 1 + + dedxfile = "mip/run_" + str(run) + ".txt" + dedxf = open(dedxfile) + dedx = float(dedxf.readline()) + dedxf.close() + + print "run ",run,"dedx",dedx + + + if calcnewgains: + + oldgainfile = "oldgains/run_" + str(run) + ".txt" + + print " running ccdb cat CDC/digiscales -r ",str(run),">",oldgainfile + + subprocess.call(["ccdb", "cat", "CDC/digi_scales", "-r", str(run), ">", oldgainfile]) + + oldf = open(oldgainfile) + + oldf.readline() + oldf.readline() + oldf.readline() + oldf.readline() + line = oldf.readline() + oldf.close() + + oldgain = float(line.split()[1]) + + print "old gain ", oldgain + + + newdedx = 2.01992 # // put the 1.5GeV/c cut at this dE/dx + + newgain = newdedx*oldgain/dedx + + print "newgain is ",newgain + + newgainfile = "newgains/run_"+str(run)+".txt" + + newf = open(newgainfile,"w") + newf.write("%.3f 0.8\n"%newgain) + newf.close() + + addf.write("ccdb add /CDC/digi_scales -r "+str(run)+"-"+str(run)+" "+newgainfile+"\n") + + + if testing == 1: + addf.close() + + + if testing == 1: + break + +if calcnewgains: + addf.close() From bf4a34f87858f58d2d2c4c27bea9641ecb643585 Mon Sep 17 00:00:00 2001 From: Naomi Jarvis Date: Fri, 20 Nov 2020 15:04:03 -0500 Subject: [PATCH 2/5] CDC dE/dx calibration README update --- src/plugins/monitoring/CDC_dedx/scripts/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/monitoring/CDC_dedx/scripts/README.md b/src/plugins/monitoring/CDC_dedx/scripts/README.md index c3a55b085..cc6c8d09d 100644 --- a/src/plugins/monitoring/CDC_dedx/scripts/README.md +++ b/src/plugins/monitoring/CDC_dedx/scripts/README.md @@ -21,16 +21,16 @@ It also creates the following files: 1. Make a new directory and cd into it 2. Copy gaincalibs.py and fit\_dedx.C into this directory -1. Make a symbolic link from the launch results to a directory hists, eg +3. Make a symbolic link from the launch results to a directory hists, eg ```sh ln -s /work/halld/data\_monitoring/RunPeriod-2019-11/mon\_ver23/rootfiles/ hists ``` -1. Run the gaincalibs script, eg +4. Run the gaincalibs script, eg ```sh python gaincalibs.py ``` -1. Inspect the results in dedx\_peak\_scan.txt -1. Load the new gain constants into ccdb: +5. Inspect the results in dedx\_peak\_scan.txt +6. Load the new gain constants into ccdb: ```sh chmod +x addtoccdb.sh ./addtoccdb.sh From eed16a38af9f018dcbf32265dcc1b1a2064352f5 Mon Sep 17 00:00:00 2001 From: Naomi Jarvis Date: Fri, 20 Nov 2020 15:07:04 -0500 Subject: [PATCH 3/5] CDC dE/dx calibration README update --- src/plugins/monitoring/CDC_dedx/scripts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/monitoring/CDC_dedx/scripts/README.md b/src/plugins/monitoring/CDC_dedx/scripts/README.md index cc6c8d09d..fc967de46 100644 --- a/src/plugins/monitoring/CDC_dedx/scripts/README.md +++ b/src/plugins/monitoring/CDC_dedx/scripts/README.md @@ -23,7 +23,7 @@ It also creates the following files: 2. Copy gaincalibs.py and fit\_dedx.C into this directory 3. Make a symbolic link from the launch results to a directory hists, eg ```sh -ln -s /work/halld/data\_monitoring/RunPeriod-2019-11/mon\_ver23/rootfiles/ hists +ln -s /work/halld/data_monitoring/RunPeriod-2019-11/mon_ver23/rootfiles/ hists ``` 4. Run the gaincalibs script, eg ```sh From 8e87ff62d4e5559a3f22e62730cec397ed0aaa87 Mon Sep 17 00:00:00 2001 From: Naomi Jarvis Date: Fri, 20 Nov 2020 21:20:41 -0500 Subject: [PATCH 4/5] CDC dE/dx calibration README update --- src/plugins/monitoring/CDC_dedx/scripts/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/monitoring/CDC_dedx/scripts/README.md b/src/plugins/monitoring/CDC_dedx/scripts/README.md index fc967de46..9ece23c67 100644 --- a/src/plugins/monitoring/CDC_dedx/scripts/README.md +++ b/src/plugins/monitoring/CDC_dedx/scripts/README.md @@ -1,6 +1,7 @@ # CDC dE/dx calibrations -These use the histograms from the plugin CDC\_dedx. +The histograms from the plugin CDC\_dedx are used to fine-tune the gain. +One evio file is sufficient. fit\_dedx.C fits gaussians to the dE/dx bands at 0.5 and 1.5 GeV/c gaincalibs.py runs fit\_dedx.C over all root files in the subdirectory hists. @@ -25,7 +26,7 @@ It also creates the following files: ```sh ln -s /work/halld/data_monitoring/RunPeriod-2019-11/mon_ver23/rootfiles/ hists ``` -4. Run the gaincalibs script, eg +4. Run the gaincalibs script ```sh python gaincalibs.py ``` From e9c58ef8c4d436edc2035635b0c4812cf829f765 Mon Sep 17 00:00:00 2001 From: Naomi Jarvis Date: Mon, 23 Nov 2020 16:20:50 -0500 Subject: [PATCH 5/5] CDC calibration script updates --- .../FitTimeToDistance.C | 0 .../OldFitScripts/README.md | 38 ++ .../{FitScripts => OldFitScripts}/display.py | 0 .../{FitScripts => OldFitScripts}/run.py | 0 .../Calibration/CDC_TimeToDistance/README.md | 84 ++-- .../CDC_TimeToDistance/scripts/plotres.py | 53 ++ .../CDC_TimeToDistance/scripts/runcalibs.py | 84 ++++ .../scripts/scanfitresults.py | 8 + .../CDC_TimeToDistance/scripts/ttod_setup.sh | 37 ++ .../CDC_TimeToDistance/scripts/ttodfit.C | 467 ++++++++++++++++++ .../CDC_dedx/{scripts => }/README.md | 1 + 11 files changed, 734 insertions(+), 38 deletions(-) rename src/plugins/Calibration/CDC_TimeToDistance/{FitScripts => OldFitScripts}/FitTimeToDistance.C (100%) create mode 100644 src/plugins/Calibration/CDC_TimeToDistance/OldFitScripts/README.md rename src/plugins/Calibration/CDC_TimeToDistance/{FitScripts => OldFitScripts}/display.py (100%) rename src/plugins/Calibration/CDC_TimeToDistance/{FitScripts => OldFitScripts}/run.py (100%) create mode 100644 src/plugins/Calibration/CDC_TimeToDistance/scripts/plotres.py create mode 100644 src/plugins/Calibration/CDC_TimeToDistance/scripts/runcalibs.py create mode 100644 src/plugins/Calibration/CDC_TimeToDistance/scripts/scanfitresults.py create mode 100755 src/plugins/Calibration/CDC_TimeToDistance/scripts/ttod_setup.sh create mode 100644 src/plugins/Calibration/CDC_TimeToDistance/scripts/ttodfit.C rename src/plugins/monitoring/CDC_dedx/{scripts => }/README.md (95%) diff --git a/src/plugins/Calibration/CDC_TimeToDistance/FitScripts/FitTimeToDistance.C b/src/plugins/Calibration/CDC_TimeToDistance/OldFitScripts/FitTimeToDistance.C similarity index 100% rename from src/plugins/Calibration/CDC_TimeToDistance/FitScripts/FitTimeToDistance.C rename to src/plugins/Calibration/CDC_TimeToDistance/OldFitScripts/FitTimeToDistance.C diff --git a/src/plugins/Calibration/CDC_TimeToDistance/OldFitScripts/README.md b/src/plugins/Calibration/CDC_TimeToDistance/OldFitScripts/README.md new file mode 100644 index 000000000..ba16e5036 --- /dev/null +++ b/src/plugins/Calibration/CDC_TimeToDistance/OldFitScripts/README.md @@ -0,0 +1,38 @@ +# Locating the Data +At the time of writing, the CDC_TimeToDistance plugin is included in the offline monitoring at JLab. The general location is + +/cache/halld/offline_monitoring/RunPeriod-YYYY-MM/verXX/hists/hists_merged + +The instructions below assume that the scripts are run at JLab where the offline_monitoring was run with the plugin. + +# Setting up the directory +Use a directory outside of sim-recon for checking the results of the CDC_TimeToDistance plugin. Inside this directory, make a symlink to the merged histograms from the offline monitoring: + +ln -s /cache/halld/offline_monitoring/RunPeriod-YYYY-MM/verXX/hists/hists_merged hists_merged + +This will make it easy to access the files and will work properly with the script. + +Additionally, making symlinks to the scripts will also make life easier. + +ln -s $HALLD_RECON_HOME/src/plugins/Calibration/CDC_TimeToDistance/FitScripts/run.py run.py + +ln -s $HALLD_RECON_HOME/src/plugins/Calibration/CDC_TimeToDistance/FitScripts/FitTimeToDistance.C FitTimeToDistance.C + +ln -s $HALLD_RECON_HOME/src/plugins/Calibration/CDC_TimeToDistance/FitScripts/display.py display.py + +# Running the scripts +With everything prepared as described above, run the python script `run.py` + +python run.py + +This will create a set of output directories for various PNG images that will be useful to check the calibration. It will also create a directory containing the text files needed for updating CCDB. Once the directories are created, the script finds all of the runs in the hists_merged directory and executes FitTimeToDistance.C on each of the files. + +Once this completes, each new directory should be filled with images or text files. To view the relevant plots on a single canvas for all runs, use `display.py` + +python display.py + +This script assumes that the command `display .png` works, which should be true on JLab machines. + +A single canvas will appear with 5 plots. Starting on the left of the top row, this is the result with the initial CCDB constants. Moving to the right, this is what it will look like with the newly calculated constants. The final plot in this row shows the difference between the before and after. The bottom row shows the residuals as a function of drift time with the final plot being a projection onto the residual axis. + +To advance to the next run, close the window and hit enter in the terminal. diff --git a/src/plugins/Calibration/CDC_TimeToDistance/FitScripts/display.py b/src/plugins/Calibration/CDC_TimeToDistance/OldFitScripts/display.py similarity index 100% rename from src/plugins/Calibration/CDC_TimeToDistance/FitScripts/display.py rename to src/plugins/Calibration/CDC_TimeToDistance/OldFitScripts/display.py diff --git a/src/plugins/Calibration/CDC_TimeToDistance/FitScripts/run.py b/src/plugins/Calibration/CDC_TimeToDistance/OldFitScripts/run.py similarity index 100% rename from src/plugins/Calibration/CDC_TimeToDistance/FitScripts/run.py rename to src/plugins/Calibration/CDC_TimeToDistance/OldFitScripts/run.py diff --git a/src/plugins/Calibration/CDC_TimeToDistance/README.md b/src/plugins/Calibration/CDC_TimeToDistance/README.md index ba16e5036..a0de35075 100644 --- a/src/plugins/Calibration/CDC_TimeToDistance/README.md +++ b/src/plugins/Calibration/CDC_TimeToDistance/README.md @@ -1,38 +1,46 @@ -# Locating the Data -At the time of writing, the CDC_TimeToDistance plugin is included in the offline monitoring at JLab. The general location is - -/cache/halld/offline_monitoring/RunPeriod-YYYY-MM/verXX/hists/hists_merged - -The instructions below assume that the scripts are run at JLab where the offline_monitoring was run with the plugin. - -# Setting up the directory -Use a directory outside of sim-recon for checking the results of the CDC_TimeToDistance plugin. Inside this directory, make a symlink to the merged histograms from the offline monitoring: - -ln -s /cache/halld/offline_monitoring/RunPeriod-YYYY-MM/verXX/hists/hists_merged hists_merged - -This will make it easy to access the files and will work properly with the script. - -Additionally, making symlinks to the scripts will also make life easier. - -ln -s $HALLD_RECON_HOME/src/plugins/Calibration/CDC_TimeToDistance/FitScripts/run.py run.py - -ln -s $HALLD_RECON_HOME/src/plugins/Calibration/CDC_TimeToDistance/FitScripts/FitTimeToDistance.C FitTimeToDistance.C - -ln -s $HALLD_RECON_HOME/src/plugins/Calibration/CDC_TimeToDistance/FitScripts/display.py display.py - -# Running the scripts -With everything prepared as described above, run the python script `run.py` - -python run.py - -This will create a set of output directories for various PNG images that will be useful to check the calibration. It will also create a directory containing the text files needed for updating CCDB. Once the directories are created, the script finds all of the runs in the hists_merged directory and executes FitTimeToDistance.C on each of the files. - -Once this completes, each new directory should be filled with images or text files. To view the relevant plots on a single canvas for all runs, use `display.py` - -python display.py - -This script assumes that the command `display .png` works, which should be true on JLab machines. - -A single canvas will appear with 5 plots. Starting on the left of the top row, this is the result with the initial CCDB constants. Moving to the right, this is what it will look like with the newly calculated constants. The final plot in this row shows the difference between the before and after. The bottom row shows the residuals as a function of drift time with the final plot being a projection onto the residual axis. - -To advance to the next run, close the window and hit enter in the terminal. +# CDC time to distance calibrations + +These use the histograms from the plugin CDC\_TimeToDistance. +One evio file is sufficient. +The scripts referred to here are in the subdirectory scripts. + +ttod\_setup.sh copies the scripts into the current directory and creates a link to the calibration histograms +ttodfit.C fits the time to distance parameters used to estimate the track DOCA from drift time. +runcalibs.py runs ttodfit.C over all root files in the subdirectory hists. + +gaincalibs.py creates the following directories, containing one file per run: +- Before - fit function contours for the parameters stored in the root file +- After - fit function contours for the new parameters obtained from the calibration +- Combined - overlay of old and new fit function contours +- ResVsT - 2D plot of track fit residual vs drift time +- Proj - track fit residuals, fitted with a single Gaussian +- Monitoring - all of the above, on one canvas +- ccdb - file containing new calibration constants to be added to ccdb + +It also creates the following files: +- res.txt - run number and mean and sigma of the fitted Gaussian +- res6.txt - as above, for tracks with FOM 0.6+ +- res9.txt - as above, for tracks with FOM 0.9+ +- addtoccdb.sh - bash script to add the data to ccdb. +- badfiles.txt - list of files for which calibrations failed (may not be present) + +plotres.py generates plots of the mean and sigma of the Gaussian fitted to the track residuals +scanfitresults.py scans the fit results and prints a list of any with mean larger than 8μm + +**To run the calibrations:** + +1. Make a new directory and cd into it +2. Run the script ttod_setup.sh and specify the calibration launch results directory on the command line, eg +```sh +$HALLD_RECON_HOME/src/plugins/Calibration/CDC_TimeToDistance/scripts/ttod_setup.sh /work/halld/data_monitoring/RunPeriod-2019-11/mon_ver23/rootfiles/ +``` +3. Run the calibration script: +```sh +python runcalibs.py +``` +4. Inspect the results +5. Load the new gain constants into ccdb: +```sh +chmod +x addtoccdb.sh +./addtoccdb.sh +``` diff --git a/src/plugins/Calibration/CDC_TimeToDistance/scripts/plotres.py b/src/plugins/Calibration/CDC_TimeToDistance/scripts/plotres.py new file mode 100644 index 000000000..ff854daf7 --- /dev/null +++ b/src/plugins/Calibration/CDC_TimeToDistance/scripts/plotres.py @@ -0,0 +1,53 @@ + +import pandas as pd +import numpy as np +import matplotlib.pyplot as plt + +df = pd.read_fwf('res.txt',colspecs=[(0,5),(15,22),(29,36)],header=None) + +#print df.head() +print("Statistics:") +print(df.describe()) + +run = df[0] +mean = df[1] +sigma = df[2] + +plt.plot(run,10000*mean, 'bo') + + +plt.title('Mean of single gaussian fitted to track fit residuals') +plt.xlabel('Run number') +plt.ylabel(r'Mean of residuals (um)') + + +plt.show() + +plt.plot(run,10000*sigma, 'bo') + + +plt.title('Sigma of single gaussian fitted to track fit residuals') +plt.xlabel('Run number') +plt.ylabel('Sigma of track fit residuals (um)') + +plt.show() + + +#plt.plot(x,y, 'bo', x, poly1d_fn(x), 'r-') + +#coef = np.polyfit(x,y,1) + +#fpoly1 = np.poly1d(coef) + +#plt.plot(x,y,'bo') + + + +#plt.savefig("resid_mean.png") + + + +#plt.plot(x,y,'bo',fpoly1(x),'--k') +#plt.show() + + diff --git a/src/plugins/Calibration/CDC_TimeToDistance/scripts/runcalibs.py b/src/plugins/Calibration/CDC_TimeToDistance/scripts/runcalibs.py new file mode 100644 index 000000000..661b58430 --- /dev/null +++ b/src/plugins/Calibration/CDC_TimeToDistance/scripts/runcalibs.py @@ -0,0 +1,84 @@ +import os +import subprocess +import glob + +testing = 0 # just process one file + + +dirs = ['Before', 'After', 'Combined', 'ccdb', 'Monitoring', 'Proj', 'ResVsT'] +for d in dirs: + if not os.path.exists(d): + os.makedirs(d) + +#rundirlist = subprocess.check_output(["ls", "hists_merged"]).splitlines() +#for rundir in rundirlist: + +# print(rundir) + rundir = "" + +#filelist = subprocess.check_output(["ls"]).splitlines() + +if os.path.exists("hists"): + histdir = "hists" +elif os.path.exists("hists_merged"): + histdir = "hists_merged" +else: + exit("Cannot find hists or hists_merged") + + + +#filelist = subprocess.check_output(["ls", "hists_merged/" + rundir]).splitlines() +filelist = subprocess.check_output(["ls", histdir]).splitlines() + +filesdone = 0 + +for file in filelist: + + print(file) + + runfile = histdir + "/" + rundir + "/" + file + + + if os.path.isdir(runfile): + + if len(os.listdir(runfile)) == 0: + fbad = open("emptydir.txt", "a") + fbad.write(runfile) + fbad.write("\n") + fbad.close() + continue + + newlist = subprocess.check_output(["ls", runfile]).splitlines() + + runfile = runfile + "/" + newlist[0] + + + print(runfile) + + scriptname = "ttodfit.C(1,1)" + + print(scriptname) + + # look to see how many calib files have been made already + nfiles = len(os.listdir("ccdb")) + print(nfiles) + + # root -l -b -q FitTimeToDistance.C(runfile)" +# subprocess.call(["root", "-l", "-b", "-q", scriptname]) + subprocess.call(["root", "-l", "-b", "-q", runfile, scriptname]) + + # check whether the script completed & made a new file of calib consts + + print(len(os.listdir("ccdb"))) + + if len(os.listdir("ccdb")) == nfiles: + fbad = open("badfiles.txt", "a") + fbad.write(runfile) + fbad.write("\n") + fbad.close() + + filesdone = filesdone + 1 + + if testing == 1: + + break diff --git a/src/plugins/Calibration/CDC_TimeToDistance/scripts/scanfitresults.py b/src/plugins/Calibration/CDC_TimeToDistance/scripts/scanfitresults.py new file mode 100644 index 000000000..d1c6af5f0 --- /dev/null +++ b/src/plugins/Calibration/CDC_TimeToDistance/scripts/scanfitresults.py @@ -0,0 +1,8 @@ +import math + +f = open("res.txt", "r") +for x in f: + resid = x.split()[3] + runfile = x.split()[0] + if abs(float(resid)) > 0.0008: + print(runfile + " " + resid) diff --git a/src/plugins/Calibration/CDC_TimeToDistance/scripts/ttod_setup.sh b/src/plugins/Calibration/CDC_TimeToDistance/scripts/ttod_setup.sh new file mode 100755 index 000000000..57624ab49 --- /dev/null +++ b/src/plugins/Calibration/CDC_TimeToDistance/scripts/ttod_setup.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# +# Script to set up links for CDC_TimeToDistance calibration constant generation +# in current directory +# +# Arg 1 should be the location of the TimeToDistance histograms +# +# eg calibfiledir="/cache/halld/RunPeriod-2018-08/calib/ver01/hists" + + +if [ $# -ne 1 ]; then + echo + echo Usage: ttod_setup.sh calibfiledir + echo + echo eg ttod_setup.sh /cache/halld/RunPeriod-2018-08/calib/ver01/hists + echo +fi + +calibfiledir=$1 + + +if [ ! -d $1 ]; then + echo Cannot find dir $calibfiledir + exit +fi + +echo Linking subdir hists to $1 +`ln -s $1 hists` +echo + + + +cp -iv $HALLD_RECON_HOME/src/plugins/Calibration/CDC_TimeToDistance/scripts/*.py . +cp -iv $HALLD_RECON_HOME/src/plugins/Calibration/CDC_TimeToDistance/scripts/ttodfit.C . + + + diff --git a/src/plugins/Calibration/CDC_TimeToDistance/scripts/ttodfit.C b/src/plugins/Calibration/CDC_TimeToDistance/scripts/ttodfit.C new file mode 100644 index 000000000..93c7a9a52 --- /dev/null +++ b/src/plugins/Calibration/CDC_TimeToDistance/scripts/ttodfit.C @@ -0,0 +1,467 @@ +// required library change +// params a1,a2, b1,b2, c1, c2, c3 used for both + and - delta +// set up the fit so that a1, b1, c1 are the same for + and - +// a2 & b2 -ve = -1 * a2 & b2 +ve +// a3 and b3 must be 0 - only used for -ve delta. + +// I want to use the same function for both + & - +// Set up the fit function to use one set of parameters (long side/first row/+) +// For delta<0 mutliply a2, b2 * -1 + + + + +// void differentfit(int dofit=0, int savefit=0) + +double long_drift_func[3][3]; +double short_drift_func[3][3]; +double magnet_correction[2][2]; + +vector cdc_drift_table; +double Bz_avg; + +// Set values for the region cut +//float deltaMin = -0.15, deltaMax = 0.15, tMin = 300, tMax = 1200; +float deltaMin = -0.175, deltaMax = 0.175, tMin = 300, tMax = 1200; + +unsigned int Locate(vector&xx, double x){ + int n=xx.size(); + if (x==xx[0]) return 0; + else if (x==xx[n-1]) return n-2; + + int jl=-1; + int ju=n; + int ascnd=(xx[n-1]>=xx[0]); + while(ju-jl>1){ + int jm=(ju+jl)>>1; + if ( (x>=xx[jm])==ascnd) + jl=jm; + else + ju=jm; + } + return jl; +} + +Double_t TimeToDistance( Double_t *x, Double_t *par){ + Double_t d=0.0; + double delta = x[1]; // yAxis + double t = x[0]; // xAxis + + // Cut out region in fit. *** these 2 lines create the half trapezium boundaries + if (delta > deltaMax || delta < deltaMin) return 0.0; + if (delta < (((deltaMax - deltaMin) / (tMax - tMin))*(t - tMin) + deltaMin)) return 0.0; + // if (t > 950) return 0.0; + if (t > 850) return 0.0; + + // Variables to store values for time-to-distance functions for delta=0 + // and delta!=0 + double f_0=0.; + double f_delta=0.; + + if (t > 0){ + + // a3, b3 are not used. + + double a1=par[0]; + double a2=par[1]; + double a3=par[2]; + double b1=par[3]; + double b2=par[4]; + double b3=par[5]; + double c1=par[6]; + double c2=par[7]; + double c3=par[8]; + + if (delta <=0) a2=-1.0*a2; + if (delta <=0) b2=-1.0*b2; + if (delta <=0) c2=-1.0*c2; + + // use "long side" functional form + double my_t=0.001*t; + double sqrt_t=sqrt(my_t); + double t3=my_t*my_t*my_t; + double delta_mag=fabs(delta); + + double a=a1+a2*delta_mag; + double b=b1+b2*delta_mag; + double c=c1+c2*delta_mag+c3*delta*delta; + f_delta=a*sqrt_t+b*my_t+c*t3; + f_0=a1*sqrt_t+b1*my_t+c1*t3; + + + + unsigned int max_index=cdc_drift_table.size()-1; + if (t>cdc_drift_table[max_index]){ + d=f_delta; + return d; + } + + // Drift time is within range of table -- interpolate... + unsigned int index=0; + index=Locate(cdc_drift_table,t); + double dt=cdc_drift_table[index+1]-cdc_drift_table[index]; + double frac=(t-cdc_drift_table[index])/dt; + double d_0=0.01*(double(index)+frac); + + double P=0.; + double tcut=250.0; // ns + if (tGet("/CDC_TimeToDistance/Bz"); + TF2 *f1,*f2; const Int_t npar = 18; + bool isFieldOff = false; + if (Bz_hist == 0) isFieldOff = true; + f1 = new TF2("f1",TimeToDistance, 1, 1000, -0.3, 0.3, npar); + f2 = new TF2("f2",TimeToDistance, 1, 1000, -0.3, 0.3, npar); + + f1->SetNpx(1000); + f1->SetNpy(500); + f2->SetNpx(1000); + f2->SetNpy(500); + + //f1 = new TF2("f1",TimeToDistanceFieldOff, 0, 200, -0.18, 0.18, npar); + //f2 = new TF2("f2",TimeToDistanceFieldOff, 0, 200, -0.18, 0.18, npar); + + TProfile *constants = (TProfile*) gDirectory->Get("/CDC_TimeToDistance/CDC_TD_Constants"); + long_drift_func[0][0] = constants->GetBinContent(101); + long_drift_func[0][1] = constants->GetBinContent(102); + long_drift_func[0][2] = constants->GetBinContent(103); + long_drift_func[1][0] = constants->GetBinContent(104); + long_drift_func[1][1] = constants->GetBinContent(105); + long_drift_func[1][2] = constants->GetBinContent(106); + long_drift_func[2][0] = constants->GetBinContent(107); + long_drift_func[2][1] = constants->GetBinContent(108); + long_drift_func[2][2] = constants->GetBinContent(109); + magnet_correction[0][0] = constants->GetBinContent(110); + magnet_correction[0][1] = constants->GetBinContent(111); + short_drift_func[0][0] = constants->GetBinContent(112); + short_drift_func[0][1] = constants->GetBinContent(113); + short_drift_func[0][2] = constants->GetBinContent(114); + short_drift_func[1][0] = constants->GetBinContent(115); + short_drift_func[1][1] = constants->GetBinContent(116); + short_drift_func[1][2] = constants->GetBinContent(117); + short_drift_func[2][0] = constants->GetBinContent(118); + short_drift_func[2][1] = constants->GetBinContent(119); + short_drift_func[2][2] = constants->GetBinContent(120); + magnet_correction[1][0] = constants->GetBinContent(121); + magnet_correction[1][1] = constants->GetBinContent(122); + + cout << "magnet correction params " << magnet_correction[1][0] <<" " << magnet_correction[1][1] << endl; + + + for (unsigned int i=1; i<=78; i++){ + cdc_drift_table.push_back(constants->GetBinContent(i)); + } + + int run = (int) constants->GetBinContent(125); + + // So now you have the input to your function + + Double_t parameters[npar] = + {long_drift_func[0][0], long_drift_func[0][1], long_drift_func[0][2], + long_drift_func[1][0], long_drift_func[1][1], long_drift_func[1][2], + long_drift_func[2][0], long_drift_func[2][1], long_drift_func[2][2], + short_drift_func[0][0], short_drift_func[0][1], short_drift_func[0][2], + short_drift_func[1][0], short_drift_func[1][1], short_drift_func[1][2], + short_drift_func[2][0], short_drift_func[2][1], short_drift_func[2][2]}; + + // fit params from run 51317 + /* + parameters[0] = 0.981241; + parameters[1] = 0.108007; + parameters[2] = 0; + parameters[3] = -0.0546685; + parameters[4] = -0.692296; + parameters[5] = 0; + parameters[6] = -0.0214396; + parameters[7] = 0.385219; + parameters[8] = -0.248408; + + parameters[9] = 1.00239; + parameters[10] = 0.458009; + parameters[11] = -3.58926; + parameters[12] = -0.083118; + parameters[13] = -0.330808; + parameters[14] = 7.2702; + + // parameters[6] = 0; + // parameters[7] = 0; + // parameters[8] = 0; + + parameters[11]=0; + parameters[14]=0; + */ + + f1->SetParameters(parameters); + + f2->SetParameters(parameters); + + cout << "Old fit parameters:\n"; + for (int i=0; i<9; i++) printf("%.4f ",parameters[i]); + cout << endl; + for (int i=9; i<18; i++) printf("%.4f ",parameters[i]); + cout << endl; + + + + /* + double fractionalRange=0.15; + for(unsigned int i=0; i < npar; i++){ + f1->SetParLimits(i,parameters[i]-fractionalRange*parameters[i],parameters[i]+fractionalRange*parameters[i]); + f2->SetParLimits(i,parameters[i]-fractionalRange*parameters[i],parameters[i]+fractionalRange*parameters[i]); + } + */ + + TProfile2D *profile = (TProfile2D *) gDirectory->Get("/CDC_TimeToDistance/Predicted Drift Distance Vs Delta Vs t_drift, FOM 0.9+"); + + //profile->Fit("f2"); + gStyle->SetOptStat(0); + + TCanvas *c1 = new TCanvas ("c1", "c1", 800, 600); + Double_t contours[21] = + { 0.00, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, + 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0}; + Int_t ncontours = 17; + + // gPad->SetMaximum(1); + profile->SetMinimum(0); + profile->SetMaximum(1); + profile->SetContour(ncontours, contours); + + profile->DrawCopy("colz"); + profile->DrawCopy("cont3 list same"); + + f1->SetContour(ncontours, contours); + + // f1->SetParameter(12,-0.085);//,0); + + f1->DrawCopy("cont3 list same"); + + if (savefit) profile->SetTitle(Form("Run %i %s",run,profile->GetTitle())); + + if (savefit) c1->SaveAs(Form("Before/Before_Run%i.png", run)); + + + if (dofit) { + TProfile2D *rebinned = (TProfile2D*) profile->Clone(); + rebinned->SetName("rebinned"); + rebinned->Rebin2D(4,4); + + TCanvas *c2 = new TCanvas ("c2", "c2", 800, 600); + c2->cd(); + + rebinned->SetContour(ncontours, contours); + + rebinned->DrawCopy("colz"); + rebinned->DrawCopy("cont3 list same"); + + + // fix unused params at 0 + + f2->SetParameter(2,0); //a3 + f2->FixParameter(2,0); + + f2->SetParameter(5,0); //b3 + f2->FixParameter(5,0); + + f2->SetParameter(8,0); //c3 + f2->FixParameter(8,0); + + for (int i=9; i<18; i++) { + f2->SetParameter(i,0); + f2->FixParameter(i,0); + } + + + // drawing without 0 removes the profile + // option S returns the parameter array + TFitResultPtr fr = rebinned->Fit("f2", "S0"); + + f2->SetContour(ncontours, contours); + + f2->Draw("cont3 list same"); + // c2->Update(); + + + // new TCanvas; + // profileRebin->Draw("colz"); + + + // if (savefit) c2->SaveAs(Form("newfit_Run%i.png", run)); + + if (savefit) rebinned->SetTitle(Form("Run %i %s",run,rebinned->GetTitle())); + if (savefit) c2->SaveAs(Form("After/After_Run%i.png", run)); + + if ((Int_t) fr == 0){ // Fit converged with no errors + + double newparams[18]; + for (int i=0; i<9; i++) newparams[i] = fr->Parameter(i); + for (int i=0; i<9; i++) newparams[i+9] = fr->Parameter(i); + newparams[10] = -1.0*newparams[1]; + newparams[13] = -1.0*newparams[4]; + newparams[16] = -1.0*newparams[7]; + + + cout << "New fit parameters:\n"; + for (int i=0; i<9; i++) printf("%.4f ",newparams[i]); + cout << endl; + for (int i=9; i<18; i++) printf("%.4f ",newparams[i]); + cout << endl; + + if (savefit) { + ofstream outputTextFile; + outputTextFile.open(Form("ccdb/ccdb_Format_%i.txt",run)); + outputTextFile << newparams[0] << " " << newparams[1] << " " << newparams[2] << " " ; + outputTextFile << newparams[3] << " " << newparams[4] << " " << newparams[5] << " " ; + outputTextFile << newparams[6] << " " << newparams[7] << " " << newparams[8] << " " ; + outputTextFile << magnet_correction[0][0] << " " << magnet_correction[0][1] << endl; + outputTextFile << newparams[9] << " " << newparams[10] << " " << newparams[11] << " " ; + outputTextFile << newparams[12] << " " << newparams[13] << " " << newparams[14] << " " ; + outputTextFile << newparams[15] << " " << newparams[16] << " " << newparams[17] << " " ; + outputTextFile << magnet_correction[1][0] << " " << magnet_correction[1][1] << endl; + outputTextFile.close(); + } + + + + + + + gStyle->SetOptFit(); + + + TCanvas *c3 = new TCanvas ("c3", "c3", 800, 600); + f1->Draw("cont2 list"); + f1->SetLineColor(3); + f2->Draw("cont2 list same"); + + c3->Update(); + c3->SaveAs(Form("Combined/Combined_Run%i.png", run)); + + + // Get Residual vs Drift Time + TH2I *resVsT = (TH2I*)gDirectory->Get("/CDC_TimeToDistance/Residual Vs. Drift Time"); + TCanvas *c4 = new TCanvas("c4", "c4", 800, 600); + resVsT->Draw("colz"); + resVsT->SetTitle(Form("Run %i %s",run,resVsT->GetTitle())); + c4->SaveAs(Form("ResVsT/ResVsT_Run%i.png", run)); + + TCanvas *c5 = new TCanvas("c5", "c5", 800, 600); + + TH1D* p = (TH1D*)resVsT->ProjectionY(); + //p = (TH1D*)resVsT->ProjectionY("_py", resVsT->GetXaxis()->FindBin(100.), -1); + p->Draw(); + p->Fit("gaus", "sqWR", "", -0.01, 0.01); + + TF1 *g = p->GetFunction("gaus"); + Double_t mean = g->GetParameter(1); + Double_t sig = g->GetParameter(2); + + printf("res mean %.5f sigma %.5f\n",mean,sig); + + c5->SaveAs(Form("Proj/Proj_ResVsT_Run%i.png", run)); + + + + FILE *fitop = fopen("res.txt","a"); + fprintf(fitop,"%d res mean %.5f sigma %.5f\n",run,mean,sig); + fclose(fitop); + + //---- + // Get Residual vs Drift Time + TH2I *resVsT9 = (TH2I*)gDirectory->Get("/CDC_TimeToDistance/Residual Vs. Drift Time, FOM 0.9+"); + TH1D* p9 = (TH1D*)resVsT9->ProjectionY(); + //p = (TH1D*)resVsT->ProjectionY("_py", resVsT->GetXaxis()->FindBin(100.), -1); + p9->Fit("gaus", "sqWR", "", -0.01, 0.01); + + g = p9->GetFunction("gaus"); + mean = g->GetParameter(1); + sig = g->GetParameter(2); + + printf("fom 0.9+ res mean %.5f sigma %.5f\n",mean,sig); + + FILE *fitop9 = fopen("res9.txt","a"); + fprintf(fitop9,"%d res mean %.5f sigma %.5f\n",run,mean,sig); + fclose(fitop9); + + //---- + // Get Residual vs Drift Time + TH2I *resVsT6 = (TH2I*)gDirectory->Get("/CDC_TimeToDistance/Residual Vs. Drift Time, FOM 0.6+"); + TH1D* p6 = (TH1D*)resVsT6->ProjectionY(); + //p = (TH1D*)resVsT->ProjectionY("_py", resVsT->GetXaxis()->FindBin(100.), -1); + p6->Fit("gaus", "sqWR", "", -0.01, 0.01); + + g = p6->GetFunction("gaus"); + mean = g->GetParameter(1); + sig = g->GetParameter(2); + + printf("fom 0.6+ res mean %.5f sigma %.5f\n",mean,sig); + + FILE *fitop6 = fopen("res6.txt","a"); + fprintf(fitop6,"%d res mean %.5f sigma %.5f\n",run,mean,sig); + fclose(fitop6); + + + //---- + + TCanvas *c6 = new TCanvas("c6", "c6", 1600, 900); + c6->Divide(3, 2, 0.001, 0.001); + c6->cd(1); + profile->SetContour(ncontours, contours); + profile->Draw("colz"); + f1->SetContour(ncontours, contours); + profile->Draw("cont2 list same"); + f1->Draw("cont3 list same"); + c6->Update(); + + c6->cd(2); + profile->Draw("colz"); + f2->SetContour(ncontours, contours); + profile->Draw("cont2 list same"); + f2->Draw("cont3 list same"); + c6->Update(); + + c6->cd(3); + f1->Draw("cont3 list"); + f1->SetLineColor(3); + f2->Draw("cont3 list same"); + c6->Update(); + + c6->cd(4); + resVsT->Draw("colz"); + c6->Update(); + + c6->cd(5); + p->Draw(); + c6->Update(); + + c6->SaveAs(Form("Monitoring/Monitoring_Run%i.png", run)); + + FILE *fadd = fopen("addtoccdb.sh","a"); + fprintf(fadd,"ccdb add CDC/drift_parameters -r %i-%i ccdb/ccdb_Format_%i.txt\n",run,run,run); + fclose(fadd); + + } // if dofit + } // if fr==0 + + gApplication->Terminate(); + //return; + + +} + diff --git a/src/plugins/monitoring/CDC_dedx/scripts/README.md b/src/plugins/monitoring/CDC_dedx/README.md similarity index 95% rename from src/plugins/monitoring/CDC_dedx/scripts/README.md rename to src/plugins/monitoring/CDC_dedx/README.md index 9ece23c67..2e35eb945 100644 --- a/src/plugins/monitoring/CDC_dedx/scripts/README.md +++ b/src/plugins/monitoring/CDC_dedx/README.md @@ -2,6 +2,7 @@ The histograms from the plugin CDC\_dedx are used to fine-tune the gain. One evio file is sufficient. +The scripts referred to here are in the subdirectory scripts. fit\_dedx.C fits gaussians to the dE/dx bands at 0.5 and 1.5 GeV/c gaincalibs.py runs fit\_dedx.C over all root files in the subdirectory hists.