diff --git a/Software/AutomatedMeasurements/ElectronicMonkeyFocusing.py b/Software/AutomatedMeasurements/ElectronicMonkeyFocusing.py index d816009..2bba757 100644 --- a/Software/AutomatedMeasurements/ElectronicMonkeyFocusing.py +++ b/Software/AutomatedMeasurements/ElectronicMonkeyFocusing.py @@ -9,18 +9,26 @@ After the measurement, the position of the laser along x and z is reset. Parameters: +- , the type of measurement; +- , the parameter identifying the measurement; - , the first x position; - , the last x position; - , the step size along x; - , the first z position; - , the last z position; -- , the step size along z. +- , the step size along z; +- , the date according to the yyyymmdd format. + +Some more information about . +If = , = 200 means that the measurement is taken at 200 V. +If = , = 23.0 means that the measurement is taken at 23.0 dB. +More functionalities can be implemented. How to run it: -python ElectronicMonkeyFocusing.py --m --fx --lx --sx --fz --lz --sz --date +python ElectronicMonkeyFocusing.py --m --p --fx --lx --sx --fz --lz --sz --date For example: -python ElectronicMonkeyFocusing.py --f Alignment --fx 0 --lx 50 --sx 2 --fz -400 --lz -200 --sz 20 --date 20150106 +python ElectronicMonkeyFocusing.py --f CCEBiasVoltageScan --p 200 --fx 0 --lx 50 --sx 2 --fz -400 --lz -200 --sz 20 --date 20150106 Arduino device ID: DEVICE ID 2341:0042 on Bus 001 Address 045, Communications Device (in hexadecimal) @@ -41,6 +49,7 @@ parser = argparse.ArgumentParser(description='Define the parameters of the automated measurement for focusing.') parser.add_argument('--m',help='type of measurement') +parser.add_argument('--p',help='parameter identifying the measurement') parser.add_argument('--fx',type=int,help='first x position') parser.add_argument('--lx',type=int,help='last x position') parser.add_argument('--sx',type=int,help='step size along x') @@ -55,6 +64,7 @@ # Parameters and configuration. measurement = args.m +par = args.p firstx = args.fx lastx = args.lx @@ -116,7 +126,12 @@ # Take a pedestal run. if not os.path.exists(folder+"/Hans410/"+measurement): os.makedirs(folder+"/Hans410/"+measurement) -filename = folder+"/Hans410/"+measurement+"/"+str(yyyymmdd)+"-216-"+"ped.ali" +if (measurement == "CCEBiasVoltageScan") : + filename = folder+"/Hans410/"+measurement+"/"+str(yyyymmdd)+"-"+par+"V"+"-216-"+"ped.ali" +elif (measurement == "CCEAttenuationScan") : + filename = folder+"/Hans410/"+measurement+"/"+str(yyyymmdd)+"-"+par+"dB"+"-216-"+"ped.ali" +else : + filename = folder+"/Hans410/"+measurement+"/"+str(yyyymmdd)+"-216-"+"ped.ali" printcommand = "echo alibava-gui --no-gui --nevts="+str(nevents)+" --out="+filename+" --pedestal "+config command = "alibava-gui --no-gui --nevts="+str(nevents)+" --out="+filename+" --pedestal "+config print '***' @@ -128,7 +143,14 @@ for posx in range(firstx,lastx+stepx,stepx) : print 'Position along x: %i steps' % posx print 'Position along z: %i steps' % posz - filename = folder+"/Hans410/"+measurement+"/"+str(yyyymmdd)+"-216-"+str(posx)+"x-"+str(posz)+"z-las.ali" + + if (measurement == "CCEBiasVoltageScan") : + filename = folder+"/Hans410/"+measurement+"/"+str(yyyymmdd)+"-"+par+"V"+"-216-"+str(posx)+"x-"+str(posz)+"z-las.ali" + elif (measurement == "CCEAttenuationScan") : + filename = folder+"/Hans410/"+measurement+"/"+str(yyyymmdd)+"-"+par+"dB"+"-216-"+str(posx)+"x-"+str(posz)+"z-las.ali" + else : + filename = folder+"/Hans410/"+measurement+"/"+str(yyyymmdd)+"-216-"+str(posx)+"x-"+str(posz)+"z-las.ali" + printcommand = "echo alibava-gui --no-gui --nevts="+str(nevents)+" --out="+filename+" --laser "+config command = "alibava-gui --no-gui --nevts="+str(nevents)+" --out="+filename+" --laser "+config print '***' diff --git a/Software/CCE/CCE.C b/Software/CCE/CCE.C index e18b58a..0b7ef28 100644 --- a/Software/CCE/CCE.C +++ b/Software/CCE/CCE.C Binary files differ diff --git a/Software/CCEBiasVoltageScan/CCEBiasVoltageScan.C b/Software/CCEBiasVoltageScan/CCEBiasVoltageScan.C new file mode 100644 index 0000000..5f837c3 --- /dev/null +++ b/Software/CCEBiasVoltageScan/CCEBiasVoltageScan.C @@ -0,0 +1,254 @@ +//************************************************ +// Author: Federica Lionetto +// Created on: 27/02/2015 +//************************************************ + +/* +CCEBiasVoltageScan reads all the ROOT files of a given CCE bias voltage data taking and shows how the mu and sigma of the charge sharing coefficient eta vary as a function of the bias voltage. + +The CCE bias voltage data taking is identified by the following information: +- , that is, the type of sensor (Hans410, ...); +- , that is, the date when the measurement was taken; +- , that is, the position along z; +- , that is, the first value of the bias voltage; +- , that is, the last value of the bias voltage; +- , that is, the step between two subsequent data acquisitions. + +Compile with: + +make + +Run with: + +./CCEBiasVoltageScan [sensor] [date] [z] [firstV] [lastV] [stepV] [additional folder] + +For example: + +./CCEBiasVoltageScan Hans410 20141121 176 100 200 20 + +A folder named AnalysisResults will be created in a fixed location and a ROOT file will be saved in there. A folder named Figures will be created inside the folder named AnalysisResults, with some monitoring plots. + +If needed, an additional folder can be specified, that will be created inside the folder named AnalysisResults. +*/ + +#include "../Tools/Lib.C" +#include "../Tools/lhcbStyle.C" +#include "../Tools/Style.C" + +#include "../Tools/Par.C" + +void CCEBiasVoltageScan(char *sensor, char *date, char *z, const Float_t firstV, const Float_t lastV, const Float_t stepV, char *externalPath=0); + +int main(int argc, char *argv[]) +{ + getLHCbStyle(); + PersonalStyle(); + + if ((argc == 2) && (string(argv[1]) == "--info")) + { + cout << "**************************************************" << endl; + + cout << "CCEBiasVoltageScan reads all the ROOT files of a given CCE bias voltage data taking and shows how the mu and sigma of the charge sharing coefficient eta vary as a function of the bias voltage." << endl; + + cout << "The CCE bias voltage data taking is identified by the following information:" << endl; + cout << "- , that is, the type of sensor (Hans410, ...);" << endl; + cout << "- , that is, the date when the measurement was taken;" << endl; + cout << "- , that is, the position along z;" << endl; + cout << "- , that is, the first value of the bias voltage;" << endl; + cout << "- , that is, the last value of the bias voltage;" << endl; + cout << "- , that is, the step between two subsequent data acquisitions." << endl; + + cout << "Compile with:" << endl; + + cout << "make" << endl; + + cout << "Run with:" << endl; + + cout << "./CCEBiasVoltageScan [sensor] [date] [z] [firstV] [lastV] [stepV] [additional folder]" << endl; + + cout << "For example:" << endl; + + cout << "./CCEBiasVoltageScan Hans410 20141121 176 100 200 20" << endl; + + cout << "A folder named AnalysisResults will be created in a fixed location and a ROOT file will be saved in there. A folder named Figures will be created inside the folder named AnalysisResults, with some monitoring plots." << endl; + + cout << "If needed, an additional folder can be specified, that will be created inside the folder named AnalysisResults." << endl; + + cout << "**************************************************" << endl; + + return 0; + } + else if (argc < 7) + { + cout << "**************************************************" << endl; + + cout << "Error! Arguments missing..." << endl; + cout << "Please use the following format:" << endl; + cout << "./CCEBiasVoltageScan [1] [2] [3] [4] [5] [6]" << endl; + cout << "with:" << endl; + cout << "[1] = Type of sensor (Hans410, ...);" << endl; + cout << "[2] = Date;" << endl; + cout << "[3] = Position along z;" << endl; + cout << "[4] = First value of the bias voltage;" << endl; + cout << "[5] = Last value of the bias voltage" << endl; + cout << "[6] = Step between two subsequent data acquisitions;" << endl; + cout << "[7] = Additional folder, optional." << endl; + cout << "Type ./CCEBiasVoltageScan --info for more information." << endl; + + cout << "**************************************************" << endl; + + return 0; + } + else + { + cout << "Type of sensor: " << argv[1] << endl; + cout << "Date: " << argv[2] << endl; + cout << "Position along z: " << argv[3] << endl; + cout << "First value of the bias voltage: " << argv[4] << endl; + cout << "Last value of the bias voltage: " << argv[5] << endl; + cout << "Step between two subsequent data acquisitions: " << argv[6] << endl; + if (argc == 7) + CCEBiasVoltageScan(argv[1],argv[2],argv[3],atoi(argv[4]),atoi(argv[5]),atoi(argv[6])); + else if (argc == 8) + CCEBiasVoltageScan(argv[1],argv[2],argv[3],atoi(argv[4]),atoi(argv[5]),atoi(argv[6]),argv[7]); + else + { + cout << "Error! Too many arguments given..." << endl; + + return 0; + } + + return 0; + } +} + +void CCEBiasVoltageScan(char *sensor, char *date, char *z, const Float_t firstV, const Float_t lastV, const Float_t stepV, char *externalPath) +{ + cout << "**************************************************" << endl; + cout << "Bias voltage scan of charge sharing coefficient..." << endl; + cout << "**************************************************" << endl; + + // Do not comment this line. + gROOT->ProcessLine("#include "); + + // Do some fanciness to get the directory right. + string inputDirectory = "/disk/groups/hep/flionett/TestStand/AnalysisResults/"+string(sensor)+"/CCEBiasVoltageScan"; + string outputDirectory = "/disk/groups/hep/flionett/TestStand/AnalysisResults/"+string(sensor)+"/CCEBiasVoltageScan"; + if (externalPath!=0) + outputDirectory = string(outputDirectory+"/"+externalPath); + cout << "The input directory is: " << inputDirectory << endl; + cout << "The output directory is: " << outputDirectory << endl; + + // Create the outputDirectory directory if it does not exist. + string path_to_make = "mkdir -p "+outputDirectory; + system(path_to_make.c_str()); + + cout << "Figures stored in: " << outputDirectory+"/Figures/"+"CCE-ProcessRawData-"+date+"-216-"+z+"z" << endl; + + // Create a directory named Figures inside the directory named outputDirectory if it does not exist. + string path_to_make_figures = "mkdir -p "+outputDirectory+"/Figures/"+"CCE-ProcessRawData-"+date+"-216-"+z+"z"; + system(path_to_make_figures.c_str()); + + TString path_to_figures = (string(path_to_make_figures)).substr((string(path_to_make_figures)).find_last_of(' ')+1); + + char char_input_ROOT[200]; + string input_ROOT; + string output_ROOT; + + const Int_t steps = (Int_t)((lastV-firstV)/stepV+1); + Float_t V[steps]; + Float_t uV[steps]; + + Float_t muEtaSignalOverNoise[steps]; + Float_t sigmaEtaSignalOverNoise[steps]; + + Float_t umuEtaSignalOverNoise[steps]; + Float_t usigmaEtaSignalOverNoise[steps]; + + // Get information from tree. + Float_t muEtaSignalOverNoise1; + Float_t sigmaEtaSignalOverNoise1; + + Float_t umuEtaSignalOverNoise1; + Float_t usigmaEtaSignalOverNoise1; + + TBranch *b_muEtaSignalOverNoise1 = 0; + TBranch *b_sigmaEtaSignalOverNoise1 = 0; + + TBranch *b_umuEtaSignalOverNoise1 = 0; + TBranch *b_usigmaEtaSignalOverNoise1 = 0; + + // Open output ROOT file. + output_ROOT = outputDirectory+"/CCEBiasVoltageScan-"+date+"-216-"+z+"z"+".root"; + TFile *output = TFile::Open(TString(output_ROOT),"RECREATE"); + + for (Int_t step=0;stepGet("tFitResults"); + int Events = tFitResults->GetEntries(); + if (Events != 1) + { + cout << "Error! The ROOT file has been corrupted..." << endl; + + return ; + } + else + { + tFitResults->SetBranchAddress("muEtaSignalOverNoise",&muEtaSignalOverNoise1,&b_muEtaSignalOverNoise1); + tFitResults->SetBranchAddress("sigmaEtaSignalOverNoise",&sigmaEtaSignalOverNoise1,&b_sigmaEtaSignalOverNoise1); + tFitResults->SetBranchAddress("umuEtaSignalOverNoise",&umuEtaSignalOverNoise1,&b_umuEtaSignalOverNoise1); + tFitResults->SetBranchAddress("usigmaEtaSignalOverNoise",&usigmaEtaSignalOverNoise1,&b_usigmaEtaSignalOverNoise1); + + tFitResults->GetEntry(); + } + + muEtaSignalOverNoise[step] = muEtaSignalOverNoise1; + sigmaEtaSignalOverNoise[step] = sigmaEtaSignalOverNoise1; + umuEtaSignalOverNoise[step] = umuEtaSignalOverNoise1; + usigmaEtaSignalOverNoise[step] = usigmaEtaSignalOverNoise1; + + // Close input data ROOT files. + input->Close(); + } + + output->cd(); + + // Plot mu. + TGraphErrors *gMuEtaSignalOverNoiseVSV = new TGraphErrors(steps,V,muEtaSignalOverNoise,uV,umuEtaSignalOverNoise); + InitGraphErrors(gMuEtaSignalOverNoiseVSV,"Charge sharing coefficient - #mu","V (V)","#mu (#mum)"); + + TCanvas *cMuEtaSignalOverNoiseVSV = new TCanvas(Form("cMuEtaSignalOverNoiseVSV-%s",date),"",550,300); + DrawGraphErrors(cMuEtaSignalOverNoiseVSV,gMuEtaSignalOverNoiseVSV,"APC",path_to_figures); + + // Plot sigma. + TGraphErrors *gSigmaEtaSignalOverNoiseVSV = new TGraphErrors(steps,V,sigmaEtaSignalOverNoise,uV,usigmaEtaSignalOverNoise); + InitGraphErrors(gSigmaEtaSignalOverNoiseVSV,"Charge sharing coefficient - #sigma","V (V)","#sigma (#mum)"); + + TCanvas *cSigmaEtaSignalOverNoiseVSV = new TCanvas(Form("cSigmaEtaSignalOverNoiseVSV-%s",date),"",550,300); + DrawGraphErrors(cSigmaEtaSignalOverNoiseVSV,gSigmaEtaSignalOverNoiseVSV,"APC",path_to_figures); + + // Write output ROOT file. + output->Write(); + + // Close output ROOT file. + output->Close(); + + return; +} diff --git a/Software/CCEBiasVoltageScan/Makefile b/Software/CCEBiasVoltageScan/Makefile new file mode 100755 index 0000000..e8b9086 --- /dev/null +++ b/Software/CCEBiasVoltageScan/Makefile @@ -0,0 +1,34 @@ +# +CC=$(CXX) +glib_cflags=$(shell pkg-config --cflags glib-2.0 gio-2.0) +glib_libs=$(shell pkg-config --libs glib-2.0 gio-2.0) + +ROOTC=$(shell root-config --cflags) +ROOTL=$(shell root-config --libs) +OPT=-g -fno-inline #-std=c++11 +CppFLAGS=$(OPT) -I. $(glib_cflags) +CXXFLAGS=-fPIC $(CppFLAGS) + + +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + SO=so + SO_FLAGS=-shared + CXXFLAGS += -D LINUX +endif +ifeq ($(UNAME_S),Darwin) + SO=dylib + SO_FLAGS=-dynamiclib -undefined dynamic_lookup -install_name @rpath/$@ + CXXFLAGS += -D OSX +endif + +all: CCEBiasVoltageScan + +CCEBiasVoltageScan: CCEBiasVoltageScan.C + c++ -I$(OPT) $(CXXFLAGS) $(ROOTC) -o $@ $^ $(LDLIBS) $(ROOTL) $(gliblibs) + + +clean: + rm -f *.o CCEBiasVoltageScan + rm -rf *.dSYM + diff --git a/Software/Focusing/Focusing.C b/Software/Focusing/Focusing.C index 3d484d6..dc94da7 100644 --- a/Software/Focusing/Focusing.C +++ b/Software/Focusing/Focusing.C @@ -10,6 +10,7 @@ mu = p0+p1*z and sigma = q0*|z-q1|+q2, respectively, and the values returned by the fit are printed out on the screen. The starting values and the limits of the parameters of the two sigma functions are set according to the filename of the measurement, by using the "assignParInfoSigma" procedure. Knowing p1, the angle alpha = arctan(p1) between the laser and the normal to the surface of the sensor is also determined. Its uncertainty is calculated from its derivative, which is a good estimate for the moment, but not fully correct. +The fit results are written to a tree called tFitResults. The focusing data taking is identified by the following information: - , that is, the type of sensor (Hans410, ...); @@ -62,6 +63,7 @@ cout << "The mu and sigma as a function of the z position are fitted by the functions mu = p0+p1*z and sigma = q0*|z-q1|+q2, respectively, and the values returned by the fit are printed out on the screen." << endl; cout << "The starting values and the limits of the parameters of the two sigma functions are set according to the filename of the measurement, by using the 'assignParInfoSigma' procedure." << endl; cout << "Knowing p1, the angle alpha = arctan(p1) between the laser and the normal to the surface of the sensor is also determined. Its uncertainty is calculated from its derivative, which is a good estimate for the moment, but not fully correct." << endl; + cout << "The fit results are written to a tree called tFitResults." << endl; cout << "**************************************************" << endl; @@ -384,10 +386,6 @@ // Show fit results for mu and sigma. gStyle->SetOptFit(1); - gStyle->SetStatX(0.9); - gStyle->SetStatY(0.55); - gStyle->SetStatW(0.16); - gStyle->SetStatH(0.23); gStyle->SetFitFormat(".2g"); // Mu - parameters. @@ -414,19 +412,18 @@ Float_t maxMu = z[stepsz-1]; // Mu - left edge. + + // Mu - style for left fit results. + gStyle->SetStatX(0.65); + gStyle->SetStatY(0.9); + TGraphErrors *gmuLeft = new TGraphErrors(stepsz,z,muLeft,uz,umuLeft); InitGraphErrors(gmuLeft,"Focusing - left side","z (#mum)","#mu_{left} (#mum)"); TCanvas *cmuLeft = new TCanvas("cmuLeft","",400,300); gmuLeft->GetXaxis()->SetLimits(z[0]-100.,z[stepsz-1]+100.); TF1 *fitMuLeft = new TF1("fitMuLeft","pol1",minMu,maxMu); - fitMuLeft->SetLineColor(kMagenta); - gmuLeft->Fit(fitMuLeft,"BR"); - - p0Left = fitMuLeft->GetParameter(0); - up0Left = fitMuLeft->GetParError(0); - p1Left = fitMuLeft->GetParameter(1); - up1Left = fitMuLeft->GetParError(1); + fitMu(l,gmuLeft,fitMuLeft,&p0Left,&p1Left,&up0Left,&up1Left); alphaLeft = atan(p1Left); ualphaLeft = up1Left/(1+p1Left*p1Left); @@ -434,25 +431,28 @@ DrawGraphErrors(cmuLeft,gmuLeft,"AP",path_to_figures); // Mu - right edge. + + // Mu - style for right fit results. + gStyle->SetStatX(0.85); + gStyle->SetStatY(0.9); + TGraphErrors *gmuRight = new TGraphErrors(stepsz,z,muRight,uz,umuRight); InitGraphErrors(gmuRight,"Focusing - right side","z (#mum)","#mu_{right} (#mum)"); TCanvas *cmuRight = new TCanvas("cmuRight","",400,300); gmuRight->GetXaxis()->SetLimits(z[0]-100.,z[stepsz-1]+100.); TF1 *fitMuRight = new TF1("fitMuRight","pol1",minMu,maxMu); - fitMuRight->SetLineColor(kMagenta); - gmuRight->Fit(fitMuRight,"BR"); - - p0Right = fitMuRight->GetParameter(0); - up0Right = fitMuRight->GetParError(0); - p1Right = fitMuRight->GetParameter(1); - up1Right = fitMuRight->GetParError(1); + fitMu(r,gmuRight,fitMuRight,&p0Right,&p1Right,&up0Right,&up1Right); alphaRight = atan(p1Right); ualphaRight = up1Right/(1+p1Right*p1Right); DrawGraphErrors(cmuRight,gmuRight,"AP",path_to_figures); + // Sigma - style for fit results. + gStyle->SetStatX(0.85); + gStyle->SetStatY(0.9); + // Sigma - parameters. // y = p0*|x-p1|+p2, with x = z position (microns) and y = sigma (microns). Float_t q0Left; @@ -505,6 +505,46 @@ gStyle->SetOptFit(0); gStyle->SetFitFormat("5.4g"); + // Save parameters. + TTree *tFitResults = new TTree("tFitResults","tFitResults"); + + // Left edge. + tFitResults->Branch("p0Left",&p0Left); + tFitResults->Branch("p1Left",&p1Left); + tFitResults->Branch("alphaLeft",&alphaLeft); + + tFitResults->Branch("up0Left",&up0Left); + tFitResults->Branch("up1Left",&up1Left); + tFitResults->Branch("ualphaLeft",&ualphaLeft); + + tFitResults->Branch("q0Left",&q0Left); + tFitResults->Branch("q1Left",&q1Left); + tFitResults->Branch("q2Left",&q2Left); + + tFitResults->Branch("uq0Left",&uq0Left); + tFitResults->Branch("uq1Left",&uq1Left); + tFitResults->Branch("uq2Left",&uq2Left); + + // Right edge. + tFitResults->Branch("p0Right",&p0Right); + tFitResults->Branch("p1Right",&p1Right); + tFitResults->Branch("alphaRight",&alphaRight); + + tFitResults->Branch("up0Right",&up0Right); + tFitResults->Branch("up1Right",&up1Right); + tFitResults->Branch("ualphaRight",&ualphaRight); + + tFitResults->Branch("q0Right",&q0Right); + tFitResults->Branch("q1Right",&q1Right); + tFitResults->Branch("q2Right",&q2Right); + + tFitResults->Branch("uq0Right",&uq0Right); + tFitResults->Branch("uq1Right",&uq1Right); + tFitResults->Branch("uq2Right",&uq2Right); + + tFitResults->Fill(); + tFitResults->Print(); + // Print parameters. cout << "**********************************" << endl; diff --git a/Software/Tools/SCurve.C b/Software/Tools/SCurve.C index 36922d9..3369e5a 100644 --- a/Software/Tools/SCurve.C +++ b/Software/Tools/SCurve.C @@ -12,6 +12,7 @@ - assignParInfoSigma sets the starting values and the limits of the parameters of the two sigma functions according to the filename of the measurement; - assignParInfoEta sets the starting values and the limits of the parameters of the erf function describing the charge sharing coefficient according to the filename of the measurement; - fitSCurve fits the s-curve and returns the result of the fit; +- fitMu fits the mu as a function of the z position and returns the result of the fit. - fitSigma fits the sigma as a function of the z position and returns the result of the fit. */ @@ -40,6 +41,8 @@ void fitSCurve(string edge, TGraph *graph, TF1 *f, Float_t parSCurves[], Int_t lengthParSCurves, Float_t *a, Float_t *mu, Float_t *sigma, Float_t *b, Float_t *ua, Float_t *umu, Float_t *usigma, Float_t *ub); +void fitMu(string edge, TGraph *graph, TF1 *f, Float_t *p0, Float_t *p1, Float_t *up0, Float_t *up1); + void fitSigma(string edge, TGraph *graph, TF1 *f, Float_t parSigma[], Int_t lengthParSigma, Float_t *q0, Float_t *q1, Float_t *q2, Float_t *uq0, Float_t *uq1, Float_t *uq2); // Definitions. @@ -401,7 +404,7 @@ - else if ((filename == "ProcessRawData-201502253-216") || (filename == "ProcessRawData-20150226-216") || (filename == "ProcessRawData-201502262-216")) { + else if ((filename == "ProcessRawData-201502253-216") || (filename == "ProcessRawData-20150226-216") || (filename == "ProcessRawData-201502262-216") || (filename == "ProcessRawData-20150226-100V-216") || (filename == "ProcessRawData-20150226-120V-216") || (filename == "ProcessRawData-20150226-140V-216") || (filename == "ProcessRawData-20150226-160V-216") || (filename == "ProcessRawData-20150226-180V-216") || (filename == "ProcessRawData-20150226-200V-216")) { // Right. *minRight = 30.; *maxRight = 140.; @@ -573,7 +576,7 @@ // - Float_t parEta[], the array containing the parameters of the erf function; // - Float_t lengthParEta, the length of the array containing the parameters of the erf function. void assignParInfoEta(string filename, Float_t parEta[], Int_t lengthParEta) { - if ((filename == "ProcessRawData-201502262-216")) { + if ((filename == "ProcessRawData-201502262-216") || (filename == "ProcessRawData-20150226-100V-216") || (filename == "ProcessRawData-20150226-120V-216") || (filename == "ProcessRawData-20150226-140V-216") || (filename == "ProcessRawData-20150226-160V-216") || (filename == "ProcessRawData-20150226-180V-216") || (filename == "ProcessRawData-20150226-200V-216")) { parEta[0] = 1.5; parEta[1] = 140.; parEta[2] = 5.; @@ -645,11 +648,30 @@ return; } +void fitMu(string edge, TGraph *graph, TF1 *f, Float_t *p0, Float_t *p1, Float_t *up0, Float_t *up1) { + // Set parameter names. + f->SetParName(0,"p_{0}"); + f->SetParName(1,"p_{1}"); + + // Fit. + f->SetLineColor(kRed); + graph->Fit(f,"BR"); + + // Get parameters and parameter uncertainties. + *p0 = f->GetParameter(0); + *p1 = f->GetParameter(1); + + *up0 = f->GetParError(0); + *up1 = f->GetParError(1); + + return; +} + void fitSigma(string edge, TGraph *graph, TF1 *f, Float_t parSigma[], Int_t lengthParSigma, Float_t *q0, Float_t *q1, Float_t *q2, Float_t *uq0, Float_t *uq1, Float_t *uq2) { // Set parameter names. - f->SetParName(0,"{q}_0"); - f->SetParName(1,"{q}_1"); - f->SetParName(2,"{q}_2"); + f->SetParName(0,"q_{0}"); + f->SetParName(1,"q_{1}"); + f->SetParName(2,"q_{2}"); // Set parameters and parameter limits. if (edge == "left") {