diff --git a/Software/Arduino/ResetAndControlStepperMotors216/ResetAndControlStepperMotors216.ino b/Software/Arduino/ResetAndControlStepperMotors216/ResetAndControlStepperMotors216.ino index 5de01e0..e240169 100644 --- a/Software/Arduino/ResetAndControlStepperMotors216/ResetAndControlStepperMotors216.ino +++ b/Software/Arduino/ResetAndControlStepperMotors216/ResetAndControlStepperMotors216.ino @@ -62,15 +62,27 @@ int switchXState = 0; int switchZState = 0; +// Sensor properties. +char sensor[] = "Hans410"; + // Scan properties. // Maximum distance from the x micro switch (!!!) // const int maxStepsX = 16000; // Maximum distance from the z micro switch (!!!) // const int maxStepsZ = 5400; + +// Hans410 sensor. // Move the laser 3.60 cm (7200 steps) away from the x micro switch -const int stepsFromXSwitch = 7200; +// const int stepsFromXSwitch = 7200; +// Move the laser 1.80 cm (3600) away from the z micro switch +// const int stepsFromZSwitch = 3600; + +// Hans320 sensor. +// Move the laser 5.40 cm (10800 steps) away from the x micro switch +const int stepsFromXSwitch = 10800; // Move the laser 1.80 cm (3600) away from the z micro switch const int stepsFromZSwitch = 3600; + // Total number of steps we need along x. // const int totStepsX = 200; // Total number of steps we need along y. @@ -157,18 +169,11 @@ Serial.println("Position along z successfully initialized."); - Serial.println("Moving the laser 3.60 cm (7200 steps) away from the x micro switch..."); - myMotorX->step(stepsFromXSwitch,BACKWARD,DOUBLE); - - Serial.println("Laser moved 3.60 cm (7200 steps) away from the x micro switch."); - - Serial.println("Moving the laser 1.80 cm (3600 steps) away from the z micro switch..."); - myMotorZ->step(stepsFromZSwitch,FORWARD,DOUBLE); - - Serial.println("Laser moved 1.80 cm (3600 steps) away from the z micro switch."); - + + Serial.println("Laser moved away from the x and z micro switches."); + myMotorX->setSpeed(speedSlow); myMotorZ->setSpeed(speedSlow); diff --git a/Software/BiasVoltageScan/BiasVoltageScan.C b/Software/BiasVoltageScan/BiasVoltageScan.C index 1458827..cf40274 100644 --- a/Software/BiasVoltageScan/BiasVoltageScan.C +++ b/Software/BiasVoltageScan/BiasVoltageScan.C @@ -83,8 +83,8 @@ gROOT->ProcessLine("#include "); // Do some fanciness to get the directory right. - string inputDirectory = "~/TestStand/AnalysisResults/"+string(sensor)+"/BiasVoltageScan"; - string outputDirectory = "~/TestStand/AnalysisResults/"+string(sensor)+"/BiasVoltageScan"; + string inputDirectory = "/disk/groups/hep/flionett/TestStand/AnalysisResults/"+string(sensor)+"/BiasVoltageScan"; + string outputDirectory = "/disk/groups/hep/flionett/TestStand/AnalysisResults/"+string(sensor)+"/BiasVoltageScan"; if (externalPath!=0) outputDirectory = string(outputDirectory+"/"+externalPath); cout << "The input directory is: " << inputDirectory << endl; @@ -115,7 +115,7 @@ string input_ROOT; string output_ROOT = outputDirectory+"/BiasVoltageScan-"+filename+".root"; - const Float_t minV = 10.; + const Float_t minV = 30.; const Float_t maxV = 350.; const Float_t stepV = 10.; const Int_t steps = (Int_t)((maxV-minV)/stepV+1); diff --git a/Software/BiasVoltageScan/BiasVoltageScan.C~ b/Software/BiasVoltageScan/BiasVoltageScan.C~ deleted file mode 100644 index 723474a..0000000 --- a/Software/BiasVoltageScan/BiasVoltageScan.C~ +++ /dev/null @@ -1,194 +0,0 @@ -//************************************************ -// Author: Federica Lionetto -// Created on: 14/11/2014 -//************************************************ - -/* -BiasVoltageScan reads all the ROOT files of a given bias voltage scan data taking, call FindStrip to find the Beetle channel corresponding to the strip hit by the laser, and creates a ROOT file with the following information: -- a graph with the mean ADC count on the strip hit by the laser as a function of the bias voltage; -- a graph with the mean of the sum of the ADC counts of four adjacent strips around that hit by the laser as a function of the bias voltage. - -The bias voltage scan data taking is identified by the following information: -- , that is, the type of sensor (Hans410, ...); -- , that is, the filename excluding the bias voltage value and the run type. -*/ - -#include "../Tools/Lib.C" -#include "../Tools/lhcbStyle.C" -#include "../Tools/Style.C" -#include "../Tools/Useful.C" - -#include "../Tools/FindStrip.C" -#include "../Tools/Par.C" - -void BiasVoltageScan(char *sensor, char *filename, char *externalPath = 0); - -int main(int argc, char *argv[]) -{ - getLHCbStyle(); - PersonalStyle(); - - if ((argc == 2) && (string(argv[1]) == "--info")) - { - cout << "**************************************************" << endl; - - cout << "Some comments." << endl; - - cout << "**************************************************" << endl; - - return 0; - } - else if (argc < 3) - { - cout << "**************************************************" << endl; - - cout << "Error! Type of sensor or filename missing..." << endl; - cout << "Please use the following format:" << endl; - cout << "./BiasVoltageScan [1] [2] [3]" << endl; - cout << "with:" << endl; - cout << "[1] = Type of sensor (Hans410, ...);" << endl; - cout << "[2] = Filename, excluding the bias voltage value and the run type;" << endl; - cout << "[3] = Additional folder, optional." << endl; - cout << "Type ./BiasVoltageScan --info for more information." << endl; - - cout << "**************************************************" << endl; - - return 0; - } - else - { - cout << "Type of sensor: " << argv[1] << endl; - cout << "Filename: " << argv[2] << endl; - if (argc == 3) - BiasVoltageScan(argv[1],argv[2]); - else if (argc == 4) - BiasVoltageScan(argv[1],argv[2],argv[3]); - else - { - cout << "Error! Too many arguments given..." << endl; - - return 0; - } - - return 0; - } -} - -void BiasVoltageScan(char *sensor, char *filename, char *externalPath) -{ - cout << "**************************************************" << endl; - cout << "Performing bias voltage scan..." << endl; - cout << "**************************************************" << endl; - - // Do not comment this line. - gROOT->ProcessLine("#include "); - - // Do some fanciness to get the directory right. - string inputDirectory = "~/TestStand/AnalysisResults/"+string(sensor)+"/BiasVoltageScan"; - string outputDirectory = "~/TestStand/AnalysisResults/"+string(sensor)+"/BiasVoltageScan"; - 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/"+filename << 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/"+filename; - 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); - - // Execute findStrip. - int strip; - string direction; - - string inputFindStrip = inputDirectory+"/"+filename+"-150V-las.root"; - string outputFindStrip = outputDirectory+"/FindStrip-"+filename+"-150V-las.root"; - - FindStrip(inputFindStrip,outputFindStrip,path_to_figures,&strip,&direction); - - char char_input_ROOT[200]; - string input_ROOT; - string output_ROOT = outputDirectory+"/BiasVoltageScan-"+filename+".root"; - - const Float_t minV = 10.; - const Float_t maxV = 350.; - const Float_t stepV = 10.; - const Int_t steps = (Int_t)((maxV-minV)/stepV+1); - Float_t V[steps]; - Float_t meanADC[steps]; - Float_t mean4ADC[steps]; - - // Open output ROOT file. - TFile *output = TFile::Open(TString(output_ROOT),"RECREATE"); - - for (Int_t step=0;stepGet(Form("hADCPedSub%d",strip)); - meanADC[step] = hist->GetMean(); - - // Four adjacent strips. - TH1D *hist1 = (TH1D *)input->Get(Form("hADCPedSub%d",strip)); - TH1D *hist2 = (TH1D *)input->Get(Form("hADCPedSub%d",strip+NSkip)); - TH1D *hist3 = (TH1D *)input->Get(Form("hADCPedSub%d",strip-NSkip)); - TH1D *hist4; - if (direction == "left") - hist4 = (TH1D *)input->Get(Form("hADCPedSub%d",strip-2*NSkip)); - else if (direction == "right") - hist4 = (TH1D *)input->Get(Form("hADCPedSub%d",strip+2*NSkip)); - mean4ADC[step] = hist1->GetMean()+hist2->GetMean()+hist3->GetMean()+hist4->GetMean(); - - // Close input data ROOT files. - input->Close(); - } - - output->cd(); - - // Only one strip. - TGraph *gbiasVoltageScan = new TGraph(steps,V,meanADC); - InitGraph(gbiasVoltageScan,"Bias voltage scan - 1 strip","Bias voltage (V)","ADC counts"); - TCanvas *cbiasVoltageScan = new TCanvas(Form("cbiasVoltageScan-%s",filename),"",400,300); - DrawGraph(cbiasVoltageScan,gbiasVoltageScan,"APC",path_to_figures); - - // Four adjacent strips. - TGraph *gbiasVoltageScan4 = new TGraph(steps,V,mean4ADC); - InitGraph(gbiasVoltageScan4,"Bias voltage scan - 4 adjacent strips","Bias voltage (V)","ADC counts"); - TCanvas *cbiasVoltageScan4 = new TCanvas(Form("cbiasVoltageScan4-%s",filename),"",400,300); - DrawGraph(cbiasVoltageScan4,gbiasVoltageScan4,"APC",path_to_figures); - - // Write output ROOT file. - output->Write(); - - // Close output ROOT file. - output->Close(); - - return; -} diff --git a/Software/IVScan/IVScan.C b/Software/IVScan/IVScan.C index 028a475..6c7c4bf 100644 --- a/Software/IVScan/IVScan.C +++ b/Software/IVScan/IVScan.C @@ -314,8 +314,8 @@ gIVScan1->SetMarkerColor(kMagenta); gIVScan2->SetMarkerColor(kOrange); - // TLegend *legIVScan = CreateLegend2(gIVScan1,"increasing V",gIVScan2,"decreasing V","epw",0.2,0.6,0.5,0.9); - TLegend *legIVScan = CreateLegend2(gIVScan1,"18/03/2015",gIVScan2,"22/07/2014","epw",0.65,0.18,0.94,0.42); + TLegend *legIVScan = CreateLegend2(gIVScan1,"increasing V",gIVScan2,"decreasing V","epw",0.2,0.6,0.5,0.9); + // TLegend *legIVScan = CreateLegend2(gIVScan1,"18/03/2015",gIVScan2,"22/07/2014","epw",0.65,0.18,0.94,0.42); mgIVScan->Add(gIVScan1); mgIVScan->Add(gIVScan2); diff --git a/Software/LaserDelayScan/LaserDelayScan.C b/Software/LaserDelayScan/LaserDelayScan.C index 00612af..e26e488 100644 --- a/Software/LaserDelayScan/LaserDelayScan.C +++ b/Software/LaserDelayScan/LaserDelayScan.C @@ -169,7 +169,7 @@ */ // Do some fanciness to get the directory right. - string analysis = "/home/hep/flionett/TestStand/AnalysisResults"; + string analysis = "/disk/groups/hep/flionett/TestStand/AnalysisResults"; if (externalPath!=0) analysis = string(analysis+"/"+externalPath); @@ -204,7 +204,7 @@ // Fit with a polynomial function of degree 2 and get the delay and the signal at the peak. // gStyle->SetOptFit(0011); float minFit = 55.; - float maxFit = 85.; + float maxFit = 90.; TF1 *fpol2 = new TF1("fpol2","pol2",minFit,maxFit); glaserDelayScan->Fit("fpol2","R"); diff --git a/Software/PulseShapevsV/Makefile~ b/Software/PulseShapevsV/Makefile~ deleted file mode 100755 index a212d07..0000000 --- a/Software/PulseShapevsV/Makefile~ +++ /dev/null @@ -1,34 +0,0 @@ -# -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: ComputePedestals - -ComputePedestals: ComputePedestals.C - c++ -I$(OPT) $(CXXFLAGS) $(ROOTC) -o $@ $^ $(LDLIBS) $(ROOTL) $(gliblibs) - - -clean: - rm -f *.o ComputePedestals - rm -rf *.dSYM - diff --git a/Software/PulseShapevsV/PulseShapevsV.C b/Software/PulseShapevsV/PulseShapevsV.C index debedb9..e3d1005 100644 --- a/Software/PulseShapevsV/PulseShapevsV.C +++ b/Software/PulseShapevsV/PulseShapevsV.C @@ -246,7 +246,7 @@ */ // Do some fanciness to get the directory right. - string analysis = "/home/hep/flionett/TestStand/AnalysisResults"; + string analysis = "/disk/groups/hep/flionett/TestStand/AnalysisResults"; if (externalPath!=0) analysis = string(analysis+"/"+externalPath); diff --git a/Software/PulseShapevsV/PulseShapevsV.C~ b/Software/PulseShapevsV/PulseShapevsV.C~ deleted file mode 100644 index 26ae795..0000000 --- a/Software/PulseShapevsV/PulseShapevsV.C~ +++ /dev/null @@ -1,105 +0,0 @@ -//************************************************ -// Author: Federica Lionetto -// Created on: 20/11/2014 -//************************************************ - -/* -PulseShapevsV reads two text files (containing the bias voltage and the current values) and creates a ROOT file with the following information: -- laser delay at the peak of the Beetle pulse shape (float laserDelayAtPeak) as a function of the bias voltage; -- average ADC signal at the peak of the Beetle pulse shape (float float averageADCSignalAtPeak) as a function of the bias voltage. - -Compile with: - -make - -Run with: - -./PulseShapevsV [input text file 1] [input text file 2] [additional folder] - -where - -- [input text file 1] is the complete path, including the folder and the filename, of the text file one wants to process (increasing bias voltage); -- [input text file 2] is the complete path, including the folder and the filename, of the text file one wants to process (decreasing bias voltage); -- [additional folder] is the optional additional folder where the output will be saved. - -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/Useful.C" - -#include "../Tools/Par.C" - -void PulseShapevsV(char *filename1, char *filename2, char *externalPath=0); - -int main(int argc, char *argv[]) -{ - getLHCbStyle(); - PersonalStyle(); - - if ((argc ==2) && (string(argv[1]) == "--info")) - { - cout << "**************************************************" << endl; - - cout << "Some comments." << endl; - - cout << "**************************************************" << endl; - - return 0; - } - else if (argc < 3) - { - cout << "**************************************************" << endl; - - cout << "Error! Input files missing..." << endl; - cout << "Please use the following format:" << endl; - cout << "./PulseShapevsV [1] [2] [3]" << endl; - cout << "with:" << endl; - cout << "[1] = Input text file 1, complete path (increasing bias voltage);" << endl; - cout << "[2] = Input text file 2, complete path (decreasing bias voltage);" << endl; - cout << "[3] = Additional folder, optional." << endl; - cout << "Type ./PulseShapevsV --info for more information." << endl; - - cout << "**************************************************" << endl; - - return 0; - } - else - { - cout << "File 1 to process: " << argv[1] << endl; - cout << "File 2 to process: " << argv[2] << endl; - if (argc == 3) - PulseShapevsV(argv[1],argv[2]); - else if (argc == 4) - PulseShapevsV(argv[1],argv[2],argv[3]); - else - { - cout << "Error! Too many arguments given..." << endl; - - return 0; - } - - return 0; - } -} - -void IVScan(char *filename1, char *filename2, char *externalPath) -{ - cout << "**************************************************" << endl; - cout << "Showing the pulse shape changes as a function of the bias voltage..." << endl; - cout << "**************************************************" << endl; - - // Do not comment this line. - gROOT->ProcessLine("#include "); - - - - - - -return; -}