From 6e1dd9795f2c23001147a5fb9d722cb32d110161 Mon Sep 17 00:00:00 2001 From: "Kostyleva D.A" Date: Tue, 18 Oct 2016 18:37:52 +0300 Subject: [PATCH] No more blocksnumber --- AculData/AculCalibration.cpp | 23 +++----------- AculData/AculCalibration.h | 9 +++--- exp1016/calibration1.cxx | 26 ++++++++++++++++ exp1016/calibration2.cxx | 53 ++++++++++++++++++++++++++++++++ exp1016/deadlayers.cxx | 59 ++++++++++++++++++++++++++++++++++++ 5 files changed, 147 insertions(+), 23 deletions(-) create mode 100644 exp1016/calibration1.cxx create mode 100644 exp1016/calibration2.cxx create mode 100644 exp1016/deadlayers.cxx diff --git a/AculData/AculCalibration.cpp b/AculData/AculCalibration.cpp index 28f130e..5ec2d5c 100755 --- a/AculData/AculCalibration.cpp +++ b/AculData/AculCalibration.cpp @@ -428,13 +428,11 @@ Bool_t AculCalibration::SetCalibrationParameters(const char* calparfile) return kTRUE; } -void AculCalibration::PrintCalibrationParameters(const Int_t blockmin, const Int_t blockmax) +void AculCalibration::PrintCalibrationParameters() { -// for (Int_t i = blockmin; i <= blockmax; i++) { - for (Int_t j = 0; j < ADDRESSNUMBER; j++) { - cout << "C3[" << "used to be blocksnumber" << "][" << j << "]" << setw(10) << fA[j] << setw(10) << fB[j] /*<< setw(10) << fC[j] << setw(10) << fD[j]*/ << endl; - } - //} + for (Int_t j = 0; j < ADDRESSNUMBER; j++) { + cout << "C3[" << 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) @@ -673,11 +671,6 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch return 0; } - /*if ( (address > BLOCKSNUMBER) || (address < 1) ) { - Error("CalculateCalibParameters", "Possible address values have to be in range 1 - %d", BLOCKSNUMBER - 1); - return kFALSE; - }*/ - //muzu nechat if ( (uppersubaddress - lowersubaddress) >= ADDRESSNUMBER ) { Error("CalculateCalibParameters", "Possible subaddress values have to be in range 0 - %d", ADDRESSNUMBER - 1); @@ -1354,12 +1347,11 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi } //asi fce Reset() - //for (Int_t i = 0; i < BLOCKSNUMBER; i++) { + for (Int_t j = 0; j < ADDRESSNUMBER; j++) { fA[j] = 0; fB[j] = 0; } - //} const Int_t lineLength = 100; char line[lineLength]; @@ -1405,12 +1397,10 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi return; } - //for (Int_t i = 0; i < BLOCKSNUMBER; i++) { for (Int_t j = 0; j < ADDRESSNUMBER; j++) { if (fA[j] != 0) { CalibFileW << std::right << setw(2) << "3" - /*<< setw(4) << i*/ << setw(4) << j << setw(12) << fA[j] << setw(12) << fB[j] @@ -1418,7 +1408,6 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi << endl; } } - //} CalibFileW.close(); @@ -1442,7 +1431,6 @@ void AculCalibration::Reset() { //reset calibration parameters fAOld, fBOld, fC, fD to zero - //for (Int_t i = 0; i < BLOCKSNUMBER; i++) { for (Int_t j = 0; j < ADDRESSNUMBER; j++) { fA[j] = 0; fB[j] = 0; @@ -1450,7 +1438,6 @@ void AculCalibration::Reset() // fD[0][j] = 0.; // fMeanSigma[i][j] = 0; } - //} return; } diff --git a/AculData/AculCalibration.h b/AculData/AculCalibration.h index 159975b..0d11369 100755 --- a/AculData/AculCalibration.h +++ b/AculData/AculCalibration.h @@ -23,7 +23,6 @@ #include #define DEFAULTNOPEAKS 20 -#define BLOCKSNUMBER 100 #define ADDRESSNUMBER 32 using std::cout; @@ -139,11 +138,11 @@ public: void PrintInputParameters(); //I hope this is selfunderstanding function - void PrintCalibrationParameters(const Int_t blockmin = 1, const Int_t blockmax = BLOCKSNUMBER - 1); - //Print calibration parameters fAOld, fBOld, fC, fD which are currently saved in object AculCalibration + void PrintCalibrationParameters(); + //Print calibration parameters fA, fB which are currently saved in object AculCalibration // - // blockmin: minimum block data are displayed for - // blockmax: maximum block data are displayed for + // + // Bool_t CalculateCalibParameters(const char* inputfile, const char* block, const char* treename, Int_t lowerchannel = 0, diff --git a/exp1016/calibration1.cxx b/exp1016/calibration1.cxx new file mode 100644 index 0000000..b891b26 --- /dev/null +++ b/exp1016/calibration1.cxx @@ -0,0 +1,26 @@ +void calibration1() +{ + gSystem->Load("/home/dariak/AculUtils/libAculData.so"); +// gSystem->Load("/home/vratik/workspace/AculUtils/libAculData.so"); + + AculCalibration cal; + cal.SetInputParameters("/home/dariak/AculUtils/parforcal.par"); //from .par + cal.PrintInputParameters(); + cal.CalculateCalibParameters("/home/dariak/AculUtils/exp1016/clb_raw_files/sq22/clb07_0001.root", "SQ22", "AnalysisxTree", 100, 1500); + +// CalculateCalibParameters(const char* inputfile, const char* block, const char* treename, Int_t lowerchannel = 0, Int_t upperchannel = 4095, Int_t nEBins = 1000, Int_t lowersubaddress = 0, Int_t uppersubaddress = ADDRESSNUMBER-1); + + cal.PrintCalibrationParameters(); + TFile fr("/home/dariak/AculUtils/exp1016/SQ22[]E.root"); + cout << fr.GetListOfKeys()->GetEntries() << " histograms" << endl; + TCanvas *c2 = new TCanvas(); + cal.FindEnergyPeaks(c2,"SQ22[]E.root","outputenergrun07.txt"); + +/* TList *histList = fr.GetListOfKeys(); + TH1 *hWork = 0; + for (Int_t i = 0; i < 32; i++) + { + fr.GetObject(histList->At(i)->GetName(), hWork); + cal->PeaksFitting(hWork); + }*/ +} diff --git a/exp1016/calibration2.cxx b/exp1016/calibration2.cxx new file mode 100644 index 0000000..0136a89 --- /dev/null +++ b/exp1016/calibration2.cxx @@ -0,0 +1,53 @@ +void calibration2() +{ + gSystem->Load("/home/dariak/AculUtils/libAculData.so"); + + AculCalibration cal; + cal.SetInputParameters("/home/dariak/AculUtils/parforcal.par"); //takes !only! a number of peaks from .par + + cal.SetCalibrationParameters("/home/dariak/AculUtils/SQ22[].cal"); //takes calibration parameters + cal.PrintCalibrationParameters(); + + TCanvas *c2 = new TCanvas(); + cal.CalibrateRawSpectra("/home/dariak/AculUtils/exp1016/clb_raw_files/sq22/clb09_0001.root", "SQ22", "AnalysisxTree", 100, 1500, 500); //takes data from raw file and calibrates it with obtained calibration parameters, void CalibrateRawSpectra(const char* inputfile, const char* block, 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("/home/dariak/AculUtils/SQ22[]E.root"); + cout << fr.GetListOfKeys()->GetEntries() << " histograms" << endl; + cal.FindEnergyPeaks(c2,"SQ22[]E.root","outputenergrun09.txt"); + +/* TList *histList = fr.GetListOfKeys(); + TH1 *hWork = 0; + c1->Clear(); + c1->Divide(6, 6); + + for (Int_t i = 0; i < 32; i++) + { + fr.GetObject(histList->At(i)->GetName(), hWork); + c1->cd(i+1); + cal->PeaksFitting(hWork); + hWork->Draw(); + } +/* c1->Divide(2, 2); + + c1->cd(1); + fr.GetObject(histList->At(7)->GetName(), hWork); + cal->PeaksFitting(hWork); + hWork->Draw(); + + fr.GetObject(histList->At(8)->GetName(), hWork); + c1->cd(2); + cal->PeaksFitting(hWork); + hWork->Draw(); + + fr.GetObject(histList->At(23)->GetName(), hWork); + c1->cd(3); + cal->PeaksFitting(hWork); + hWork->Draw(); + + fr.GetObject(histList->At(24)->GetName(), hWork); + c1->cd(4); + cal->PeaksFitting(hWork); + hWork->Draw(); + */ + +} diff --git a/exp1016/deadlayers.cxx b/exp1016/deadlayers.cxx new file mode 100644 index 0000000..51d259e --- /dev/null +++ b/exp1016/deadlayers.cxx @@ -0,0 +1,59 @@ +{ + gSystem->Load("/home/dariak/AculUtils/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.78827875,4.626188125); //(doule E0, double E in MeV) calculates layer in mcm for averages + Double_t deltaL2 = mSi.GetR(5.501093125,5.3578121875); + Double_t deltaL3 = mSi.GetR(6.0182040625,5.88149375); + Double_t deltaL4 = mSi.GetR(7.69191375,7.5725915625); + + 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: " <