Commit fa30d6f2 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Parameters for scintillator have been sligthly optimized.

parent 8bd7b5f0
...@@ -12,15 +12,11 @@ ...@@ -12,15 +12,11 @@
#include <fstream> #include <fstream>
#include <vector> #include <vector>
//#include "TObject.h"
#include "TString.h" #include "TString.h"
#include "TArrayD.h" #include "TArrayD.h"
#include "TArrayI.h" #include "TArrayI.h"
#include "TCutG.h" #include "TCutG.h"
//todo ommit this constant
#define NOCALFILES 5
using std::cout; using std::cout;
using std::endl; using std::endl;
using std::vector; using std::vector;
...@@ -31,6 +27,9 @@ protected: ...@@ -31,6 +27,9 @@ protected:
//general //general
TString fParFileName; TString fParFileName;
//todo energies used for calibration should be in this class
//CsI parameters //CsI parameters
// Int_t fNoCrystals; // Int_t fNoCrystals;
// //
...@@ -63,14 +62,12 @@ public: ...@@ -63,14 +62,12 @@ public:
virtual const char* GetParticleName() {return 0;} virtual const char* GetParticleName() {return 0;}
virtual Int_t GetNoRawFiles() {return 0;}; virtual Int_t GetNoRawFiles() {return 0;};
virtual const char* GetFileName(Int_t i) {return 0;}; virtual const char* GetFileName(Int_t i) {return 0;};
// const char* GetCutName(Int_t i);
virtual Int_t GetNoEPoints() {return 0;} virtual Int_t GetNoEPoints() {return 0;}
virtual Double_t GetCalEnergy(Int_t i) {return 0.;}; virtual Double_t GetCalEnergy(Int_t i) {return 0.;};
virtual const char* GetCutsFileName() {return 0;} virtual const char* GetCutsFileName() {return 0;}
virtual Int_t GetNoCuts() {return 0;} virtual Int_t GetNoCuts() {return 0;}
virtual TCutG* GetCut(Int_t i) {return 0;}; virtual TCutG* GetCut(Int_t i) {return 0;};
virtual TCutG* GetCut(const char* cutName) {return 0;}; virtual TCutG* GetCut(const char* cutName) {return 0;};
// virtual TCutG* GetCutName(Int_t i) {return 0;};
virtual Int_t GetMinChannel(Int_t energy, Int_t crystal) {return 0;}; virtual Int_t GetMinChannel(Int_t energy, Int_t crystal) {return 0;};
virtual Int_t GetMaxChannel(Int_t energy, Int_t crystal) {return 0;}; virtual Int_t GetMaxChannel(Int_t energy, Int_t crystal) {return 0;};
......
...@@ -72,11 +72,14 @@ void AculCalParsScint::SetPars() { ...@@ -72,11 +72,14 @@ void AculCalParsScint::SetPars() {
if ( line.BeginsWith("files") ) { if ( line.BeginsWith("files") ) {
sscanf(line.Data(), "%*s %d", &i); sscanf(line.Data(), "%*s %d", &i);
fNoFiles = i; fNoFiles = i;
fFilePars.resize(fNoFiles);
for (Int_t j = 0; j < fNoFiles; j++) { for (Int_t j = 0; j < fNoFiles; j++) {
line.ReadLine(infile); line.ReadLine(infile);
sscanf(line, "%s", fname); sscanf(line, "%s", fname);
word = fname; word = fname;
fFileName.push_back(fname); fFilePars[j].SetRawFileName(fname);
fFilePars[j].SetNoCrystals(fNoCrystals);
fFilePars[j].Init();
} }
continue; continue;
} }
...@@ -101,17 +104,16 @@ void AculCalParsScint::SetPars() { ...@@ -101,17 +104,16 @@ void AculCalParsScint::SetPars() {
if ( line.BeginsWith("energy") ) { if ( line.BeginsWith("energy") ) {
sscanf(line.Data(), "%*s %lf", &en); sscanf(line.Data(), "%*s %lf", &en);
fE.push_back(en); fFilePars[fEnergyPoints].SetEnergy(en);
fEnergyPoints++; fEnergyPoints++;
vector<Int_t> newM;
fPeakMin.push_back(newM);
fPeakMax.push_back(newM);
continue; continue;
} }
sscanf(line.Data(), "%d %d %d", &i, &min, &max); sscanf(line.Data(), "%d %d %d", &i, &min, &max);
fPeakMin.at(fEnergyPoints-1).push_back(min); fFilePars.at(fEnergyPoints-1).SetPeakMin(i, min);
fPeakMax.at(fEnergyPoints-1).push_back(max); fFilePars.at(fEnergyPoints-1).SetPeakMax(i, max);
}//while }//while
infile.close(); infile.close();
...@@ -124,24 +126,20 @@ void AculCalParsScint::PrintParameters(const char* option) { ...@@ -124,24 +126,20 @@ void AculCalParsScint::PrintParameters(const char* option) {
cout << "Parameters read from file \"" << fParFileName.Data() << "\"." << endl; cout << "Parameters read from file \"" << fParFileName.Data() << "\"." << endl;
cout << "\tCalibration of detector \"" << fDetName << "\" with " << fNoCrystals << " crystals." << endl; cout << "\tCalibration of detector \"" << fDetName << "\" with " << fNoCrystals << " crystals." << endl;
// cout << "\tNumber of crystals: " << fNoCrystals << endl;
cout << "\tParticle: " << fPartName << endl; cout << "\tParticle: " << fPartName << endl;
cout << "\tInput files with raw data (" << fNoFiles << "):" << endl; cout << "\tInput files with raw data (" << fNoFiles << "):" << endl;
for (Int_t i = 0; i < (Int_t)fFileName.size(); i++) { for (Int_t i = 0; i < (Int_t)fFilePars.size(); i++) {
// cout << i << endl; cout << "\t " << GetFileName(i) << endl;
cout << "\t " << fFileName[i] << endl;
} }
cout << "\tInput energies (" << fNoFiles << "):" << endl; cout << "\tInput energies (" << fNoFiles << "):" << endl;
for (Int_t i = 0; i < (Int_t)fE.size(); i++) { for (Int_t i = 0; i <= (Int_t)fFilePars.size(); i++) {
// cout << i << endl; cout << "\t " << fFilePars[i].GetEnergy() << " MeV" << endl;
cout << "\t " << fE[i] << " MeV" << endl;
} }
cout << "\tInput file with " << fNoCuts << " cuts: \"" << fCutsFileName << "\"" << endl; cout << "\tInput file with " << fNoCuts << " cuts: \"" << fCutsFileName << "\"" << endl;
if (opt.Contains("all")) { if (opt.Contains("all")) {
for (Int_t i = 0; i < (Int_t)fCutName.size(); i++) { for (Int_t i = 0; i < (Int_t)fCutName.size(); i++) {
// cout << i << endl;
cout << "\t cut: \"" << fCutName[i] << "\"" << endl; cout << "\t cut: \"" << fCutName[i] << "\"" << endl;
} }
} }
...@@ -149,13 +147,10 @@ void AculCalParsScint::PrintParameters(const char* option) { ...@@ -149,13 +147,10 @@ void AculCalParsScint::PrintParameters(const char* option) {
if (!opt.Contains("all")) return; if (!opt.Contains("all")) return;
cout << "\tPeak limits for particular channels and energies:" << endl; cout << "\tPeak limits for particular channels and energies:" << endl;
for (Int_t k = 0; k < (Int_t)fPeakMin.size(); k++) { for (Int_t k = 0; k < (Int_t)fFilePars.size(); k++) {
cout << "\t Set number: " << k << "; energy: " << fFilePars[k].GetEnergy() << " MeV" << endl;
cout << "\t Set number: " << k << "; energy: " << fE[k] << " MeV" << endl; for (Int_t i = 0; i < (Int_t)fFilePars[k].GetNoCrystals(); i++) {
cout << "\t\t " << fFilePars[k].GetPeakMin(i) << "\t" << fFilePars[k].GetPeakMax(i) << endl;
for (Int_t i = 0; i < (Int_t)fPeakMin[k].size(); i++) {
// cout << i << endl;
cout << "\t\t " << fPeakMin[k][i] << "\t" << fPeakMax[k][i] << endl;
} }
} }
...@@ -170,29 +165,24 @@ void AculCalParsScint::Reset() { ...@@ -170,29 +165,24 @@ void AculCalParsScint::Reset() {
fPartName = ""; fPartName = "";
fNoFiles = 0; fNoFiles = 0;
fFilePars.clear();
fEnergyPoints = 0; fEnergyPoints = 0;
fE.clear();
fCutsFileName = ""; fCutsFileName = "";
fNoCuts = 0; //number of cuts fNoCuts = 0; //number of cuts
fFileName.clear();
fCutName.clear(); fCutName.clear();
fPeakMin.clear();
fPeakMax.clear();
return; return;
} }
const char* AculCalParsScint::GetFileName(Int_t i) { const char* AculCalParsScint::GetFileName(Int_t i) {
if ( i > (Int_t)fFileName.size()-1 ) { if ( i >= (Int_t)fFilePars.size() ) {
cerr << "\"AculCalParsScint::GetFileName\" index i cannot be higher than " << fFileName.size() - 1 << endl; cerr << "\"AculCalParsScint::GetFileName\" index i cannot be higher than " << fFilePars.size() - 1 << endl;
return 0; return 0;
} }
return fFileName[i].Data(); return fFilePars[i].GetRawFileName();
} }
const char* AculCalParsScint::GetCutName(Int_t i) { const char* AculCalParsScint::GetCutName(Int_t i) {
...@@ -214,11 +204,6 @@ TCutG* AculCalParsScint::GetCut(Int_t i) { ...@@ -214,11 +204,6 @@ TCutG* AculCalParsScint::GetCut(Int_t i) {
TCutG* AculCalParsScint::GetCut(const char* cutName) { TCutG* AculCalParsScint::GetCut(const char* cutName) {
// TClonesArray cutsCol;
//
// for (Int_t i = 0; i < nCuts; i++) {
// cutsCol[i] = (TCutG*)fCuts->Get(cutNames[i]);
// }
const TString cName = cutName; const TString cName = cutName;
for (Int_t i = 0; i <= (Int_t)fCuts.size(); i++) { for (Int_t i = 0; i <= (Int_t)fCuts.size(); i++) {
...@@ -232,43 +217,45 @@ TCutG* AculCalParsScint::GetCut(const char* cutName) { ...@@ -232,43 +217,45 @@ TCutG* AculCalParsScint::GetCut(const char* cutName) {
Double_t AculCalParsScint::GetCalEnergy(Int_t i) { Double_t AculCalParsScint::GetCalEnergy(Int_t i) {
if ( i > (Int_t)fE.size()-1 ) { if ( i >= (Int_t)fFilePars.size() ) {
cerr << "\"AculCalParsScint::GetCalEnergy\" index i cannot be higher than " << fE.size() - 1 << endl; cerr << "\"AculCalParsScint::GetCalEnergy\" index i cannot be higher than " << fFilePars.size() - 1 << endl;
return 0; return 0;
} }
return fE[i]; return fFilePars[i].GetEnergy();
} }
Int_t AculCalParsScint::GetMinChannel(Int_t energy, Int_t crystal) { Int_t AculCalParsScint::GetMinChannel(Int_t energy, Int_t crystal) {
if ( energy > (Int_t)fPeakMin.size()-1 ) { if ( energy >= (Int_t)fFilePars.size() ) {
cerr << "\"AculCalParsScint::GetMinChannel\" index \"energy\" cannot be higher than " << fPeakMin.size() - 1 << endl; cerr << "\"AculCalParsScint::GetMinChannel\" index \"energy\" cannot be higher than "
<< fFilePars.size() - 1 << endl;
return 0; return 0;
} }
vector<Int_t> v = fPeakMin[energy]; if ( crystal >= fFilePars[energy].GetNoCrystals() ) {
if ( crystal > (Int_t)v.size()-1 ) { cerr << "\"AculCalParsScint::GetMinChannel\" index \"crystal\" cannot be higher than "
cerr << "\"AculCalParsScint::GetMinChannel\" index \"crystal\" cannot be higher than " << v.size() - 1 << endl; << fFilePars[energy].GetNoCrystals() - 1 << endl;
return 0; return 0;
} }
return fPeakMin[energy][crystal]; return fFilePars[energy].GetPeakMin(crystal);
} }
Int_t AculCalParsScint::GetMaxChannel(Int_t energy, Int_t crystal) { Int_t AculCalParsScint::GetMaxChannel(Int_t energy, Int_t crystal) {
if ( energy > (Int_t)fPeakMax.size()-1 ) { if ( energy >= (Int_t)fFilePars.size() ) {
cerr << "\"AculCalParsScint::GetMinChannel\" index \"energy\" cannot be higher than " << fPeakMax.size() - 1 << endl; cerr << "\"AculCalParsScint::GetMinChannel\" index \"energy\" cannot be higher than "
<< fFilePars.size() - 1 << endl;
return 0; return 0;
} }
vector<Int_t> v = fPeakMax[energy]; if ( crystal >= fFilePars[energy].GetNoCrystals() ) {
if ( crystal > (Int_t)v.size()-1 ) { cerr << "\"AculCalParsScint::GetMinChannel\" index \"crystal\" cannot be higher than "
cerr << "\"AculCalParsScint::GetMinChannel\" index \"crystal\" cannot be higher than " << v.size() - 1 << endl; << fFilePars[energy].GetNoCrystals() - 1 << endl;
return 0; return 0;
} }
return fPeakMax[energy][crystal]; return fFilePars[energy].GetPeakMax(crystal);
} }
void AculCalParsScint::LoadCuts() { void AculCalParsScint::LoadCuts() {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#define ACULCALIB_ACULCALPARSSCINT_H_ #define ACULCALIB_ACULCALPARSSCINT_H_
#include "AculCalPars.h" #include "AculCalPars.h"
#include "AculCalParsScintFile.h"
//#include "TCutG.h" //#include "TCutG.h"
using std::cerr; using std::cerr;
...@@ -22,19 +23,17 @@ private: ...@@ -22,19 +23,17 @@ private:
TString fPartName; TString fPartName;
Int_t fNoFiles; Int_t fNoFiles;
vector<TString> fFileName; vector<AculCalParsScintFile> fFilePars;
//todo following parameters should be probably moved to AculCalParsScintFile
//as far as they are related to each file separately
vector<TString> fCutName; vector<TString> fCutName;
vector<TCutG> fCuts; vector<TCutG> fCuts;
Int_t fEnergyPoints; Int_t fEnergyPoints;
vector<Double_t> fE;
TString fCutsFileName; TString fCutsFileName;
Int_t fNoCuts; //number of cuts Int_t fNoCuts; //number of cuts
vector< vector<Int_t> > fPeakMin;
vector< vector<Int_t> > fPeakMax;
public: public:
AculCalParsScint(); AculCalParsScint();
AculCalParsScint(const char* parFile); AculCalParsScint(const char* parFile);
......
...@@ -10,6 +10,7 @@ $(ACULCALIB)/AculCalib.h \ ...@@ -10,6 +10,7 @@ $(ACULCALIB)/AculCalib.h \
$(ACULCALIB)/AculCalibScint.h \ $(ACULCALIB)/AculCalibScint.h \
$(ACULCALIB)/AculCalPars.h \ $(ACULCALIB)/AculCalPars.h \
$(ACULCALIB)/AculCalParsScint.h \ $(ACULCALIB)/AculCalParsScint.h \
$(ACULCALIB)/AculCalParsScintFile.h \
$(ACULCALIB)/linkdef.h $(ACULCALIB)/linkdef.h
ACULCALIBCPP_SRCS += \ ACULCALIBCPP_SRCS += \
...@@ -17,6 +18,7 @@ $(ACULCALIB)/AculCalib.cpp \ ...@@ -17,6 +18,7 @@ $(ACULCALIB)/AculCalib.cpp \
$(ACULCALIB)/AculCalibScint.cpp \ $(ACULCALIB)/AculCalibScint.cpp \
$(ACULCALIB)/AculCalPars.cpp \ $(ACULCALIB)/AculCalPars.cpp \
$(ACULCALIB)/AculCalParsScint.cpp \ $(ACULCALIB)/AculCalParsScint.cpp \
$(ACULCALIB)/AculCalParsScintFile.cpp \
$(ACULCALIB)/AculCalibCint.cpp $(ACULCALIB)/AculCalibCint.cpp
ACULCALIBOBJS += \ ACULCALIBOBJS += \
...@@ -24,6 +26,7 @@ $(ACULCALIB)/AculCalib.o \ ...@@ -24,6 +26,7 @@ $(ACULCALIB)/AculCalib.o \
$(ACULCALIB)/AculCalibScint.o \ $(ACULCALIB)/AculCalibScint.o \
$(ACULCALIB)/AculCalPars.o \ $(ACULCALIB)/AculCalPars.o \
$(ACULCALIB)/AculCalParsScint.o \ $(ACULCALIB)/AculCalParsScint.o \
$(ACULCALIB)/AculCalParsScintFile.o \
$(ACULCALIB)/AculCalibCint.o $(ACULCALIB)/AculCalibCint.o
ACULCALIBCPP_DEPS += \ ACULCALIBCPP_DEPS += \
...@@ -31,4 +34,5 @@ $(ACULCALIB)/AculCalib.d \ ...@@ -31,4 +34,5 @@ $(ACULCALIB)/AculCalib.d \
$(ACULCALIB)/AculCalibScint.d \ $(ACULCALIB)/AculCalibScint.d \
$(ACULCALIB)/AculCalPars.d \ $(ACULCALIB)/AculCalPars.d \
$(ACULCALIB)/AculCalParsScint.d \ $(ACULCALIB)/AculCalParsScint.d \
$(ACULCALIB)/AculCalParsScintFile.d \
$(ACULCALIB)/AculCalibCint.d $(ACULCALIB)/AculCalibCint.d
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#pragma link C++ class AculCalibScint; #pragma link C++ class AculCalibScint;
#pragma link C++ class AculCalPars; #pragma link C++ class AculCalPars;
#pragma link C++ class AculCalParsScint; #pragma link C++ class AculCalParsScint;
#pragma link C++ class AculCalParsScintFile;
#endif #endif
//#include "../../AculCalib/AculCalPars.h" //#include "../../AculCalib/AculCalPars.h"
//#include "../../AculCalib/AculCalibScint.h" //#include "../../AculCalib/AculCalibScint.h"
//#include "TSystem.h" //#include "TSystem.h"
//#include <iostream>
//
using std::cout;
using std::endl;
void parTest() void parTest()
{ {
gSystem->Load("../../libAculCalib.so"); gSystem->Load("../../libAculCalib.so");
AculCalParsScintFile pp;
pp.SetNoCrystals(16);
pp.Init();
// return;
cout << "-----------------------" << endl;
AculCalParsScint p; AculCalParsScint p;
p.SetParFile("SQ13Alpha.par"); p.SetParFile("SQ13Alpha.par");
p.Init();
// cout << p.GetFileName(0) << endl;
// cout << p.GetFileName(1) << endl;
// cout << p.GetFileName(2) << endl;
// cout << p.GetFileName(3) << endl;
// cout << p.GetFileName(4) << endl;
p.PrintParameters("all");
// return;
p.Reset();
p.PrintParameters("");
// return;
AculCalibScint c; AculCalibScint c;
c.SetParFile("SQ13Alpha.par"); c.SetParFile("SQ13Alpha.par");
......
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