Commit 6c480de9 authored by Vratislav Chudoba's avatar Vratislav Chudoba

User interface was optimalized.

parent 6e1dd979
...@@ -17,12 +17,13 @@ ...@@ -17,12 +17,13 @@
ClassImp(AculCalibration); ClassImp(AculCalibration);
AculCalibration::AculCalibration() : fA(0), fB(0) AculCalibration::AculCalibration() : fEnergy(0), fEnergyInput(0), fA(0), fB(0), fPeak(0)
{ {
//default constructor //default constructor
fCurrentHStack = NULL; fCurrentHStack = NULL;
fCurrentHistList.IsOwner(); fCurrentHistList.IsOwner();
// todo: change size of fA and fB in some other place
fA.Set(32); fA.Set(32);
fB.Set(32); fB.Set(32);
...@@ -34,16 +35,20 @@ AculCalibration::AculCalibration() : fA(0), fB(0) ...@@ -34,16 +35,20 @@ AculCalibration::AculCalibration() : fA(0), fB(0)
fFitMinSigma = 0.; fFitMinSigma = 0.;
fFitPeakThreshold = 0.; fFitPeakThreshold = 0.;
for(Int_t i = 0; i < DEFAULTNOPEAKS; i++) { fDeadLayer = 0.;
fEnergy[i] = 0;
} /*for(Int_t i = 0; i < DEFAULTNOPEAKS; i++) {
// fEnergy[i] = 0.;
// fEnergyInput[i] = 0.;
// fPeak[i] = 0.;
}*/
fCalInformation = 0; fCalInformation = 0;
Reset(); Reset();
} }
AculCalibration::AculCalibration(const char* parfile) AculCalibration::AculCalibration(const char* calfile) : fEnergy(0), fEnergyInput(0), fPeak(0)
{ {
//constructor which fills fAOld, fBOld, fC, fD from file parfile //constructor which fills fAOld, fBOld, fC, fD from file parfile
...@@ -58,14 +63,26 @@ AculCalibration::AculCalibration(const char* parfile) ...@@ -58,14 +63,26 @@ AculCalibration::AculCalibration(const char* parfile)
fFitMinSigma = 0.; fFitMinSigma = 0.;
fFitPeakThreshold = 0.; fFitPeakThreshold = 0.;
for(Int_t i = 0; i < DEFAULTNOPEAKS; i++) { /*for(Int_t i = 0; i < DEFAULTNOPEAKS; i++) {
fEnergy[i] = 0; // fEnergy[i] = 0.;
} // fEnergyInput[i] = 0.;
// fPeak[i] = 0.;
}*/
fCalInformation = 0; fCalInformation = 0;
SetCalibrationParameters(parfile); SetCalibrationParameters(calfile);
}
void AculCalibration::Reset()
{
for (Int_t j = 0; j < fA.GetSize(); j++) {
fA[j] = 0;
fB[j] = 0;
}
return;
} }
AculCalibration::~AculCalibration() AculCalibration::~AculCalibration()
...@@ -77,6 +94,13 @@ AculCalibration::~AculCalibration() ...@@ -77,6 +94,13 @@ AculCalibration::~AculCalibration()
} }
void AculCalibration::Init() {
SetELosses();
SetInputParameters();
SetCalEnergies();
}
Int_t AculCalibration::SearchPeaks(const TH1 *hin, Double_t sigma, Option_t *option, const Int_t searchedpeaks) Int_t AculCalibration::SearchPeaks(const TH1 *hin, Double_t sigma, Option_t *option, const Int_t searchedpeaks)
{ {
//Function searching peaks in inputed TH1 spectrum and selects the peaks in the histogram. //Function searching peaks in inputed TH1 spectrum and selects the peaks in the histogram.
...@@ -140,7 +164,7 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s ...@@ -140,7 +164,7 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s
return 1; return 1;
} }
Int_t peaksNumber = SearchPeaks(hSpectrum, sigmamin, "", kRaNOPEAKS); const Int_t peaksNumber = SearchPeaks(hSpectrum, sigmamin, "", kRaNOPEAKS);
if (peaksNumber != kRaNOPEAKS) { if (peaksNumber != kRaNOPEAKS) {
Info("PeaksFitting", "In histogram %s was found %d peaks", hSpectrum->GetName(), peaksNumber); Info("PeaksFitting", "In histogram %s was found %d peaks", hSpectrum->GetName(), peaksNumber);
...@@ -231,7 +255,8 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s ...@@ -231,7 +255,8 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s
//peaks sorting //peaks sorting
Int_t j[peaksNumber]; Int_t j[peaksNumber];
TMath::Sort(peaksNumber, peak, j, kFALSE); TMath::Sort(peaksNumber, peak, j, kFALSE);
for (Int_t i = 0; i < 4; i++) { fPeak.Set(peaksNumber);
for (Int_t i = 0; i < peaksNumber; i++) {
fPeak[i] = peak[j[i]]; fPeak[i] = peak[j[i]];
} }
...@@ -272,97 +297,61 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s ...@@ -272,97 +297,61 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s
// return 1; // return 1;
//} //}
Bool_t AculCalibration::SetInputParameters(const char* inputparfile) void AculCalibration::SetParFileName(const char *parfile) {
{ fParFileName = parfile;
const Int_t lineLength = 400; }
Char_t line[lineLength];
Char_t parameter[100];
Char_t identificator[100];
ifstream fipr;
fipr.open(inputparfile);
if (!fipr.is_open()) {
Error("SetInputsParameters", "File with input parameters was not opened");
return kFALSE;
}
while (!fipr.eof()) {
fipr.getline(line, lineLength);
if (strlen(line) == 0) {
continue;
}
sscanf(line, "%s %s", parameter, identificator);
if ( strcmp(identificator, "nopeaks") == 0 ) {
kRaNOPEAKS = static_cast<Int_t>(atoi(parameter));
for (Int_t i = 0; i < kRaNOPEAKS; i++) {
fipr.getline(line, lineLength);
sscanf(line, "%s", parameter);
fEnergy[i] = static_cast<Double_t>(atof(parameter));
}
}//if
if ( strcmp(identificator, "lowerchannel") == 0 ) {
sscanf(line, "%s", parameter);
fLowerChannel = static_cast<Double_t>(atof(parameter));
}
if ( strcmp(identificator, "upperchannel") == 0 ) {
sscanf(line, "%s", parameter);
fUpperChannel = static_cast<Double_t>(atof(parameter));
}
if ( strcmp(identificator, "lowerpeakhight") == 0 ) {
sscanf(line, "%s", parameter);
fLowerPeakRelativeHight = static_cast<Double_t>(atof(parameter));
}
if ( strcmp(identificator, "upperpeakhight") == 0 ) { void AculCalibration::SetELosses() {
sscanf(line, "%s", parameter);
fUpperPeakRelativeHight = static_cast<Double_t>(atof(parameter));
}
if ( strcmp(identificator, "peakpositiontolerance") == 0 ) { Info("AculCalibration::SetELosses", "Combination of aplha particle with silicon material only.");
sscanf(line, "%s", parameter); fAlphaSi.SetEL(1, 2.321); // density in g/cm3
fPeakPositionTolerance = static_cast<Double_t>(atof(parameter)); fAlphaSi.AddEL(14., 28.086, 1); //Z, mass
} // mSi.SetZP(1., 1.); //protons
fAlphaSi.SetZP(2., 4.); //alphas, Z, A
fAlphaSi.SetEtab(100000, 200.); // ?, MeV calculate ranges
fAlphaSi.SetDeltaEtab(300);
}
if ( strcmp(identificator, "fitfunctionlinewidth") == 0 ) { void AculCalibration::SetCalEnergies() {
sscanf(line, "%s", parameter);
fFitFuncLineWidth = static_cast<Width_t>(atoi(parameter));
}
if ( strcmp(identificator, "minfitsigma") == 0 ) { if (fDeadLayer<=0.) {
sscanf(line, "%s", parameter); Warning("AculCalibration::SetCalEnergies", "Dead layer was set equal or less than 0.");
fFitMinSigma = static_cast<Double_t>(atof(parameter)); for(Int_t i = 0; i < kRaNOPEAKS; i++) {
fEnergy[i] = fEnergyInput[i];
} }
Info("AculCalibration::SetCalEnergies", "Energies used for calibration are the same as input file.");
if ( strcmp(identificator, "fithightthreshold") == 0 ) { return;
sscanf(line, "%s", parameter);
fFitPeakThreshold = static_cast<Double_t>(atof(parameter));
} }
for(Int_t i = 0; i < kRaNOPEAKS; i++) {
fEnergy[i] = fAlphaSi.GetE(fEnergyInput[i], fDeadLayer);
} }
Info("AculCalibration::SetCalEnergies", "Energies used for calibration considering %f mcm dead layer were set.", fDeadLayer);
return;
fipr.close();
return kTRUE;
} }
void AculCalibration::PrintInputParameters() void AculCalibration::PrintInputParameters()
{ {
//print alpha source parameters //print alpha source parameters
cout << "Number of peaks: " << kRaNOPEAKS << endl cout << "AculCalibration::PrintInputParameters:" << endl;
<< endl; cout << "\tNumber of peaks: " << kRaNOPEAKS << endl;
for (Int_t i = 0; i < kRaNOPEAKS; i++) {
cout << "\t\tfEnergyInput[" << i << "] = " << fEnergyInput[i] << endl;
}
cout << "\tEnergies used for calibration:" << endl;
cout << "\t(deadLayer: " << fDeadLayer << " mcm)" << endl;
// Info("AculCalibration::PrintInputParameters", "Number of peaks: %d", kRaNOPEAKS);
for (Int_t i = 0; i < kRaNOPEAKS; i++) { for (Int_t i = 0; i < kRaNOPEAKS; i++) {
cout << "fEnergy[" << i << "] = " << fEnergy[i] << endl; cout << "\t\tfEnergy[" << i << "] = " << fEnergy[i] << endl;
} }
cout << "\tlowerChannel: " << fLowerChannel << "; upperChannel: " << fUpperChannel << ";" << endl;
cout << "\tlowerPeakHight: " << fLowerPeakRelativeHight << "; upperPeakHight: " << fUpperPeakRelativeHight << ";" << endl;
cout << "\tfitHightThreshold: " << fFitPeakThreshold << "; minFitSigma: " << fFitMinSigma << ";" << endl;
cout << "\tpeakPositionTolerance: " << fPeakPositionTolerance << ";" << endl;
cout << "\tfitFunctionLineWidth: " << fFitFuncLineWidth << ";" << endl;
return; return;
...@@ -723,7 +712,7 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch ...@@ -723,7 +712,7 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch
//promenne potrebne pro fitovani: presunout nize //promenne potrebne pro fitovani: presunout nize
//pohlidat delete //pohlidat delete
TF1 *calFunction = new TF1("calib", "pol1", 0, 1000); //predelat jako lokalni promennou fce (nebo snad tridy?) TF1 *calFunction = new TF1("calib", "pol1", 0, 1000); //predelat jako lokalni promennou fce (nebo snad tridy?)
TGraph *calGraph = new TGraph(kRaNOPEAKS, fPeak, fEnergy); //lokalni promenna, dohodit pocet vstupu pomoci parametru TGraph *calGraph = new TGraph(kRaNOPEAKS, fPeak.GetArray(), fEnergy.GetArray()); //lokalni promenna, dohodit pocet vstupu pomoci parametru
TString detectorChannel; TString detectorChannel;
TString histName; TString histName;
...@@ -839,7 +828,7 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch ...@@ -839,7 +828,7 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch
} }
void AculCalibration::CalibrateRawSpectra() { void AculCalibration::CalibrateRawSpectra() {
//todo: implement this function
//function parameters: //function parameters:
const char* iFileName = "clb01_0001.root"; const char* iFileName = "clb01_0001.root";
const char* treeName = "AnalysisxTree"; const char* treeName = "AnalysisxTree";
...@@ -1240,10 +1229,7 @@ void AculCalibration::ShowEnergySpectra(const char *filename, TCanvas* energyCan ...@@ -1240,10 +1229,7 @@ void AculCalibration::ShowEnergySpectra(const char *filename, TCanvas* energyCan
fHEnergyStack.Add(hDraw); fHEnergyStack.Add(hDraw);
} }
} }
// if (fHEnergyStack) {
// if (opt.Contains("+")) { fHEnergyStack->Draw(); }
// else { fHEnergyStack->Draw("nostack"); }
// }
if (opt.Contains("+")) { fHEnergyStack.Draw(); } if (opt.Contains("+")) { fHEnergyStack.Draw(); }
else { fHEnergyStack.Draw("nostack"); } else { fHEnergyStack.Draw("nostack"); }
} }
...@@ -1270,52 +1256,18 @@ void AculCalibration::ShowEnergySpectra(const char *filename, TCanvas* energyCan ...@@ -1270,52 +1256,18 @@ void AculCalibration::ShowEnergySpectra(const char *filename, TCanvas* energyCan
hDraw->SetAxisRange(xaxismin, xaxismax, "X"); hDraw->SetAxisRange(xaxismin, xaxismax, "X");
hDraw->Draw(); hDraw->Draw();
hDraw->SetDirectory(0); hDraw->SetDirectory(0);
// if (fHEnergyList) {
// fHEnergyList->Add(hDraw);
// }
fHEnergyList.Add(hDraw); fHEnergyList.Add(hDraw);
} }
}//else }//else
fr->Close(); fr->Close();
// fFileName = filename;
// fFileName.Resize(fFileName.Length() - 6);
// fFileName.Append(".cal", 4);
energyCanvas->Update(); energyCanvas->Update();
return; return;
} }
void AculCalibration::DivideCanvas(TCanvas *c1, Int_t inputs) {}
Bool_t AculCalibration::AddCalFileToList(const char* calfilelist)
{
//this function does not work at the moment
//some problem with TString object fFileName
TString fl = calfilelist;
fl.ToLower();
ofstream fw;
fw.open(fl.Data(), ofstream::app);
if (!fw.is_open()) {
cout << "File " << fl.Data() << " was not opened" << endl;
return kFALSE;
}
// fw << fFileName.Data() << endl;
fw.close();
return kTRUE;
}
void AculCalibration::ClearHistograms(Option_t* option) void AculCalibration::ClearHistograms(Option_t* option)
{ {
//clear THStack and TObjArray members //clear THStack and TObjArray members
...@@ -1334,110 +1286,113 @@ void AculCalibration::ClearHistograms(Option_t* option) ...@@ -1334,110 +1286,113 @@ void AculCalibration::ClearHistograms(Option_t* option)
} }
void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfilelist) void AculCalibration::DeleteStacks(Option_t* option) {
{
//calibrationfile: file with calibration parameters to be created
//calfilelist: file containing list of existing text files with calibration parameters
ifstream calListR; if (fCurrentHStack) {
calListR.open(calfilelist); delete fCurrentHStack;
if( !calListR.is_open() ) { fCurrentHStack = NULL;
cout << "File with list of calibration files was not opened" << endl;
return;
} }
//asi fce Reset() fCurrentHistList.Delete();
for (Int_t j = 0; j < ADDRESSNUMBER; j++) { return;
fA[j] = 0; }
fB[j] = 0;
void AculCalibration::SetInputParameters() {
// TString iFile = inputparfile;
if (fParFileName.Length()==0) {
Warning("AculCalibration::SetInputsParameters", "File with input parameters was not set.");
return;
} }
const Int_t lineLength = 100; const Int_t lineLength = 400;
char line[lineLength]; Char_t line[lineLength];
char filename[50]; Char_t parameter[100];
// ifstream calFileR; Char_t identificator[100];
Int_t crate, /*i,*/ j, id;
// int crate, i, j, id;
char cA[40], cB[40], cSigma[40];
while (!calListR.eof()) {
calListR.getline(line, lineLength);
// cout << line << endl;
sscanf(line, "%s", filename);
cout << filename << endl;
ifstream calFileR;
calFileR.open(filename);
if (calFileR.is_open()) {
cout << filename << " processing" << endl;
calFileR.seekg(0);
while (!calFileR.eof()) {
// cout << " in inner while" << endl;
calFileR.getline(line, lineLength);
sscanf(line, "%d %d %s %s %d %s", &crate, /*&i,*/ &j, cA, cB, &id, cSigma);
// cout << line << endl;
if (id == 0) {
fA[j] = static_cast<Double_t>(atof(cA));
fB[j] = static_cast<Double_t>(atof(cB));
// fMeanSigma[i][j] = static_cast<Double_t>(atof(cSigma));
cout << fA[j] << "\t" << fB[j] << endl;
}//if
}//while
calFileR.close();
cout << "calFileR was closed" << endl << endl;
}//if
}//while
calListR.close();
ofstream CalibFileW; ifstream fipr;
CalibFileW.open(calibrationfile); fipr.open(fParFileName.Data());
if (!CalibFileW.is_open()) { if (!fipr.is_open()) {
cout << "Calibration file was not opened" << endl; Error("AculCalibration::SetInputsParameters", "File with input parameters \"%s\" was not opened.", fParFileName.Data());
return; return;
} }
for (Int_t j = 0; j < ADDRESSNUMBER; j++) { Info("AculCalibration::SetInputsParameters", "File with input parameters \"%s\" will be processed.", fParFileName.Data());
if (fA[j] != 0) {
CalibFileW << std::right while (!fipr.eof()) {
<< setw(2) << "3"
<< setw(4) << j fipr.getline(line, lineLength);
<< setw(12) << fA[j] if (strlen(line) < 2) {
<< setw(12) << fB[j] continue;
// << setw(10) << fMeanSigma[i][j] }
<< endl;
sscanf(line, "%s %s", parameter, identificator);
if ( strcmp(identificator, "noPeaks") == 0 ) {
kRaNOPEAKS = static_cast<Int_t>(atoi(parameter));
fEnergyInput.Set(kRaNOPEAKS);
for (Int_t i = 0; i < kRaNOPEAKS; i++) {
fipr.getline(line, lineLength);
sscanf(line, "%s", parameter);
fEnergyInput[i] = static_cast<Double_t>(atof(parameter));
} }
continue;
}//if
if ( strcmp(identificator, "lowerChannel") == 0 ) {
sscanf(line, "%s", parameter);
fLowerChannel = static_cast<Double_t>(atof(parameter));
} }
CalibFileW.close(); if ( strcmp(identificator, "upperChannel") == 0 ) {
sscanf(line, "%s", parameter);
fUpperChannel = static_cast<Double_t>(atof(parameter));
}
return; if ( strcmp(identificator, "lowerPeakHight") == 0 ) {
sscanf(line, "%s", parameter);
fLowerPeakRelativeHight = static_cast<Double_t>(atof(parameter));
}
} if ( strcmp(identificator, "upperPeakHight") == 0 ) {
sscanf(line, "%s", parameter);
fUpperPeakRelativeHight = static_cast<Double_t>(atof(parameter));
}
void AculCalibration::DeleteStacks(Option_t* option) { if ( strcmp(identificator, "peakPositionTolerance") == 0 ) {
sscanf(line, "%s", parameter);
fPeakPositionTolerance = static_cast<Double_t>(atof(parameter));
}
if (fCurrentHStack) { if ( strcmp(identificator, "fitFunctionLineWidth") == 0 ) {
delete fCurrentHStack; sscanf(line, "%s", parameter);
fCurrentHStack = NULL; fFitFuncLineWidth = static_cast<Width_t>(atoi(parameter));
} }
fCurrentHistList.Delete(); if ( strcmp(identificator, "minFitSigma") == 0 ) {
sscanf(line, "%s", parameter);
fFitMinSigma = static_cast<Double_t>(atof(parameter));
}
return; if ( strcmp(identificator, "fitHightThreshold") == 0 ) {
} sscanf(line, "%s", parameter);
fFitPeakThreshold = static_cast<Double_t>(atof(parameter));
}
void AculCalibration::Reset() if ( strcmp(identificator, "deadLayer") == 0 ) {
{ sscanf(line, "%s", parameter);
//reset calibration parameters fAOld, fBOld, fC, fD to zero fDeadLayer = static_cast<Double_t>(atof(parameter));
}
for (Int_t j = 0; j < ADDRESSNUMBER; j++) {
fA[j] = 0;
fB[j] = 0;
// fC[0][j] = 0.;
// fD[0][j] = 0.;
// fMeanSigma[i][j] = 0;
} }
fipr.close();
return; return;
} }
void AculCalibration::DivideCanvas(TCanvas *c1, Int_t inputs) {}
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include "../TELoss/TELoss.h"
#define DEFAULTNOPEAKS 20 #define DEFAULTNOPEAKS 20
#define ADDRESSNUMBER 32 #define ADDRESSNUMBER 32
...@@ -44,9 +46,9 @@ public: ...@@ -44,9 +46,9 @@ public:
//???? - pocet nespravne zkalibrovanych spekter //???? - pocet nespravne zkalibrovanych spekter
//fEnergy[4] - tabulka s energiemi piku, nacita se zvenci //fEnergy[4] - tabulka s energiemi piku, nacita se zvenci
//private: private:
//todo: following variables should be deleted
// TObjArray *fHRawList; //list of raw histograms, list is set to owner // TObjArray *fHRawList; //list of raw histograms, list is set to owner
TObjArray fHRawList; //list of raw histograms, list is set to owner TObjArray fHRawList; //list of raw histograms, list is set to owner
TObjArray fHAnalyzedList; //list of fitted and analyzed histograms, list is set to owner TObjArray fHAnalyzedList; //list of fitted and analyzed histograms, list is set to owner
...@@ -74,20 +76,17 @@ public: ...@@ -74,20 +76,17 @@ public:
Double_t fFitMinSigma; //pouziva se, private Double_t fFitMinSigma; //pouziva se, private
Double_t fFitPeakThreshold; //pouziva se, private, prozkoumat, k cemu vlastne slouzi ve fci ShowPeaks, popremyslet o vhodnem prednastaveni v konstruktoru Double_t fFitPeakThreshold; //pouziva se, private, prozkoumat, k cemu vlastne slouzi ve fci ShowPeaks, popremyslet o vhodnem prednastaveni v konstruktoru
//these variables are the main for the class
// Double_t fAOld[BLOCKSNUMBER][ADDRESSNUMBER]; //calibration parameter, f(x) = fAOld*x + fBOld
// Double_t fBOld[BLOCKSNUMBER][ADDRESSNUMBER]; //calibration parameter, f(x) = fAOld*x + fBOld
// Double_t fC[BLOCKSNUMBER][ADDRESSNUMBER]; //treti kalibracni parametr, jine zavislosti nez pol1
// Double_t fD[BLOCKSNUMBER][ADDRESSNUMBER]; //ctvrty kalibracni parametr
private: private:
TArrayD fA; //these variables are the main for the class
TArrayD fB; TArrayD fA; //calibration parameter, f(x) = fA*x + fB
TArrayD fB; //calibration parameter, f(x) = fA*x + fB
// TArrayD fC; // TArrayD fC;
// TArrayD fD; // TArrayD fD;
TELoss fAlphaSi;
public: public:
//smysl je velmi pochybny //it is very doubtful that we need this class variable
TFile *fCalInformation; TFile *fCalInformation;
Double_t GetA(Int_t i); //to obtain calib parameter A Double_t GetA(Int_t i); //to obtain calib parameter A
...@@ -99,8 +98,11 @@ private: ...@@ -99,8 +98,11 @@ private:
public: public:
AculCalibration(); AculCalibration();
//default constructor //default constructor
AculCalibration(const char* parfile); // AculCalibration(const char* calfile); //
virtual ~AculCalibration(); virtual ~AculCalibration();
ClassDef(AculCalibration, 1);
void Init();
Bool_t SetInputParameters(const char* inputparfile = "parforcal.par"); Bool_t SetInputParameters(const char* inputparfile = "parforcal.par");
// Function which loads text file containing parameters for calibration // Function which loads text file containing parameters for calibration
...@@ -226,17 +228,19 @@ public: ...@@ -226,17 +228,19 @@ public:
//dodelat funkce TTree* Get...(...) pro raw, anal i E spectra //dodelat funkce TTree* Get...(...) pro raw, anal i E spectra
Bool_t AddCalFileToList(const char* calfilelist = "CalFileList.log");
// Bool_t AddCalFileToList(const char* calfilelist = "CalFileList.log");
void ClearHistograms(Option_t* option = ""); void ClearHistograms(Option_t* option = "");
void DeleteStacks(Option_t* option = ""); void DeleteStacks(Option_t* option = "");
void MakeCalibrationFile(Char_t* calibrationfile, Char_t* calfilelist); // void MakeCalibrationFile(Char_t* calibrationfile, Char_t* calfilelist);
void Reset(); void Reset();
//reset calibration parameters fA, fB to zero
//private: private:
void SetELosses();
ClassDef(AculCalibration, 1);
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# AculData input with some variables # AculData input with some variables
################################################################################ ################################################################################
ACULDATALIBS := -lCore -lCint -lRIO -lTree -lNet -lThread -lHist -lMatrix -lMathCore -lGpad -lGraf -lSpectrum ACULDATALIBS := -lCore -lCint -lRIO -lTree -lNet -lThread -lHist -lMatrix -lMathCore -lGpad -lGraf -lSpectrum -lTELoss
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
ACULDATA_HEADERS += \ ACULDATA_HEADERS += \
......
{ {
gSystem->Load("/home/dariak/AculUtils/libAculData.so"); // gSystem->Load("/home/dariak/AculUtils/libAculData.so");
// gSystem->Load("/home/vratik/workspace/AculUtils/libAculData.so"); gSystem->Load("/home/vratik/workspace/AculUtils/libAculData.so");
AculCalibration cal; AculCalibration cal;
cal.SetInputParameters(); //from .par cal.SetInputParameters("../../parforcal.par"); //from .par
// cal.CalculateCalibParameters("clb08_0001.root", "SQ22", "AnalysisxTree", 100, 4095); // cal.CalculateCalibParameters("clb08_0001.root", "SQ22", "AnalysisxTree", 100, 4095);
cal.CalculateCalibParameters("clb08_0001.root", "SQ22", "AnalysisxTree", 100, 4095); cal.CalculateCalibParameters("../../clb_raw_files/clb08_0001.root", "SQ22", "AnalysisxTree", 100, 4095);
// CalculateCalibParameters(const char* inputfile, const char* block, const Int_t address, const char* treename, Int_t lowerchannel = 0, Int_t upperchannel = 4095, Int_t nEBins = 1000, Int_t lowersubaddress = 0, Int_t uppersubaddress = ADDRESSNUMBER-1); // CalculateCalibParameters(const char* inputfile, const char* block, const Int_t address, const char* treename, Int_t lowerchannel = 0, Int_t upperchannel = 4095, Int_t nEBins = 1000, Int_t lowersubaddress = 0, Int_t uppersubaddress = ADDRESSNUMBER-1);
TFile fr("SQ22[]E.root"); // TFile fr("SQ22[]E.root");
cout << fr.GetListOfKeys()->GetEntries() << " histograms" << endl; // cout << fr.GetListOfKeys()->GetEntries() << " histograms" << endl;
TList *histList = fr.GetListOfKeys(); // TList *histList = fr.GetListOfKeys();
TH1 *hWork = 0; // TH1 *hWork = 0;
for (Int_t i = 0; i < 32; i++) // for (Int_t i = 0; i < 32; i++)
{ // {
fr.GetObject(histList->At(i)->GetName(), hWork); // fr.GetObject(histList->At(i)->GetName(), hWork);
cal->PeaksFitting(hWork); // cal->PeaksFitting(hWork);
} // }
} }
...@@ -61,10 +61,10 @@ $(TELOSS)/TELossCint.cpp: ...@@ -61,10 +61,10 @@ $(TELOSS)/TELossCint.cpp:
-@echo ' ' -@echo ' '
#*.so files #*.so files
libAculData.so: $(ACULDATAOBJS) libAculData.so: libTELoss.so $(ACULDATAOBJS)
@echo 'Building target: $@' @echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker' @echo 'Invoking: GCC C++ Linker'
$(CC) -L $(ROOTLIBS) -shared -o"libAculData.so" $(ACULDATAOBJS) $(ACULDATALIBS) $(CC) -L . -L $(ROOTLIBS) -shared -o"libAculData.so" $(ACULDATAOBJS) $(ACULDATALIBS)
@echo 'Finished building target: $@' @echo 'Finished building target: $@'
@echo ' ' @echo ' '
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment