Commit fa30d6f2 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Parameters for scintillator have been sligthly optimized.

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