Commit 28706779 authored by Kostyleva D.A's avatar Kostyleva D.A

Got rid of BLOCKSNUMBER

parent 21729c50
...@@ -23,6 +23,8 @@ AculCalibration::AculCalibration() : fA(0), fB(0) ...@@ -23,6 +23,8 @@ AculCalibration::AculCalibration() : fA(0), fB(0)
fCurrentHStack = NULL; fCurrentHStack = NULL;
fCurrentHistList.IsOwner(); fCurrentHistList.IsOwner();
fA.Set(32);
fB.Set(32);
kRaNOPEAKS = 0; kRaNOPEAKS = 0;
fLowerPeakRelativeHight = 0.; fLowerPeakRelativeHight = 0.;
...@@ -147,11 +149,6 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s ...@@ -147,11 +149,6 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s
//creation of output text file with positions of peaks in MeV //creation of output text file with positions of peaks in MeV
TString workFile; TString workFile;
//if ( (lowersubaddress == 0) && (uppersubaddress == ADDRESSNUMBER-1) ) { oFileName.Form("%s[].cal", block); }
//else {
//if (lowersubaddress == uppersubaddress) { oFileName.Form("%s[%d].cal", block, lowersubaddress); }
//else { oFileName.Form("%s[%d-%d].cal", block, lowersubaddress, uppersubaddress); }
//}
workFile.Form("energies.txt"); workFile.Form("energies.txt");
ofstream outenergfile; ofstream outenergfile;
...@@ -257,8 +254,6 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s ...@@ -257,8 +254,6 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s
} }
} }
outenergfile << hSpectrum->GetName() <<"\t"<< fPeak[0] <<"\t"<< fPeak[1] <<"\t"<< fPeak[2] <<"\t"<< fPeak[3] <<endl;
// provest kontrolu pomerne polohy piku, // provest kontrolu pomerne polohy piku,
// jestli jsou spatne, provest urcita opatreni, // jestli jsou spatne, provest urcita opatreni,
// napr. zapis daneho histogramu do souboru, // napr. zapis daneho histogramu do souboru,
...@@ -273,6 +268,7 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s ...@@ -273,6 +268,7 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s
} }
}//for }//for
outenergfile << hSpectrum->GetName()<<"\t"<< fPeak[0] <<"\t"<< fPeak[1] <<"\t"<< fPeak[2] <<"\t"<< fPeak[3] <<endl;
outenergfile.close(); outenergfile.close();
return 0; return 0;
} }
...@@ -386,6 +382,27 @@ void AculCalibration::PrintInputParameters() ...@@ -386,6 +382,27 @@ void AculCalibration::PrintInputParameters()
} }
Double_t AculCalibration::GetA(Int_t i)
{
if (i >= fA.GetSize()) //if i >= number of array element
{
return 0.;
}
return fA[i];
}
Double_t AculCalibration::GetB(Int_t i)
{
if (i >= fB.GetSize())
{
return 0.;
}
return fB[i];
}
Bool_t AculCalibration::SetCalibrationParameters(const char* calparfile) Bool_t AculCalibration::SetCalibrationParameters(const char* calparfile)
{ {
...@@ -412,11 +429,11 @@ Bool_t AculCalibration::SetCalibrationParameters(const char* calparfile) ...@@ -412,11 +429,11 @@ Bool_t AculCalibration::SetCalibrationParameters(const char* calparfile)
while (!calFileR.eof()) { while (!calFileR.eof()) {
calFileR.getline(line, lineLength); calFileR.getline(line, lineLength);
if ( line[0] != '*' && line[0] != '#' && line[0] != '%' && (line[0] != '/' && line[1] != '/') ) { //possible comment characters if ( line[0] != '*' && line[0] != '#' && line[0] != '%' && (line[0] != '/' && line[1] != '/') ) { //possible comment characters
sscanf(line, "%s %d %d %s %s %s %s", crate, &i, &j, cA, cB, cC, cD); sscanf(line, "%s %d %s %s %s %s", crate, /*&i*,*/ &j, cA, cB, cC, cD); //
fAOld[i][j] = atof(cA); fA[j] = atof(cA);
fBOld[i][j] = atof(cB); fB[j] = atof(cB);
fC[i][j] = atof(cC); fC[0][j] = atof(cC);
fD[i][j] = atof(cD); fD[0][j] = atof(cD);
} }
} }
...@@ -426,11 +443,11 @@ Bool_t AculCalibration::SetCalibrationParameters(const char* calparfile) ...@@ -426,11 +443,11 @@ Bool_t AculCalibration::SetCalibrationParameters(const char* calparfile)
void AculCalibration::PrintCalibrationParameters(const Int_t blockmin, const Int_t blockmax) void AculCalibration::PrintCalibrationParameters(const Int_t blockmin, const Int_t blockmax)
{ {
for (Int_t i = blockmin; i <= blockmax; i++) { // for (Int_t i = blockmin; i <= blockmax; i++) {
for (Int_t j = 0; j < ADDRESSNUMBER; j++) { for (Int_t j = 0; j < ADDRESSNUMBER; j++) {
cout << "C3[" << i << "][" << j << "]" << setw(10) << fAOld[i][j] << setw(10) << fBOld[i][j] << setw(10) << fC[i][j] << setw(10) << fD[i][j] << endl; cout << "C3[" << "used to be blocksnumber" << "][" << j << "]" << setw(10) << fA[j] << setw(10) << fB[j] << setw(10) << fC[j] << setw(10) << fD[j] << endl;
}
} }
//}
} }
void AculCalibration::ShowRawSpectra(const char* filename, const Int_t block, TCanvas* rawCanvas, Int_t xaxismin, Int_t xaxismax, /*TObjArray* histList,*/ const Int_t subaddress) void AculCalibration::ShowRawSpectra(const char* filename, const Int_t block, TCanvas* rawCanvas, Int_t xaxismin, Int_t xaxismax, /*TObjArray* histList,*/ const Int_t subaddress)
...@@ -660,7 +677,7 @@ void AculCalibration::FillRawSpectraFile(const char* rawdatafile, const char* bl ...@@ -660,7 +677,7 @@ void AculCalibration::FillRawSpectraFile(const char* rawdatafile, const char* bl
return; return;
} }
Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const char* block, const Int_t address, Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const char* block, /*const Int_t address,*/
const char* treename, Int_t lowerchannel, Int_t upperchannel, Int_t nEBins, Int_t lowersubaddress, const char* treename, Int_t lowerchannel, Int_t upperchannel, Int_t nEBins, Int_t lowersubaddress,
Int_t uppersubaddress) Int_t uppersubaddress)
{ {
...@@ -669,10 +686,10 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch ...@@ -669,10 +686,10 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch
return 0; return 0;
} }
if ( (address > BLOCKSNUMBER) || (address < 1) ) { /*if ( (address > BLOCKSNUMBER) || (address < 1) ) {
Error("CalculateCalibParameters", "Possible address values have to be in range 1 - %d", BLOCKSNUMBER - 1); Error("CalculateCalibParameters", "Possible address values have to be in range 1 - %d", BLOCKSNUMBER - 1);
return kFALSE; return kFALSE;
} }*/
//muzu nechat //muzu nechat
if ( (uppersubaddress - lowersubaddress) >= ADDRESSNUMBER ) { if ( (uppersubaddress - lowersubaddress) >= ADDRESSNUMBER ) {
...@@ -799,14 +816,14 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch ...@@ -799,14 +816,14 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch
calGraph->Fit(calFunction, "Q", "goff", 0, 4096); //omezit hlasitost fitovani, udelat volitelne, dodelat volby rozsahu calGraph->Fit(calFunction, "Q", "goff", 0, 4096); //omezit hlasitost fitovani, udelat volitelne, dodelat volby rozsahu
outcalfile outcalfile
<< block << "\t" << block << "\t"
<< address << "\t" /*<< address << "\t"*/
<< i << "\t" << i << "\t"
<< setprecision(4) << calFunction->GetParameter(1) << "\t" << setprecision(4) << calFunction->GetParameter(1) << "\t"
<< setprecision(4) << calFunction->GetParameter(0) << "\t\t" << setprecision(4) << calFunction->GetParameter(0) << "\t\t"
<< fitControl << fitControl
<< endl; << endl;
fAOld[address][i] = calFunction->GetParameter(1); fA[i] = calFunction->GetParameter(1);
fBOld[address][i] = calFunction->GetParameter(0); fB[i] = calFunction->GetParameter(0);
//calibration of raw spectra using obtained parameters //calibration of raw spectra using obtained parameters
...@@ -821,7 +838,7 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch ...@@ -821,7 +838,7 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch
Int_t binCont = (Int_t)hRaw->GetBinContent(j); Int_t binCont = (Int_t)hRaw->GetBinContent(j);
// cout << j << ":\t" << hRaw->GetBinContent(j) << endl; // cout << j << ":\t" << hRaw->GetBinContent(j) << endl;
for (Int_t k = 0; k < binCont; k++) { for (Int_t k = 0; k < binCont; k++) {
hEnergy->Fill( fAOld[address][i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fBOld[address][i] ); hEnergy->Fill( fA[i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fB[i] );
// cout << j << ":\t" << fAOld[address][i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fBOld[address][i] << endl; // cout << j << ":\t" << fAOld[address][i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fBOld[address][i] << endl;
// cout << j << ":\t" << fAOld[address][i] << endl; // cout << j << ":\t" << fAOld[address][i] << endl;
} }
...@@ -847,7 +864,7 @@ void AculCalibration::CalibrateRawSpectra() { ...@@ -847,7 +864,7 @@ void AculCalibration::CalibrateRawSpectra() {
const char* iFileName = "clb01_0001.root"; const char* iFileName = "clb01_0001.root";
const char* treeName = "AnalysisxTree"; const char* treeName = "AnalysisxTree";
const char* branchName = "LiEvent.SQ22[32]"; const char* branchName = "LiEvent.SQ22[32]";
const Int_t address = 22; //const Int_t address = 22;
const Int_t lowerElement = 0; const Int_t lowerElement = 0;
const Int_t upperElement = 32; const Int_t upperElement = 32;
const Int_t lowerChannel = 100, upperChannel = 4096; const Int_t lowerChannel = 100, upperChannel = 4096;
...@@ -924,7 +941,7 @@ void AculCalibration::CalibrateRawSpectra() { ...@@ -924,7 +941,7 @@ void AculCalibration::CalibrateRawSpectra() {
// hEnergy->SetName(histName.Data()); // hEnergy->SetName(histName.Data());
if (variable[i] > lowerChannel && variable[i] < upperChannel) { if (variable[i] > lowerChannel && variable[i] < upperChannel) {
hEnergy[i-lowerElement]->Fill( fAOld[address][i]*( variable[i]+ranGen.Uniform(-0.5, 0.5) ) + fBOld[address][i] ); hEnergy[i-lowerElement]->Fill( fA[i]*( variable[i]+ranGen.Uniform(-0.5, 0.5) ) + fB[i] );
} }
...@@ -960,7 +977,7 @@ void AculCalibration::CalibrateRawSpectra() { ...@@ -960,7 +977,7 @@ void AculCalibration::CalibrateRawSpectra() {
return; return;
} }
void AculCalibration::CalibrateRawSpectra(const char* inputfile, const char* block, const Int_t address, void AculCalibration::CalibrateRawSpectra(const char* inputfile, const char* block, /*const Int_t address,*/
const char* treename, Int_t lowerchannel, Int_t upperchannel, const char* treename, Int_t lowerchannel, Int_t upperchannel,
Int_t nEBins, Int_t lowersubaddress, Int_t uppersubaddress) { Int_t nEBins, Int_t lowersubaddress, Int_t uppersubaddress) {
...@@ -1070,7 +1087,7 @@ void AculCalibration::CalibrateRawSpectra(const char* inputfile, const char* blo ...@@ -1070,7 +1087,7 @@ void AculCalibration::CalibrateRawSpectra(const char* inputfile, const char* blo
Int_t binCont = (Int_t)hRaw->GetBinContent(j); Int_t binCont = (Int_t)hRaw->GetBinContent(j);
// cout << j << ":\t" << hRaw->GetBinContent(j) << endl; // cout << j << ":\t" << hRaw->GetBinContent(j) << endl;
for (Int_t k = 0; k < binCont; k++) { for (Int_t k = 0; k < binCont; k++) {
hEnergy->Fill( fAOld[address][i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fBOld[address][i] ); hEnergy->Fill( fA[i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fB[i] );
// cout << j << ":\t" << fAOld[address][i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fBOld[address][i] << endl; // cout << j << ":\t" << fAOld[address][i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fBOld[address][i] << endl;
// cout << j << ":\t" << fAOld[address][i] << endl; // cout << j << ":\t" << fAOld[address][i] << endl;
} }
...@@ -1313,18 +1330,18 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi ...@@ -1313,18 +1330,18 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi
} }
//asi fce Reset() //asi fce Reset()
for (Int_t i = 0; i < BLOCKSNUMBER; i++) { //for (Int_t i = 0; i < BLOCKSNUMBER; i++) {
for (Int_t j = 0; j < ADDRESSNUMBER; j++) { for (Int_t j = 0; j < ADDRESSNUMBER; j++) {
fAOld[i][j] = 0; fA[j] = 0;
fBOld[i][j] = 0; fB[j] = 0;
}
} }
//}
const Int_t lineLength = 100; const Int_t lineLength = 100;
char line[lineLength]; char line[lineLength];
char filename[50]; char filename[50];
// ifstream calFileR; // ifstream calFileR;
Int_t crate, i, j, id; Int_t crate, /*i,*/ j, id;
// int crate, i, j, id; // int crate, i, j, id;
char cA[40], cB[40], cSigma[40]; char cA[40], cB[40], cSigma[40];
...@@ -1341,13 +1358,13 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi ...@@ -1341,13 +1358,13 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi
while (!calFileR.eof()) { while (!calFileR.eof()) {
// cout << " in inner while" << endl; // cout << " in inner while" << endl;
calFileR.getline(line, lineLength); calFileR.getline(line, lineLength);
sscanf(line, "%d %d %d %s %s %d %s", &crate, &i, &j, cA, cB, &id, cSigma); sscanf(line, "%d %d %s %s %d %s", &crate, /*&i,*/ &j, cA, cB, &id, cSigma);
// cout << line << endl; // cout << line << endl;
if (id == 0) { if (id == 0) {
fAOld[i][j] = static_cast<Double_t>(atof(cA)); fA[j] = static_cast<Double_t>(atof(cA));
fBOld[i][j] = static_cast<Double_t>(atof(cB)); fB[j] = static_cast<Double_t>(atof(cB));
// fMeanSigma[i][j] = static_cast<Double_t>(atof(cSigma)); // fMeanSigma[i][j] = static_cast<Double_t>(atof(cSigma));
cout << fAOld[i][j] << "\t" << fBOld[i][j] << endl; cout << fA[j] << "\t" << fB[j] << endl;
}//if }//if
}//while }//while
calFileR.close(); calFileR.close();
...@@ -1364,20 +1381,20 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi ...@@ -1364,20 +1381,20 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi
return; return;
} }
for (Int_t i = 0; i < BLOCKSNUMBER; i++) { //for (Int_t i = 0; i < BLOCKSNUMBER; i++) {
for (Int_t j = 0; j < ADDRESSNUMBER; j++) { for (Int_t j = 0; j < ADDRESSNUMBER; j++) {
if (fAOld[i][j] != 0) { if (fA[j] != 0) {
CalibFileW << std::right CalibFileW << std::right
<< setw(2) << "3" << setw(2) << "3"
<< setw(4) << i /*<< setw(4) << i*/
<< setw(4) << j << setw(4) << j
<< setw(12) << fAOld[i][j] << setw(12) << fA[j]
<< setw(12) << fBOld[i][j] << setw(12) << fB[j]
// << setw(10) << fMeanSigma[i][j] // << setw(10) << fMeanSigma[i][j]
<< endl; << endl;
} }
} }
} //}
CalibFileW.close(); CalibFileW.close();
...@@ -1401,15 +1418,15 @@ void AculCalibration::Reset() ...@@ -1401,15 +1418,15 @@ void AculCalibration::Reset()
{ {
//reset calibration parameters fAOld, fBOld, fC, fD to zero //reset calibration parameters fAOld, fBOld, fC, fD to zero
for (Int_t i = 0; i < BLOCKSNUMBER; i++) { //for (Int_t i = 0; i < BLOCKSNUMBER; i++) {
for (Int_t j = 0; j < ADDRESSNUMBER; j++) { for (Int_t j = 0; j < ADDRESSNUMBER; j++) {
fAOld[i][j] = 0; fA[j] = 0;
fBOld[i][j] = 0; fB[j] = 0;
fC[i][j] = 0; fC[0][j] = 0.;
fD[i][j] = 0; fD[0][j] = 0.;
// fMeanSigma[i][j] = 0; // fMeanSigma[i][j] = 0;
} }
} //}
return; return;
} }
...@@ -76,20 +76,24 @@ public: ...@@ -76,20 +76,24 @@ public:
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 //these variables are the main for the class
Double_t fAOld[BLOCKSNUMBER][ADDRESSNUMBER]; //calibration parameter, f(x) = fAOld*x + fBOld // 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 fBOld[BLOCKSNUMBER][ADDRESSNUMBER]; //calibration parameter, f(x) = fAOld*x + fBOld
Double_t fC[BLOCKSNUMBER][ADDRESSNUMBER]; //treti kalibracni parametr, jine zavislosti nez pol1 Double_t fC[BLOCKSNUMBER][ADDRESSNUMBER]; //treti kalibracni parametr, jine zavislosti nez pol1
Double_t fD[BLOCKSNUMBER][ADDRESSNUMBER]; //ctvrty kalibracni parametr Double_t fD[BLOCKSNUMBER][ADDRESSNUMBER]; //ctvrty kalibracni parametr
private:
TArrayD fA; TArrayD fA;
TArrayD fB; TArrayD fB;
// TArrayD fC;
// TArrayD fD;
public:
//smysl je velmi pochybny //smysl je velmi pochybny
TFile *fCalInformation; TFile *fCalInformation;
Double_t GetA(Int_t i); //to obtain calib parameter A
Double_t GetB(Int_t i); //to obtain calib parameter B
//private: //private:
Double_t fPeak[DEFAULTNOPEAKS]; //v teto promenne je ulozena momentalni hodnota piku v kanalech, zejmena v jedne fci, mozno udelat ji jako lokalni, bude navratovou hodnotou fce PeaksFitting, predelat delku pole Double_t fPeak[DEFAULTNOPEAKS]; //v teto promenne je ulozena momentalni hodnota piku v kanalech, zejmena v jedne fci, mozno udelat ji jako lokalni, bude navratovou hodnotou fce PeaksFitting, predelat delku pole
...@@ -142,9 +146,10 @@ public: ...@@ -142,9 +146,10 @@ public:
// blockmax: maximum block data are displayed for // blockmax: maximum block data are displayed for
Bool_t CalculateCalibParameters(const char* inputfile, const char* block, Bool_t CalculateCalibParameters(const char* inputfile, const char* block,
const Int_t address, const char* treename, Int_t lowerchannel = 0, /*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 upperchannel = 4095, Int_t nEBins = 1000, Int_t lowersubaddress = 0,
Int_t uppersubaddress = ADDRESSNUMBER-1); //calculate calibration parameters for given block in given file Int_t uppersubaddress = ADDRESSNUMBER-1); //calculate calibration parameters for given block in given file
//function is not completely ready to use //function is not completely ready to use
// //
//function for calculation of calibrate parameters for DAQ system based on "Go4" //function for calculation of calibrate parameters for DAQ system based on "Go4"
...@@ -173,7 +178,7 @@ public: ...@@ -173,7 +178,7 @@ public:
void CalibrateRawSpectra(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); void CalibrateRawSpectra(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);
// Bool_t EnergyPositions(const char* inputfile, const char* block, // Bool_t EnergyPositions(const char* inputfile, const char* block,
// const Int_t address, const Int_t address, const char* treename, Int_t lowerchannel = 0, // const Int_t address, const Int_t address, const char* treename, Int_t lowerchannel = 0,
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
AculCalibration cal; AculCalibration cal;
cal.SetInputParameters(); //from .par cal.SetInputParameters(); //from .par
cal.CalculateCalibParameters("clb08_0001.root", "SQ22", 22, "AnalysisxTree", 100, 4095); cal.CalculateCalibParameters("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");
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
AculCalibration cal; AculCalibration cal;
cal->SetInputParameters(); cal->SetInputParameters();
cal->SetCalibrationParameters("./run8/SQ22[].cal"); //takes calibration parameters cal->SetCalibrationParameters("SQ22[].cal"); //takes calibration parameters
cal->PrintCalibrationParameters(22, 22); cal->PrintCalibrationParameters(22, 22);
TCanvas *c1 = new TCanvas(); TCanvas *c1 = new TCanvas();
cal->CalibrateRawSpectra("clb09_0001.root", "SQ22", 22, "AnalysisxTree", 100, 800, 500); //takes data from raw file and calibrates it with obtained calibration parameters cal->CalibrateRawSpectra("clb09_0001.root", "SQ22", "AnalysisxTree", 100, 800, 500); //takes data from raw file and calibrates it with obtained calibration parameters
TFile fr("SQ22[]E.root"); TFile fr("SQ22[]E.root");
cout << fr.GetListOfKeys()->GetEntries() << " histograms" << endl; cout << fr.GetListOfKeys()->GetEntries() << " histograms" << endl;
......
{
gSystem->Load("../libTELoss.so");
TELoss mSi;
//set parameters for Si and alpha
mSi.SetEL(1, 2.321); // density in g/cm3
mSi.AddEL(14., 28.086, 1); //Z, mass
// mSi.SetZP(1., 1.); //protons
mSi.SetZP(2., 4.); //alphas, Z, A
mSi.SetEtab(100000, 200.); // ?, MeV calculate ranges
mSi.SetDeltaEtab(300); // calculate delta E
// TCanvas *c1 = new TCanvas("name", "title which can consist more than one word.", 617, 0, 1058, 972);
// cout << mSi.GetE(50, 1000) << endl; //(input energy E0 in MeV, microns)
// cout << mSi.GetE0(9.04, 1000) << endl; //(output energy E in MeV, microns)
//calculated energies for run1 - run3
/*
Double_t deltaL1 = mSi.GetR(4.789, 4.623); //(doule E0, double E in MeV) calculates layer in mcm for averages
Double_t deltaL2 = mSi.GetR(5.5,5.355);
Double_t deltaL3 = mSi.GetR(6.017,5.880);
Double_t deltaL4 = mSi.GetR(7.693, 7.577);
*/
//calculated energies for run4 - run5
/*
Double_t deltaL1 = mSi.GetR(4.782,4.613); //(doule E0, double E in MeV) calculates layer in mcm for averages
Double_t deltaL2 = mSi.GetR(5.503,5.348);
Double_t deltaL3 = mSi.GetR(6.016,5.875);
Double_t deltaL4 = mSi.GetR(7.692,7.571);
*/
//calculated energies for run6 - run7
/*
Double_t deltaL1 = mSi.GetR(4.788,4.675); //(doule E0, double E in MeV) calculates layer in mcm for averages
Double_t deltaL2 = mSi.GetR(5.502,5.340);
Double_t deltaL3 = mSi.GetR(6.017,5.923);
Double_t deltaL4 = mSi.GetR(7.693,7.612);
*/
//calculated energies for run8 - run9
Double_t deltaL1 = mSi.GetR(4.787,4.648); //(doule E0, double E in MeV) calculates layer in mcm for averages
Double_t deltaL2 = mSi.GetR(5.501,5.380);
Double_t deltaL3 = mSi.GetR(6.018,5.903);
Double_t deltaL4 = mSi.GetR(7.692,7.594);
cout << deltaL1 << " mcm" << endl; //MeV, microns - delta layer
cout << deltaL2 << " mcm" << endl;
cout << deltaL3 << " mcm" << endl;
cout << deltaL4 << " mcm" << endl << endl;
cout << "dead layer 1 is: " << deltaL1/(TMath::Sqrt(2) - 1) << " mcm" << endl; //MeV, microns
cout << "dead layer 2 is: " <<deltaL2/(TMath::Sqrt(2) - 1) << " mcm" << endl; //MeV, microns
cout << "dead layer 3 is: " <<deltaL3/(TMath::Sqrt(2) - 1) << " mcm" << endl; //MeV, microns
cout << "dead layer 4 is: " <<deltaL4/(TMath::Sqrt(2) - 1) << " mcm" << endl << endl; //MeV, microns
cout << "Back dead layer for detector 1-11 is : " << ( deltaL1/(TMath::Sqrt(2) - 1) + deltaL2/(TMath::Sqrt(2) - 1)+ deltaL3/(TMath::Sqrt(2) - 1) + deltaL4/(TMath::Sqrt(2) - 1) )/4. << " mcm" << endl; //dead layer width
}
This diff is collapsed.
adadsasdASDADadasd
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