Commit 88726b84 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Merge branch 'newArch' into migrateToRoot6

Compilation using makefile possible only. All errors resolved, warnings remaining.
parents 13e5802a 6fc4050f
/*
* AculCalParameters.cpp
*
* Created on: Oct 20, 2016
* Author: vratik
*/
#include "AculCalPars.h"
AculCalPars::AculCalPars() {
// TODO Auto-generated constructor stub
Reset();
}
AculCalPars::AculCalPars(const char* parFile) {
// TODO Auto-generated constructor stub
SetParFile(parFile);
Init();
}
AculCalPars::~AculCalPars() {
// TODO Auto-generated destructor stub
}
void AculCalPars::Init() {
SetPars();
}
void AculCalPars::SetParFile(const char* parfile) {
fParFileName = parfile;
return;
}
void AculCalPars::Reset() {
fParFileName = "";
fEtab.clear();
}
/*
* AculCalParameters.h
*
* Created on: Oct 20, 2016
* Author: vratik
*/
#ifndef ACULCALIB_ACULCALPARS_H_
#define ACULCALIB_ACULCALPARS_H_
#include <iostream>
#include <fstream>
#include <vector>
#include "TString.h"
#include "TArrayD.h"
#include "TArrayI.h"
#include "TCutG.h"
using std::cout;
using std::cerr;
using std::endl;
using std::vector;
class AculCalPars {
protected:
//general
TString fParFileName;
vector<Double_t> fEtab; //energy which will be used for calibration
//todo energies used for calibration should be in this class
public:
AculCalPars();
AculCalPars(const char* parFile);
virtual ~AculCalPars();
ClassDef(AculCalPars,1);
virtual void Init();
//getters
const char* GetParFileName() {return fParFileName.Data();}
// Int_t GetNoCrystals() {return fNoCrystals;}
virtual const char* GetDetName() {return 0;}
virtual const char* GetParticleName() {return 0;}
virtual Int_t GetNoRawFiles() {return 0;};
virtual const char* GetFileName(Int_t i) {return 0;};
virtual Int_t GetNoEPoints() {return 0;}
virtual Double_t GetCalEnergy(Int_t i) {return 0.;};
//todo check functions with cuts
// 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, Int_t treeID = 0) {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;};
void SetParFileName(const char* parFile) {fParFileName = parFile;}
void SetParFile(const char* parfile);
virtual void PrintParameters(const char* option = "") {};
virtual void Reset();
protected:
virtual void SetPars() {};
};
#endif /* ACULCALIB_ACULCALPARS_H_ */
/*
* AculCalParsScint.cpp
*
* Created on: Oct 21, 2016
* Author: vratik
*/
#include "AculCalParsScint.h"
#include "TFile.h"
AculCalParsScint::AculCalParsScint() {
// TODO Auto-generated constructor stub
Reset();
}
AculCalParsScint::AculCalParsScint(const char* parFile) {
// TODO Auto-generated constructor stub
SetParFile(parFile);
Init();
}
AculCalParsScint::~AculCalParsScint() {
// TODO Auto-generated destructor stub
}
void AculCalParsScint::Init() {
SetPars();
// LoadCuts();
}
void AculCalParsScint::SetPars() {
std::ifstream infile(fParFileName.Data());
if ( !infile.is_open() ) {
printf("AculCalParsScint::ReadParFile: File %s was not open and parameters were not set.\n", fParFileName.Data());
Reset();
return;
}
fEnergyPoints = 0;
TString line;
TString word;
Int_t i, min, max;
Int_t lineLength = 400;
Char_t det[lineLength];
Char_t part[lineLength];
Char_t fname[lineLength];
Char_t cname[lineLength];
double en; //energy
while (!infile.eof()) {
line.ReadLine(infile);
if ( line.BeginsWith("#") || line.BeginsWith("//") ) continue;
if ( line.BeginsWith("energies") ) {
sscanf(line.Data(), "%*s %d", &i);
continue;
}
if ( line.BeginsWith("crystals") ) {
sscanf(line.Data(), "%*s %d", &i);
fNoCrystals = i;
continue;
}
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);
if ( line.BeginsWith("#") || line.BeginsWith("//") ) {
j--;
continue;
}
sscanf(line, "%s", fname);
word = fname;
fFilePars[j].SetRawFileName(fname);
fFilePars[j].SetNoCrystals(fNoCrystals);
fFilePars[j].Init();
}
continue;
}
/*if ( line.BeginsWith("cutFile") ) {
sscanf(line.Data(), "%*s %s %d", fname, &fNoCuts);
fCutsFileName = fname;
for (Int_t j = 0; j < fNoCuts; j++) {
line.ReadLine(infile);
if ( line.BeginsWith("#") || line.BeginsWith("//") ) {
j--;
continue;
}
sscanf(line, "%s", cname);
fCutName.push_back(cname);
}
continue;
}*/
if ( line.BeginsWith("detector") ) {
sscanf(line.Data(), "%*s %s %s", det, part);
fDetName = det;
fPartName = part;
continue;
}
if ( line.BeginsWith("energy") ) {
sscanf(line.Data(), "%*s %lf", &en);
fFilePars[fEnergyPoints].SetEnergy(en);
do {line.ReadLine(infile);}
while (line.BeginsWith("#") || line.BeginsWith("//"));
if ( line.BeginsWith("cutFile") ) {
Int_t noCuts;
// sscanf(line.Data(), "%*s %s %d", fname, &fNoCuts);
sscanf(line.Data(), "%*s %s %d", fname, &noCuts);
fFilePars[fEnergyPoints].SetNoCuts(noCuts);
fFilePars[fEnergyPoints].SetCutFileName(fname);
// cout << line << endl;
// cout << noCuts << endl;
// fCutsFileName = fname;
for (Int_t j = 0; j < noCuts; j++) {
line.ReadLine(infile);
// cout << line << endl;
if ( line.BeginsWith("#") || line.BeginsWith("//") ) {
j--;
continue;
}
sscanf(line, "%s", cname);
fFilePars[fEnergyPoints].SetCutName(j, cname);
// fCutName.push_back(cname);
}
fFilePars[fEnergyPoints].LoadCuts();
line.ReadLine(infile);
// cout << line << endl;
// continue;
}
// cout << fNoCrystals << endl;
for (Int_t j = 0; j < fNoCrystals; j++) {
// line.ReadLine(infile);
// cout << j << endl;
if ( line.BeginsWith("#") || line.BeginsWith("//") ) {
j--;
line.ReadLine(infile);
continue;
}
sscanf(line.Data(), "%d %d %d", &j, &min, &max);
// cout << j << endl;
fFilePars.at(fEnergyPoints).SetPeakMin(j, min);
fFilePars.at(fEnergyPoints).SetPeakMax(j, max);
line.ReadLine(infile);
}
fEnergyPoints++;
continue;
}
// cout << "aklsjdlaksjd" << endl;
// sscanf(line.Data(), "%d %d %d", &i, &min, &max);
// fFilePars.at(fEnergyPoints-1).SetPeakMin(i, min);
// fFilePars.at(fEnergyPoints-1).SetPeakMax(i, max);
}//while
infile.close();
return;
}
void AculCalParsScint::PrintParameters(const char* option) {
TString opt = option;
cout << "Parameters read from file \"" << fParFileName.Data() << "\"." << endl;
cout << "\tCalibration of detector \"" << fDetName << "\" with " << fNoCrystals << " crystals." << endl;
cout << "\tParticle: " << fPartName << endl;
cout << "\tInput files with raw data (" << fNoFiles << "):" << 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)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 << "\t cut: \"" << fCutName[i] << "\"" << endl;
// }
// }
for (Int_t k = 0; k < (Int_t)fFilePars.size(); k++) {
cout << "\t" << fFilePars[k].GetNoCuts() << " cuts from file \"" << fFilePars[k].GetCutFileName() << "\":" << endl;
for (Int_t i = 0; i < fFilePars[k].GetNoCuts(); i++) {
cout << "\t " << fFilePars[k].GetCut(i)->GetName() << endl;
}
if (!opt.Contains("all")) continue;
cout << "\tPeak limits for particular channels and energies:" << endl;
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;
}
}
return;
}
void AculCalParsScint::Reset() {
fNoCrystals = 0;
fParFileName = "";
fDetName = "";
fPartName = "";
fNoFiles = 0;
fFilePars.clear();
fEnergyPoints = 0;
// fCutsFileName = "";
// fNoCuts = 0; //number of cuts
// fCutName.clear();
return;
}
const char* AculCalParsScint::GetFileName(Int_t i) {
if ( i >= (Int_t)fFilePars.size() ) {
cerr << "\"AculCalParsScint::GetFileName\" index i cannot be higher than " << fFilePars.size() - 1 << endl;
return 0;
}
return fFilePars[i].GetRawFileName();
}
/*const char* AculCalParsScint::GetCutName(Int_t i) {
if ( i > (Int_t)fCutName.size()-1 ) {
cerr << "\"AculCalParsScint::GetCutName\" index i cannot be higher than " << fCutName.size() - 1 << endl;
return 0;
}
return fCutName[i].Data();
}*/
/*TCutG* AculCalParsScint::GetCut(Int_t i) {
if ( i >= (Int_t)fCuts.size() ) {
cerr << "\"AculCalParsScint::GetCut\" index i cannot be higher than " << fCuts.size() - 1 << endl;
return 0;
}
return &fCuts[i];
}*/
TCutG* AculCalParsScint::GetCut(const char* cutName, Int_t treeID) {
const TString cName = cutName;
if (treeID >= (Int_t)fFilePars.size()) {
cerr << "\"AculCalParsScint::GetCut\" treeID does not exist. It cannot be higher than "
<< fFilePars.size() << "." << endl;
return 0;
}
// TCutG *curCut = 0;
for (Int_t i = 0; i < fFilePars[treeID].GetNoCuts(); i++) {
// if (cName.EqualTo(fFilePars[treeID])) { return &fCuts[i]; }
if ( cName.EqualTo( fFilePars[treeID].GetCutName(i) ) ) {
return fFilePars[treeID].GetCut(i);
// return curCut;
}
}
cerr << "\"AculCalParsScint::GetCut\" cut \"" << cutName << "\" was not found." << endl;
return 0;
}
Double_t AculCalParsScint::GetCalEnergy(Int_t i) {
if ( i >= (Int_t)fFilePars.size() ) {
cerr << "\"AculCalParsScint::GetCalEnergy\" index i cannot be higher than " << fFilePars.size() - 1 << endl;
return 0;
}
return fFilePars[i].GetEnergy();
}
Int_t AculCalParsScint::GetMinChannel(Int_t energy, Int_t crystal) {
if ( energy >= (Int_t)fFilePars.size() ) {
cerr << "\"AculCalParsScint::GetMinChannel\" index \"energy\" cannot be higher than "
<< fFilePars.size() - 1 << endl;
return 0;
}
if ( crystal >= fFilePars[energy].GetNoCrystals() ) {
cerr << "\"AculCalParsScint::GetMinChannel\" index \"crystal\" cannot be higher than "
<< fFilePars[energy].GetNoCrystals() - 1 << endl;
return 0;
}
return fFilePars[energy].GetPeakMin(crystal);
}
Int_t AculCalParsScint::GetMaxChannel(Int_t energy, Int_t crystal) {
if ( energy >= (Int_t)fFilePars.size() ) {
cerr << "\"AculCalParsScint::GetMinChannel\" index \"energy\" cannot be higher than "
<< fFilePars.size() - 1 << endl;
return 0;
}
if ( crystal >= fFilePars[energy].GetNoCrystals() ) {
cerr << "\"AculCalParsScint::GetMinChannel\" index \"crystal\" cannot be higher than "
<< fFilePars[energy].GetNoCrystals() - 1 << endl;
return 0;
}
return fFilePars[energy].GetPeakMax(crystal);
}
/*void AculCalParsScint::LoadCuts() {
if (fCutsFileName.Length() == 0) {
printf("AculCalParsScint::LoadCuts: Name of file (*.root) with cuts was not provided.\n");
printf("AculCalParsScint::LoadCuts: No cuts has been loaded.\n");
return;
}
TFile cutFile(fCutsFileName.Data(), "READ");
if(!cutFile.IsOpen()) {
cerr << "\"AculCalParsScint::LoadCuts\" File " << fCutsFileName.Data()
<< " was not open and no cuts were loaded." << endl;
return;
}
for (Int_t i = 0; i < (Int_t)fCutName.size(); i++) {
TCutG *currentCut = (TCutG*)cutFile.Get(fCutName[i]);
if (!currentCut) {
cout << "\"AculCalParsScint::LoadCuts\" Cut \"" << fCutName[i]
<< "\" was not found in file " << fCutsFileName << "." << endl;
continue;
}
fCuts.push_back(*currentCut);
}
}*/
/*
* AculCalParsScint.h
*
* Created on: Oct 21, 2016
* Author: vratik
*/
#ifndef ACULCALIB_ACULCALPARSSCINT_H_
#define ACULCALIB_ACULCALPARSSCINT_H_
#include "AculCalPars.h"
#include "AculCalParsScintFile.h"
//#include "TCutG.h"
using std::cerr;
class AculCalParsScint: public AculCalPars {
private:
Int_t fNoCrystals;
TString fDetName;
TString fPartName;
Int_t fNoFiles;
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;
// TString fCutsFileName;
// Int_t fNoCuts; //number of cuts
public:
AculCalParsScint();
AculCalParsScint(const char* parFile);
virtual ~AculCalParsScint();
ClassDef(AculCalParsScint, 1);
virtual void Init();
void PrintParameters(const char* option = "");
// If option contains "all", all parameters will be printed out.
// By default important parameters only will be printed out.
void Reset();
//getters
Int_t GetNoCrystals() {return fNoCrystals;}
const char* GetDetName() {return fDetName.Data();}
const char* GetParticleName() {return fPartName.Data();}
Int_t GetNoRawFiles() {return fNoFiles;}
const char* GetFileName(Int_t i);
const char* GetCutName(Int_t i);
Int_t GetNoEPoints() {return fEnergyPoints;}
Double_t GetCalEnergy(Int_t i);
// const char* GetCutsFileName() {return fCutsFileName.Data();}
// Int_t GetNoCuts() {return fNoCuts;}
// TCutG* GetCut(Int_t i);
TCutG* GetCut(const char* cutName, Int_t treeID = 0);
Int_t GetMinChannel(Int_t energy, Int_t crystal);
Int_t GetMaxChannel(Int_t energy, Int_t crystal);
//private:
// void LoadCuts();
protected:
void SetPars();
};
#endif /* ACULCALIB_ACULCALPARSSCINT_H_ */
/*
* AculCalParsScintFile.cpp
*
* Created on: Oct 25, 2016
* Author: vratik
*/
#include "AculCalParsScintFile.h"
AculCalParsScintFile::AculCalParsScintFile() {
// TODO Auto-generated constructor stub
// fFileID = 0;
fNoCrystals = 0;
fE = 0;
Init();
}
AculCalParsScintFile::~AculCalParsScintFile() {
// TODO Auto-generated destructor stub
}
void AculCalParsScintFile::Init() {
// fNoCrystals = 0;
// fE = 0;
fPeakMin.resize(fNoCrystals);
fPeakMax.resize(fNoCrystals);
fCutName.resize(0);
}
const char* AculCalParsScintFile::GetCutName(Int_t i) {
if ( i >= (Int_t)fCutName.size() ) {
cout << "\"AculCalParsScintFile::GetCutName\" Cut number " << i
<< " is not available. Maximal i can be set as "
<< fCutName.size() - 1 << "." << endl;
}
return fCutName[i].Data();
}
TCutG* AculCalParsScintFile::GetCut(Int_t i) {
if ( i >= (Int_t)fCut.size() ) {
cerr << "\"AculCalParsScintFile::GetCut\" index i cannot be higher than " << fCut.size() - 1 << endl;
return 0;
}
return &fCut[i];
}
TCutG* AculCalParsScintFile::GetCut(const char* cutName) {
const TString cName = cutName;
for (Int_t i = 0; i <= (Int_t)fCut.size(); i++) {
if (cName.EqualTo(fCutName[i])) { return &fCut[i]; }
}
cerr << "\"AculCalParsScint::GetCut\" cut \"" << cutName << "\" was not found." << endl;
return 0;
}
Int_t AculCalParsScintFile::GetPeakMin(Int_t crystalID) {
if ( crystalID >= (Int_t)fPeakMin.size() ) {
cerr << "\"AculCalParsScintFile::GetPeakMin\" index \"crystal\" cannot be higher than "
<< fPeakMin.size() - 1 << endl;
return 0;
}
return fPeakMin[crystalID];
}
Int_t AculCalParsScintFile::GetPeakMax(Int_t crystalID) {
if ( crystalID >= (Int_t)fPeakMax.size() ) {
cerr << "\"AculCalParsScintFile::GetPeakMax\" index \"crystal\" cannot be higher than "
<< fPeakMax.size() - 1 << endl;
return 0;
}
return fPeakMax[crystalID];
}
void AculCalParsScintFile::SetRawFileName(const char* filename) {
fFileName = filename;
// fFileID++;
}
void AculCalParsScintFile::SetCutFileName(const char* filename) {
fCutsFileName = filename;
}
void AculCalParsScintFile::SetNoCuts(Int_t noCuts) {
fCutName.resize(noCuts);
}
void AculCalParsScintFile::SetCutName(Int_t i, const char* cutname) {
if ( i >= (Int_t)fCutName.size() ) {
cout << "\"AculCalParsScintFile::SetCutName\" vector for cut names is not enough large. Maximal i can be set as "
<< fCutName.size() - 1 << "." << endl;
}
fCutName[i] = cutname;
}
void AculCalParsScintFile::SetPeakMin(Int_t crystalID, Double_t limit) {
if ( crystalID>=(Int_t)fPeakMin.size() ) {
cerr << "\"AculCalParsScintFile::SetPeakMin\" maximal allowed crystal ID is " << fPeakMin.size() << "."<< endl;
return;
}
fPeakMin[crystalID] = limit;
}
void AculCalParsScintFile::SetPeakMax(Int_t crystalID, Double_t limit) {
if ( crystalID>=(Int_t)fPeakMax.size() ) {
cerr << "\"AculCalParsScintFile::SetPeakMax\" maximal allowed crystal ID is " << fPeakMax.size() << "."<< endl;
return;
}
fPeakMax[crystalID] = limit;
}
void AculCalParsScintFile::LoadCuts() {
if (fCutsFileName.Length() == 0) {
printf("AculCalParsScintFile::LoadCuts: Name of file (*.root) with cuts was not provided.\n");
printf("AculCalParsScintFile::LoadCuts: No cuts has been loaded.\n");
return;
}
TFile cutFile(fCutsFileName.Data(), "READ");
if(!cutFile.IsOpen()) {
cerr << "\"AculCalParsScintFile::LoadCuts\" File " << fCutsFileName.Data()
<< " was not open and no cuts were loaded." << endl;
return;
}
for (Int_t i = 0; i < (Int_t)fCutName.size(); i++) {
TCutG *currentCut = (TCutG*)cutFile.Get(fCutName[i]);
if (!currentCut) {
cout << "\"AculCalParsScintFile::LoadCuts\" Cut \"" << fCutName[i]
<< "\" was not found in file " << fCutsFileName << "." << endl;
continue;
}
fCut.push_back(*currentCut);
}
}
/*void AculCalParsScintFile::Reset() {
}*/
/*
* AculCalParsScintFile.h
*
* Created on: Oct 25, 2016
* Author: vratik
*/
#ifndef ACULCALIB_ACULCALPARSSCINTFILE_H_
#define ACULCALIB_ACULCALPARSSCINTFILE_H_
#include <vector>
#include <iostream>
#include "TFile.h"
#include "TCutG.h"
#include "TString.h"
using std::vector;
using std::cout;
using std::endl;
using std::cerr;
class AculCalParsScintFile {
private:
// UInt_t fFileID;
Int_t fNoCrystals;
Double_t fE;
// TCutG fCuts;
TString fFileName;
TString fCutsFileName;
vector<TString> fCutName;
vector<TCutG> fCut;
vector<Int_t> fPeakMin;
vector<Int_t> fPeakMax;
public:
AculCalParsScintFile();
virtual ~AculCalParsScintFile();
ClassDef(AculCalParsScintFile, 1);
void Init();
Int_t GetNoCrystals() {return fNoCrystals;}
const char* GetRawFileName() {return fFileName.Data();}
const char* GetCutFileName() {return fCutsFileName.Data();}
Double_t GetEnergy() {return fE;}
Int_t GetNoCuts() {return (Int_t)fCut.size();}
const char* GetCutName(Int_t i);
TCutG* GetCut(Int_t i);
TCutG* GetCut(const char* cutName);
Int_t GetPeakMin(Int_t crystalID);
Int_t GetPeakMax(Int_t crystalID);
void SetNoCrystals(Int_t nocrystals) {fNoCrystals = nocrystals;};
void SetEnergy(Double_t energy) {fE = energy;};
void SetRawFileName(const char* filename);
void SetCutFileName(const char* filename);
void SetNoCuts(Int_t noCuts);
void SetCutName(Int_t i, const char* cutname);
void SetPeakMin(Int_t crystalID, Double_t limit);
void SetPeakMax(Int_t crystalID, Double_t limit);
void LoadCuts();
// void Reset();
private:
// void LoadCuts();
};
#endif /* ACULCALIB_ACULCALPARSSCINTFILE_H_ */
/*
* AculCalParsSi.cpp
*
* Created on: Oct 26, 2016
* Author: vratik
*/
#include "AculCalParsSi.h"
AculCalParsSi::AculCalParsSi() {
// TODO Auto-generated constructor stub
Reset();
}
AculCalParsSi::AculCalParsSi(const char* parFile) {
SetParFile(parFile);
Init();
}
AculCalParsSi::~AculCalParsSi() {
// TODO Auto-generated destructor stub
}
void AculCalParsSi::Init() {
SetELosses();
SetPars();
SetCalEnergies();
}
void AculCalParsSi::Reset() {
fParFileName = "";
kRaNOPEAKS = 0;
fEnergyInput.clear();
fLowerChannel = 0.;
fUpperChannel = 0.;
fLowerPeakRelativeHight = 0.;
fUpperPeakRelativeHight = 0.;
fPeakPositionTolerance = 0.;
fFitFuncLineWidth = 1;
fFitMinSigma = 0.;
fFitPeakThreshold = 0.;
fDeadLayer = 0.;
return;
}
void AculCalParsSi::SetPars() {
if (fParFileName.Length()==0) {
cerr << "\'AculCalibration::SetInputsParameters\" File with input parameters was not set." << endl;
return;
}
const Int_t lineLength = 400;
Char_t line[lineLength];
Char_t parameter[100];
Char_t identificator[100];
std::ifstream fipr;
fipr.open(fParFileName.Data());
if (!fipr.is_open()) {
cerr << "\"AculCalibration::SetInputsParameters\" File with input parameters \""
<< fParFileName << "\" was not opened." << endl;
return;
}
cout << "\"AculCalibration::SetInputsParameters\" File with input parameters \""
<< fParFileName << "\" will be processed." << endl;
while (!fipr.eof()) {
fipr.getline(line, lineLength);
if (strlen(line) < 2) {
continue;
}
sscanf(line, "%s %s", parameter, identificator);
if ( strcmp(identificator, "noPeaks") == 0 ) {
kRaNOPEAKS = static_cast<Int_t>(atoi(parameter));
fEnergyInput.resize(kRaNOPEAKS);
fEtab.resize(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));
}
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 ) {
sscanf(line, "%s", parameter);
fUpperPeakRelativeHight = static_cast<Double_t>(atof(parameter));
}
if ( strcmp(identificator, "peakPositionTolerance") == 0 ) {
sscanf(line, "%s", parameter);
fPeakPositionTolerance = static_cast<Double_t>(atof(parameter));
}
if ( strcmp(identificator, "fitFunctionLineWidth") == 0 ) {
sscanf(line, "%s", parameter);
fFitFuncLineWidth = static_cast<Width_t>(atoi(parameter));
}
if ( strcmp(identificator, "minFitSigma") == 0 ) {
sscanf(line, "%s", parameter);
fFitMinSigma = static_cast<Double_t>(atof(parameter));
}
if ( strcmp(identificator, "fitHightThreshold") == 0 ) {
sscanf(line, "%s", parameter);
fFitPeakThreshold = static_cast<Double_t>(atof(parameter));
}
if ( strcmp(identificator, "deadLayer") == 0 ) {
sscanf(line, "%s", parameter);
fDeadLayer = static_cast<Double_t>(atof(parameter));
}
}
fipr.close();
return;
}
void AculCalParsSi::PrintParameters(const char* option)
{
//print alpha source parameters
cout << "AculCalibration::PrintInputParameters:" << endl;
cout << "\tNumber of peaks: " << kRaNOPEAKS << endl;
for (Int_t i = 0; i < kRaNOPEAKS; i++) {
cout << "\t\tfEnergyInput[" << i << "] = " << fEnergyInput[i] << " MeV" << endl;
}
cout << "\tEnergies used for calibration:" << endl;
cout << "\t(deadLayer: " << fDeadLayer << " mcm)" << endl;
for (Int_t i = 0; i < kRaNOPEAKS; i++) {
cout << "\t\tfE[" << i << "] = " << fEtab[i] << " MeV" << 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;
}
void AculCalParsSi::SetELosses() {
Info("AculCalibration::SetELosses", "Combination of aplha particle with silicon material only.");
fAlphaSi.SetEL(1, 2.321); // density in g/cm3
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);
}
void AculCalParsSi::SetCalEnergies() {
if (fDeadLayer<=0.) {
Warning("AculCalibration::SetCalEnergies", "Dead layer was set equal or less than 0.");
for(Int_t i = 0; i < kRaNOPEAKS; i++) {
fEtab[i] = fEnergyInput[i];
}
Info("AculCalibration::SetCalEnergies", "Energies used for calibration are the same as input file.");
return;
}
for(Int_t i = 0; i < kRaNOPEAKS; i++) {
fEtab[i] = fAlphaSi.GetE(fEnergyInput[i], fDeadLayer);
}
Info("AculCalibration::SetCalEnergies", "Energies used for calibration considering %f mcm dead layer were set.", fDeadLayer);
return;
}
/*
* AculCalParsSi.h
*
* Created on: Oct 26, 2016
* Author: vratik
*/
#ifndef ACULCALIB_ACULCALPARSSI_H_
#define ACULCALIB_ACULCALPARSSI_H_
#include "AculCalPars.h"
#include "../TELoss/TELoss.h"
class AculCalParsSi: public AculCalPars {
private:
Int_t kRaNOPEAKS;
// TArrayD fEnergy; //energy after passing through deadlayer
vector<Double_t> fEnergyInput; //incidental energy, set from .par
Double_t fLowerChannel;
Double_t fUpperChannel;
Double_t fLowerPeakRelativeHight; //pouziva se, private
Double_t fUpperPeakRelativeHight; //pouziva se, private, nastavit nenulovou prednastavenou hodnotu
Double_t fPeakPositionTolerance; //pouziva se, private
Width_t fFitFuncLineWidth; //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 fDeadLayer; //in mcm; it will be used for recalculation of energies outcomming from the alpha source
TELoss fAlphaSi;
public:
AculCalParsSi();
AculCalParsSi(const char* parFile);
virtual ~AculCalParsSi();
ClassDef(AculCalParsSi, 1);
void Init();
// Function which loads text file containing parameters for calibration
//
// -inputparfile: file containing information on calibration source
// -In file with the data must be preserved systematic
// -There cannot be whitelines (probably)
//
//Example of "parforcal.par" file
//................................................................
//223Ra
//
//4 nopeaks //number of peaks
//4.415 E1 //in MeV
//5.153 E2 //in MeV
//5.683 E3 //in MeV
//7.419 E4 //in MeV
//100 lowerchannel //in channels
//4096 upperchannel //in channels
//0.1 lowerpeakhight //in relative units
//0.1 upperpeakhight //in relative units
//0.1 peakpositiontolerance //in relative units
//2 fitfunctionlinewidth //integer 1 - 10
//5 minfitsigma //minimal sigma of the peaks to be fitted
//0.4 fithightthreshold //
//................................................................
void Reset();
void PrintParameters(const char* option = "");
//I hope this is selfunderstanding function
private:
void SetPars();
void SetELosses();
void SetCalEnergies();
};
#endif /* ACULCALIB_ACULCALPARSSI_H_ */
#include "AculCalib.h"
//----------------------------------------------------------------------------
AculCalib::AculCalib() {
//documentation example
printf("AculCalib::Default constructor called.\n");
Init();
}
//----------------------------------------------------------------------------
/*AculCalib::AculCalib(const char* parfile) {
printf("AculCalib::Constructor called.\n");
SetParFile(parfile);
Init();
}*/
//----------------------------------------------------------------------------
AculCalib::~AculCalib() {
printf("AculCalib::Destructor called.\n");
delete fPars;
}
//----------------------------------------------------------------------------
void AculCalib::Init() {
fPars = 0;
}
//----------------------------------------------------------------------------
void AculCalib::SetParFile(const char* parfile) {
fParFileName = parfile;
return;
}
//----------------------------------------------------------------------------
void AculCalib::PrintParameters(const char* option) {
if (!fPars) {
cerr << "\"AculCalib::PrintParameters\" parameters were not initialized." << endl;
return;
}
fPars->PrintParameters(option);
}
//----------------------------------------------------------------------------
void AculCalib::PrintCalibParameters() {
cout << "i\ta\t\b" << endl;
for (Int_t i = 0; i<=(Int_t)fA.size(); i++) {
cout << i << "\t" << fA[i] << "\t" << fB[i] << endl;
}
}
//----------------------------------------------------------------------------
Double_t AculCalib::GetA(Int_t i) {
if (i >= (Int_t)fA.size()) //if i >= number of array element
{
return 0.;
}
return fA[i];
}
//----------------------------------------------------------------------------
Double_t AculCalib::GetB(Int_t i) {
if (i >= (Int_t)fB.size()) //if i >= number of array element
{
return 0.;
}
return fB[i];
}
//----------------------------------------------------------------------------
void AculCalib::CanDivider(TCanvas *c, Int_t noPads, Int_t columns, Int_t rows) {
c->Clear();
if (noPads == 16) {
c->Divide(4, 4);
return;
}
if (rows != 0 && columns != 0) {
c->Divide(columns, rows);
return;
}
}
//----------------------------------------------------------------------------
ClassImp(AculCalib);
////////////////////////////////////////////////////////////////
// //
// TMyClass //
// //
// This is the description block. //
// //
////////////////////////////////////////////////////////////////
#ifndef ACULCALIB_ACULCALIB_H_
#define ACULCALIB_ACULCALIB_H_
//#include "TObject.h"
//#include "TROOT.h"
#include <iostream>
#include <fstream>
#include "TArrayD.h"
#include "TString.h"
#include "TCanvas.h"
#include "./AculCalPars.h"
using std::cout;
using std::endl;
using std::cerr;
class AculCalib {
protected:
vector<Double_t> fA; //calibration parameter A
vector<Double_t> fB; //calibration parameter A
TString fParFileName; //name of file with parameters
AculCalPars *fPars; //parameters used for calibration
public:
//Default constructor.
AculCalib();
//Destructor.
virtual ~AculCalib();
ClassDef(AculCalib,1);
virtual void Init();
void SetParFile(const char* parfile);
const char* GetParFileName() {return fParFileName.Data();}
//Print parameters used for calibration.
void PrintParameters(const char* option = "");
//Print calibration parameters.
void PrintCalibParameters();
//Get calibration parameter A.
Double_t GetA(Int_t i);
//Get calibration parameter B.
Double_t GetB(Int_t i);
protected:
void CanDivider(TCanvas *c, Int_t noPads, Int_t columns = 0, Int_t rows = 0);
};
#endif
################################################################################
# AculData input with some variables
################################################################################
# ACULCALIBLIBS := -lCore -lCint -lRIO -lTree -lNet -lThread -lHist -lMatrix -lMathCore -lGpad -lGraf -lSpectrum #-lTELoss
ACULCALIBLIBS := -lCore -lRIO -lTree -lNet -lThread -lHist -lMatrix -lMathCore -lGpad -lGraf -lSpectrum #-lTELoss
# Add inputs and outputs from these tool invocations to the build variables
ACULCALIB_HEADERS += \
$(ACULCALIB)/AculCalib.h \
$(ACULCALIB)/AculCalibScint.h \
$(ACULCALIB)/AculCalibSi.h \
$(ACULCALIB)/AculCalPars.h \
$(ACULCALIB)/AculCalParsScint.h \
$(ACULCALIB)/AculCalParsScintFile.h \
$(ACULCALIB)/AculCalParsSi.h \
$(ACULCALIB)/linkdef.h
ACULCALIBCPP_SRCS += \
$(ACULCALIB)/AculCalib.cpp \
$(ACULCALIB)/AculCalibScint.cpp \
$(ACULCALIB)/AculCalibSi.cpp \
$(ACULCALIB)/AculCalPars.cpp \
$(ACULCALIB)/AculCalParsScint.cpp \
$(ACULCALIB)/AculCalParsScintFile.cpp \
$(ACULCALIB)/AculCalParsSi.cpp \
$(ACULCALIB)/AculCalibDict.cpp
ACULCALIBOBJS += \
$(ACULCALIB)/AculCalib.o \
$(ACULCALIB)/AculCalibScint.o \
$(ACULCALIB)/AculCalibSi.o \
$(ACULCALIB)/AculCalPars.o \
$(ACULCALIB)/AculCalParsScint.o \
$(ACULCALIB)/AculCalParsScintFile.o \
$(ACULCALIB)/AculCalParsSi.o \
$(ACULCALIB)/AculCalibDict.o
ACULCALIBCPP_DEPS += \
$(ACULCALIB)/AculCalib.d \
$(ACULCALIB)/AculCalibScint.d \
$(ACULCALIB)/AculCalibSi.d \
$(ACULCALIB)/AculCalPars.d \
$(ACULCALIB)/AculCalParsScint.d \
$(ACULCALIB)/AculCalParsScintFile.d \
$(ACULCALIB)/AculCalParsSi.d \
$(ACULCALIB)/AculCalibDict.d
\ No newline at end of file
This diff is collapsed.
//////////////////////////////////////////////////////////////////////////////
// //
// This class is intended for ... //
// //
// It work like this... User may use such functions ... in such steps. //
//
// Keywords in parameter file and possible comments
//
// Something about order of keywords
//
// Example of parameter file (with explanations)
//
// energies 4 #number of energy points
// crystals 16 #number of crystals in detector
// files 4
// #fileID fileName
// #fileID not implemented yet
// data/csi_13_Ealpha16.root
// data/csi_13_Ealpha21.root
// data/csi_13_Ealpha26.root
// data/csi_13_Ealpha30.root
// #keyword detector particle
// detector SQ13 Alpha
// #keyword energy [MeV/A]
// energy 66.542
// #keyword; filename; number of cuts in file
// cutFile cuts/cutsSQ13Alpha.root 2
// cutsSQ13Alpha16
// cutSQ13Alpha16Amp
// #channel minimum maximum
// 0 650 830
// 1 920 1150
//\ ...
// 15 800 1000
// #CsI2, energy ~ 21 MeV/A, Alpha
// energy 85.437
// #keyword; filename; number of cuts in file
// cutFile cuts/cutsSQ13Alpha.root 2
// cutSQ13Alpha21
// cutSQ13Alpha21Amp
// #channel minimum maximum
// 0 1050 1200
//\ \...
// 15 1150 1350
// #CsI2, energy ~ 26 MeV/A, Alpha
// energy 105.5
// ...
//
//asdasd
//////////////////////////////////////////////////////////////////////////////
#pragma once
//#include "TObject.h"
//#include "TROOT.h"
#include <iostream>
#include <fstream>
//#include <vector>
#include "TFile.h"
#include "TTree.h"
//#include "TCanvas.h"
#include "TH1I.h"
#include "TGraphErrors.h"
//#include "TArrayD.h"
#include "TF1.h"
#include "./AculCalib.h"
using std::cout;
using std::endl;
//using std::vector;
class AculCalibScint : public AculCalib {
private:
//
//todo delete this strange double array somewhere
TFile **fInFiles; //! doc of class member
TTree **fTrees; //!
TFile *fCutFile;
vector< vector<TH1I*> > fHistFull;
vector< vector<TH1I*> > fHistCut;
//
vector< vector<Double_t> > fMeanPeakPos; //doc of class member
vector< vector<Double_t> > fMeanPeakRMS;
//
//todo make vector of graphs
TGraphErrors *gCal[16];
// TFile *fGraphs;
public:
AculCalibScint();
//default constructor
AculCalibScint(const char* parfile);
virtual ~AculCalibScint();
ClassDef (AculCalibScint,1); //decription right after ClassDef
virtual void Init();
void PrintTrees();
//Description of the function. I think it does not work.
void DrawVariable(const char* variable, Int_t treeID, TCanvas *canvas, Int_t lowRange = 0, Int_t upRange = 4096);
//Description of the function. I think it does not work.
void DrawBeam(TCanvas *canvas, Int_t file, const char* variable);
//One of the crucial function. It founds the mean of the peak related to our particle.
void GetPeakMean(const char* variable, Int_t treeID, TCanvas *canvas,
const char* beamcut, const Int_t nbins = 4096, Int_t lowRange = 0);
void Calibrate(TCanvas *canvas, Bool_t savefile = 0, const char* filename = "", const char* option = "READ");
void WriteClbParameters(const char* filename);
TTree* GetTree(Int_t treeID);
//private functions:
// void LoadCuts();
private:
void OpenFiles();
void LoadTrees();
void SaveClbGraphs(const char* filename, const char* option = "READ");
void FillGraph(TGraphErrors *g, Int_t npoints, /*Double_t *energies,*/ Int_t graphNumber, const char* option = "");
// void SetPars();
};
/*
* AculCalibSi.cpp
*
* Created on: Oct 26, 2016
* Author: vratik
*/
#include "AculCalibSi.h"
#include "AculCalParsSi.h"
ClassImp(AculCalibSi);
AculCalibSi::AculCalibSi() {
printf("AculCalibScint::Default constructor called.\n");
// fInFiles = 0;
// fTrees = 0;
// fCutFile = 0;
}
AculCalibSi::AculCalibSi(const char* parfile) {
printf("AculCalibScint::Constructor called.\n");
SetParFile(parfile);
Init();
}
AculCalibSi::~AculCalibSi() {
printf("AculCalibScint::Destructor called.\n");
}
void AculCalibSi::Init() {
fPars = new AculCalParsSi(fParFileName.Data());
}
/*
* AculCalibSi.h
*
* Created on: Oct 26, 2016
* Author: vratik
*/
#ifndef ACULCALIB_ACULCALIBSI_H_
#define ACULCALIB_ACULCALIBSI_H_
#include "AculCalib.h"
class AculCalibSi: public AculCalib {
private:
// Double_t something;
public:
AculCalibSi();
AculCalibSi(const char* parfile);
virtual ~AculCalibSi();
ClassDef(AculCalibSi, 1);
void Init();
// Bool_t 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); //calculate calibration parameters for given block in given file
//function is not completely ready to use
//
//function for calculation of calibrate parameters for DAQ system based on "Go4"
//
// inputfile: root file with calibration spectra
// block: block name to be calibrated
// lowerchannel: minimal channel from which the spectrum will be analysed
// upperchannel: maximal channel up to which the spectrum will be analysed
// lowersubaddress: block subaddress
// uppersubaddress: block subbaddress
};
#endif /* ACULCALIB_ACULCALIBSI_H_ */
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
//#pragma link C++ class AculRaw;
//#pragma link C++ class AculConvert;
#pragma link C++ class AculCalib;
#pragma link C++ class AculCalibScint;
#pragma link C++ class AculCalibSi;
#pragma link C++ class AculCalPars;
#pragma link C++ class AculCalParsScint;
#pragma link C++ class AculCalParsScintFile;
#pragma link C++ class AculCalParsSi;
#endif
Tested with
root_6.28_04 (precompiled binaries for Ubuntu 20.04)
I. Use with GNU make I. Use with GNU make
1) set path in makefile according to your operating system 1) set path in makefile according to your operating system
......
#include "CalPars.h"
ClassImp(CalPars);
CalPars::CalPars(const char* clbfile) {
ReadParFile(clbfile);
}
CalPars::~CalPars() {
printf("CalPars::Destructor called.\n");
}
Double_t CalPars::GetA(Int_t i) {
if (i >= fA.GetSize()) {
return 0.;
}
return fA[i];
}
Double_t CalPars::GetB(Int_t i) {
if (i >= fB.GetSize()) {
return 0.;
}
return fB[i];
}
Double_t CalPars::GetC(Int_t i) {
if (i >= fC.GetSize()) {
return 0.;
}
return fC[i];
}
void CalPars::ReadParFile(const char* clbfile) {
clbFile = clbfile;
std::ifstream infile(clbfile);
if ( !infile.is_open() ) {
printf("CalPars::ReadParFile: File %s was not open.\n", clbfile);
printf("CalPars::ReadParFile: Calibration parameters are empty!!!\n");
return;
}
TString line;
Int_t nopars;
Double_t a, b;
Int_t c; //threshold
printf("CalPars::ReadParFile: File %s was open.\n", clbfile);
line.ReadLine(infile);
sscanf(line.Data(), "%*d %d", &nopars);
// Info("CalPars::ReadParFile", "%d calibration parameters will be loaded", nopars);
printf("CalPars::ReadParFile: %d calibration parameters will be loaded\n", nopars);
fA.Set(nopars);
fB.Set(nopars);
fC.Set(nopars);
for (Int_t i = 0; i <nopars; i++) {
line.ReadLine(infile);
// if ( line.BeginsWith("#") ) continue;
// cout << line.Data() << endl;
sscanf(line.Data(), "%lf %lf %d", &b, &a, &c);
fA[i] = a;
fB[i] = b;
fC[i] = c;
// printf("fA[%d]: %f,\tfB[%d]: %f\n", i, fA[i], i, fB[i]);
// printf("fA[%d]: %f,\tfB[%d]: %f\n\n", i, a, i, b);
}
}
void CalPars::PrintClbPars() {
printf("CalPars::PrintClbPars: %d calibration parameters from %s file.\n", fA.GetSize(), clbFile.Data());
for (Int_t i = 0; i<fA.GetSize(); i++) {
printf("%d\t%f\t%f\t%f\n", i, GetA(i), GetB(i), GetC(i));
}
}
#pragma once
#include <iostream>
#include <fstream>
#include "TArrayD.h"
#include "TArrayI.h"
#include "TString.h"
#include "TObject.h"
using std::cout;
using std::endl;
class CalPars /*: TObject*/ {
private:
TArrayD fA;
TArrayD fB;
TArrayI fC;
TString clbFile;
public:
CalPars() : fA(0), fB(0), fC(0) {};
CalPars(const char* clbfile);
virtual ~CalPars();
Double_t GetA(Int_t i);
Double_t GetB(Int_t i);
Double_t GetC(Int_t i);
void ReadParFile(const char* clbfile);
void PrintClbPars();
ClassDef(CalPars, 1);
};
#include "ConfigDictionary.h"
ClassImp(ConfigDictionary);
//////////////////////////////////////////////////////////////////////////////
// BEGIN_HTML
// <p><font size="4"><b>Config(uration)Dictionary class</b></font></p>
// <br>
// <i>Author: Bartlomiej Hnatio 2012-08-06</i>
// <br><br>
// This is very useful class to convert strings containing pairs "key"="value"
// into fast dictionaries. This strings are often read from external files.
// From dictionary created in such way one can easily
// extract values in few supported formats (integer, double, boolean, string)
// It can also be used in opposite direction: when dictionary is created with
// given values and keys, one can create config string, which is most
// convenient to write in external files.
// <br><br><br>
// <u>Most simple example of usage:</u>
// <br><br>Suppose you have two variables fD and fI:
// <pre>-------------------
// Double_t fD;
// Int_t fI;
//
//fD = 3.14;
//fI = 2012;
//-----------------------</pre>
// To save its parameters into file you can create ConfigDictionary class
// instance and use <b>SetDouble</b> and <b>SetInt</b> functions to
// insert parameters values with arbitrarly defined keys (let them be
// really long and descriptive in this example):
// <pre>---------------------
//ConfigDictionary CD;
//CD.SetDouble("Most important variable D",fD);
//CD.SetInt("Equally important integer I",fI);
//---------------------</pre>
// Now configuration string saved in <b>ConfigDictionary</b> CD
// can be obtained with <b>ToString</b> method and should look like:
//<pre>
//"Most important variable D"="3.14" "Equally important integer I"="2012"
//</pre>
// <br> It can be easily saved to a file using simplest <i>fstream</i>
// methods. And the advantage is that as a key one can use any string,
// so configuration file created in such way is very self-explanatory.
// <br>
// <br>
// Now lets suppose the opposite action - loading config from file.
// Imagine, that you have 1000 objects of A class, which config was saved
// to file - one object per line:
// <pre>-----------------
//"Most important variable D"="3.14" "Equally important integer I"="2012"
//"Equally important integer I"="1011" "Most important variable D"="8.15"
//"Most important variable D"="13.16" "Equally important integer I"="10"
//(...)
//----------------</pre>
// Please notice that order in which pairs of keys and values are placed
// in file doesn't make any difference to the ConfigDictionary class.
// To recreate objects, you just read each line containing single
// config string and then create with it ConfigDictionary object
// using special constructor with string as argument,
// or using <b>FromString</b> method. After this, you can
// extract parameters (using <b>GetDouble</b> and <b>GetInt</b> methods)
// with using same keys as were used for saving, and ConfigDictionary
// will return their values:
// <pre>----------------------
//string line;//This line you read from file
//ConfigDictionary CD(line);
//fD = CD.GetDouble("Most important variable D");
//fI = CD.GetInt("Equally important integer I");
//--------------------</pre>
//<br>
// And last but not least: what happens, if key requested by user doesn't
// exist in dictionary? (This can be caused by many reasons, mostly errors on
// user side, but not always).
// When you try to extract non-existent key using <b>Get</b> functions,
// an exception is risen. In normal program it should end execution and print
// some information about where program stopped working.
// But lets say that you don't want that, i.e. program may use default
// configs instead of those from files, or not all keys were that important.
// You can surround all uses of <b>Get</b> methods with try/catch clause.
// So when exception is risen, you will catch it, and decide, if you want
// the program to stop running, or anything else. Simple example is
// shown below:
//<pre>-------------------
//ConfigDictionary CD(some_string);
//try{//try to read important variables:
// double d = CD.GetDouble("crucial var");
// bool b = CD.GetBool("most important b");
// int i = CD.GetInt("unique ID");
// //...and so on
//}catch(std::string & e){//catch any kind of exception
// Error("Some crucial variable wasn't read, ending program!");
// return SOME_REALLY_BAD_ERROR_CODE;
//}
//try{//now less important, or optional:
// string name = CD.GetString("least important variable");
// double p = CD.GetDouble("optional parameter");
// //...and so on
//}catch(std::string & f){
// Info("Some optional variables wasn't read!");
//}
//--------------------</pre>
//
// ADDED 21.03.2012:
//
// With use of templates, now ConfigDictionary can handle complex objects
// reading and writing instantly as long as proper >> and << operators are
// provided for an object initialization.
//
// END_HTML
//////////////////////////////////////////////////////////////////////////////
//_____________________________________________________________________________
ConfigDictionary::ConfigDictionary(){
//Empty map...
}
//_____________________________________________________________________________
ConfigDictionary::ConfigDictionary(std::string params){
//Creates dictionary using FromString method
FromString(params);
}
//_____________________________________________________________________________
std::string ConfigDictionary::ToString(){
//Builds string that can be easily saved to file.
//Same format that can be read from files or from QtGui
//This should work same way for all uses
std::map<std::string,std::string>::iterator it;//Iterator to map elements
std::stringstream ss;//stream helpful with adding strings
//iterate whole dictionary:
for (it=configMap.begin();it!=configMap.end();++it){
//insert pairs "key"="value":
ss<<"\""<<it->first<<"\""<<"="<<"\""<<it->second<<"\""<<" ";
}
return ss.str();
}
//_____________________________________________________________________________
void ConfigDictionary::FromString(std::string params){
//params - TString containing list of key=value pairs
//
//Changes string formatted:
//"key1"="value1" "key2"="value with spaces 2" ...
//into map with keys and values
//Useful in lots of I/O functions,
//when we want to have a nice, readable format of data
std::stringstream loading(params);
std::string k,v;
while(!loading.fail()){
getline(loading,k,'\"');//removes everything to first "
getline(loading,k,'\"');//All chars between first two "" are the key
getline(loading,v,'\"');//removes all until third "
getline(loading,v,'\"');//All between another pair of "" is the value
if (!loading.fail())
configMap[k]=v;
}
}
//_____________________________________________________________________________
std::string ConfigDictionary::GetString(std::string key)throw(std::string){
//Extracts string from given key
//(if it exist, otherwise raises exception)
//This works also for long strings with white spaces in it!
if (configMap.find(key) == configMap.end()){
Error("ConfigDictionary::GetString",
"Couldn't find the key: %s!",key.c_str());
throw(key);
}
return configMap[key];
}
//_____________________________________________________________________________
int ConfigDictionary::GetInt(std::string key)throw(std::string){
//Extracts integer from given key
//(if it exist, otherwise raises exception)
return Get<int>(key);
}
//_____________________________________________________________________________
double ConfigDictionary::GetDouble(std::string key)throw(std::string){
//Extracts double precision floating number from given key
//(if it exist, otherwise raises exception)
return Get<double>(key);
}
//_____________________________________________________________________________
bool ConfigDictionary::GetBool(std::string key)throw(std::string){
//Extracts boolean from given key
//(if it exist, otherwise raises exception)
//Differs from template to make it more readable.
if (configMap.find(key) == configMap.end()){
Error("ConfigDictionary::GetBool",
"Couldn't find the key: %s!",key.c_str());
throw(key);
}
//Convert string to bool:
if (configMap[key].compare("true") == 0)
return true;
else return false;
}
//_____________________________________________________________________________
void ConfigDictionary::SetString(std::string key,std::string value){
//Sets value to key, no comments needed here...
configMap[key] = value;
}
//_____________________________________________________________________________
void ConfigDictionary::SetDouble(std::string key,double value){
Set<double>(key,value);
}
//_____________________________________________________________________________
void ConfigDictionary::SetInt(std::string key,int value){
//Sets value to key, converts int to string first
Set<int>(key,value);
}
//_____________________________________________________________________________
void ConfigDictionary::SetBool(std::string key,bool value){
//Sets value to key, converts bool to string first
//Differs from template to make it more readable.
if (value == true) configMap[key] = "true";
else configMap[key] = "false";
}
#ifndef CONFIGDICTIONARY_H
#define CONFIGDICTIONARY_H
#include "TObject.h"
#include "ReturnCodes.h"
#include "TStopwatch.h"
#include "TROOT.h"
#include <string>
#include <map>
#include <sstream>
#include <vector>
#include "TLorentzVector.h"
#include <iostream>
#include "TMath.h"
#include "TString.h"
#include "TTree.h"
#define ARRAY_DELIM '$'
class ConfigDictionary{
public:
typedef std::map<std::string,std::string>::iterator CDIter;
ConfigDictionary();
ConfigDictionary(std::string);
virtual ~ConfigDictionary(){};//empty virtual destructor
ClassDef(ConfigDictionary,1);
std::string ToString();
void FromString(std::string);
//These throw errors if couldn't find key:
//Most of methods below are just using templates to
//make them usable in Cint.
std::string GetString(std::string)throw(std::string);
int GetInt(std::string)throw(std::string);
double GetDouble(std::string)throw(std::string);
bool GetBool(std::string)throw(std::string);
//These will always set 'something' into map:
void SetString(std::string,std::string);
void SetDouble(std::string,double);
void SetInt(std::string,int);
void SetBool(std::string,bool);
CDIter Begin(){return configMap.begin();};
CDIter End(){return configMap.end();};
//_________________________________________________________________________
template <class T>
T Get(std::string key) throw (std::string) {
//This method will get object of any class
//that was - presumably - stored before in string format in CD.
//Object needs to have proper >> operator.
//If operation fails, returned item should have default value
//depending on its empty constructor.
//For strings containing spaces it won't work properly, as it
//would extract only first space followed item!
if (configMap.find(key) == configMap.end()) {
Error( "ConfigDictionary::Get",
"Couldn't find the key: %s!",
key.c_str());
throw(key);
}
std::istringstream inStream(configMap[key]);
T item;
inStream >> item;
return item;
}
//_____________________________________________________________________________
template <class T>
void Set(std::string key,T value){
//Sets value to key, converts T to string first with << operator.
std::stringstream ss;
ss<<value;
configMap[key] = ss.str();
}
//_________________________________________________________________________
template <class T>
int GetArray(std::string key,std::vector<T> & output)throw(std::string){
//Preconditions: T must have >> operator
//Effect: searches for key in map and pushes values stored in it into output vector
//Returns: number of elements pushed into vector
int retNumber = 0;
if (configMap.find(key) == configMap.end()){
Error( "ConfigDictionary::GetInt",
"Couldn't find the key: %s!",key.c_str());
throw(key);
}
std::istringstream arrayString(configMap[key]);
std::string itemString;
//Dangerous - maybe? - exceptions for ss not handled...
while (arrayString){
std::getline(arrayString,itemString,ARRAY_DELIM);
std::stringstream itemStream(itemString);
if (itemString.length() > 0){
T item;
itemStream>>item;
output.push_back(item);
retNumber++;
}
}
return retNumber;
}
//_________________________________________________________________________
template <class T>
void SetArray(std::string key,std::vector<T> & input){
std::ostringstream arrayString;
for (unsigned int i=0;i<input.size();i++){
arrayString<<input[i]<<ARRAY_DELIM;
}
configMap[key] = arrayString.str();
}
private:
std::map<std::string,std::string> configMap;
};
#endif
This diff is collapsed.
#pragma once
//#include "TObject.h"
//#include "TROOT.h"
#include <iostream>
#include <fstream>
#include "TFile.h"
#include "TTree.h"
#include "TCutG.h"
#include "TCanvas.h"
#include "TClonesArray.h"
#include "TH1I.h"
#include "TGraphErrors.h"
#include "TArrayD.h"
#include "TF1.h"
#define NOCALFILES 5
using std::cout;
using std::endl;
class CsICalib {
private:
TString detName;
TString partName;
TClonesArray fr; //TFile
// TFile *fData;
TClonesArray tr;
TClonesArray colFiles;
TClonesArray colTrees;
Int_t nofiles;
TString fileNames[100];
TString cutNames[100];
Int_t energyPoints;
TArrayD fE;
TFile *fCuts;
TString cutsFileName;
Int_t nCuts; //number of cuts
TClonesArray cutsCol;
TH1I *hfull[NOCALFILES][16]; //!
TH1I *hcut[NOCALFILES][16]; //!
Int_t peakMin[NOCALFILES][16];
Int_t peakMax[NOCALFILES][16];
Double_t mean[NOCALFILES][16];
Double_t meanRMS[NOCALFILES][16];
TGraphErrors *gCal[16];
TFile *fGraphs;
TArrayD fA;
TArrayD fB;
public:
// CsICalib() : a(0), b(0), c(0), p(0){};
CsICalib();
CsICalib(const char* parfile);
virtual ~CsICalib();
void OpenTrees();
void LoadCuts();
void ReadParFile(const char* parfile);
void PrintParameters(const char* option = "");
void PrintPeakRanges();
void DrawVariable(const char* variable, Int_t tree, TCanvas *canvas, Int_t lowRange = 0, Int_t upRange = 4096);
void DrawBeam(TCanvas *canvas, Int_t files, const char* variable);
// void DrawdEE(const char* variable, Int_t tree, TCanvas *canvas);
void DrawVariableCut(const char* variable, Int_t tree, TCanvas *canvas, const char* cut1, const char* cut2 = "", Int_t lowRange = 0);
void GetPeakMean(const char* variable, Int_t tree, Int_t energy, TCanvas *canvas, const char* beamcut, const Int_t nbins = 4096, Int_t lowRange = 0);
void Calibrate(TCanvas *canvas, Bool_t savefile = 0, const char* filename = "", const char* option = "READ");
void FillGraph(TGraphErrors *g, Int_t npoints, Double_t *energies, Int_t graphNumber, const char* option = "");
void WriteClbParameters(const char* filename);
void SaveClbGraphs(const char* filename, const char* option = "READ");
void ReadClbParameters(const char* filename);
void DrawClbGraphs(const char* filename, const char* graphname, TCanvas *canvas);
void DrawEnergyDeposite(const char* variable, TCanvas *canvas, Int_t tree, const char* option = "");
void PrintTrees();
void PrintFiles();
void PrintCuts();
Double_t GetA(Int_t i) {return fA[i];};
Double_t GetB(Int_t i) {return fB[i];};
// Define the class for the cint dictionary
ClassDef (CsICalib,1);
};
#ifndef RETURN_CODES_H
#define RETURN_CODES_H
//Some useful return codes
const static int SUCCESS = 0;
const static int IOEXCEPTION = -1;
const static int NOTFOUND = -2;
const static int NULLPOINTER = -3;
const static int UNKNOWN = -4;
const static int FAILURE = -5;
const static int CDEXCEPTION = -6;
const static int EMPTYCONTAINER = -7;
const static int NOTDEFINED = -8;
const static int EXCEPTION = -11;
#endif
################################################################################
# AculData input with some variables
################################################################################
# UTILITIESLIBS := -lCore -lCint -lRIO -lTree -lNet -lThread -lHist -lMatrix -lMathCore -lGpad -lGraf
UTILITIESLIBS := -lCore -lRIO -lTree -lNet -lThread -lHist -lMatrix -lMathCore -lGpad -lGraf
#UTILITIESLIBS := -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic
# Add inputs and outputs from these tool invocations to the build variables
UTILITIES_HEADERS += \
$(UTILITIES)/CalPars.h \
$(UTILITIES)/CsICalib.h \
$(UTILITIES)/ConfigDictionary.h \
$(UTILITIES)/linkdef.h
UTILITIESCPP_SRCS += \
$(UTILITIES)/CalPars.cpp \
$(UTILITIES)/CsICalib.cpp \
$(UTILITIES)/ConfigDictionary.cpp \
$(UTILITIES)/UtilitiesDict.cpp
UTILITIESOBJS += \
$(UTILITIES)/CalPars.o \
$(UTILITIES)/CsICalib.o \
$(UTILITIES)/ConfigDictionary.o \
$(UTILITIES)/UtilitiesDict.o
UTILITIESCPP_DEPS += \
$(UTILITIES)/CalPars.d \
$(UTILITIES)/CsICalib.d \
$(UTILITIES)/ConfigDictionary.d \
$(UTILITIES)/UtilitiesDict.d
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class CalPars;
#pragma link C++ class CsICalib;
#pragma link C++ class ConfigDictionary;
#endif
#include "THtml.h"
void htmldoc()
{ {
gSystem->Load("./libAculData.so");
gSystem->Load("./libTELoss.so"); gSystem->Load("./libTELoss.so");
gSystem->Load("./libAculCalib.so");
gSystem->Load("./libAculData.so");
THtml h; THtml h;
h.SetInputDir("."); h.SetInputDir(".");
h.SetOutputDir("htmldoc");
h.SetProductName("AculUtils");
h.MakeAll(); h.MakeAll();
......
...@@ -33,8 +33,14 @@ ...@@ -33,8 +33,14 @@
// cal.DrawBeam(myCanv, 4, "SQ13"); // cal.DrawBeam(myCanv, 4, "SQ13");
//return; //return;
// <<<<<<< HEAD
// cal.DrawVariableCut("SQ13", 0, c2, "cutsSQ13Alpha16"); // cal.DrawVariableCut("SQ13", 0, c2, "cutsSQ13Alpha16");
// cal.DrawVariableCut("SQ13", 0, c2, "cutsSQ13Alpha16", "cutSQ13Alpha16Amp"); // cal.DrawVariableCut("SQ13", 0, c2, "cutsSQ13Alpha16", "cutSQ13Alpha16Amp");
// =======
cal.DrawVariableCut("SQ13", 0, c1, "cutsSQ13Alpha16");
return;
cal.DrawVariableCut("SQ13", 0, c1, "cutsSQ13Alpha16", "cutSQ13Alpha16Amp");
// >>>>>>> newArch
//return; //return;
// cal.DrawVariableCut("SQ13", 1, c2, "cutSQ13Alpha21", "cutSQ13Alpha21Amp"); // cal.DrawVariableCut("SQ13", 1, c2, "cutSQ13Alpha21", "cutSQ13Alpha21Amp");
// cal.DrawVariableCut("SQ13", 2, c3, "cutSQ13Alpha26", "cutSQ13Alpha26Amp"); // cal.DrawVariableCut("SQ13", 2, c3, "cutSQ13Alpha26", "cutSQ13Alpha26Amp");
......
energies 4 #number of energy points
crystals 16 #number of crystals in detector
files 4
#fileID fileName
#fileID not implemented yet
data/csi_13_Ealpha16.root
data/csi_13_Ealpha21.root
data/csi_13_Ealpha26.root
data/csi_13_Ealpha30.root
#keyword detector particle
detector SQ13 Alpha
#keyword energy [MeV/A]
energy 66.542
#keyword; filename; number of cuts in file
cutFile cuts/cutsSQ13Alpha.root 2
cutsSQ13Alpha16
cutSQ13Alpha16Amp
#channel minimum maximum
0 650 830
1 920 1150
2 850 1000
3 1200 1400
4 960 1100
5 700 850
6 650 800
7 1040 1240
8 850 1050
9 650 850
10 950 1200
11 900 1100
12 740 860
13 1140 1380
14 420 500
15 800 1000
#CsI2, energy ~ 21 MeV/A, Alpha
energy 85.437
#keyword; filename; number of cuts in file
cutFile cuts/cutsSQ13Alpha.root 2
cutSQ13Alpha21
cutSQ13Alpha21Amp
#channel minimum maximum
0 1050 1200
1 1350 1550
2 1190 1400
3 1650 1950
4 1300 1500
5 950 1100
6 900 1050
7 1450 1700
8 1150 1400
9 900 1100
10 1350 1600
11 1250 1500
12 950 1200
13 1600 1860
14 550 640
15 1150 1350
#CsI2, energy ~ 26 MeV/A, Alpha
energy 105.5
#keyword; filename; number of cuts in file
cutFile cuts/cutsSQ13Alpha.root 2
cutSQ13Alpha26
cutSQ13Alpha26Amp
#channel minimum maximum
0 1300 1600
1 1750 2050
2 1560 1800
3 2250 2500
4 1720 2000
5 1200 1450
6 1160 1400
7 1800 2200
8 1600 1850
9 1200 1400
10 1750 2100
11 1650 1900
12 1250 1600
13 2150 2450
14 690 900
15 1500 1700
#CsI2, energy ~ 30 MeV/A, Alpha
energy 119.54
#keyword; filename; number of cuts in file
cutFile cuts/cutsSQ13Alpha.root 2
cutSQ13Alpha30
cutSQ13Alpha30Amp
#channel minimum maximum
0 1450 1750
1 2200 2450
2 1900 2150
3 2590 3000
4 2100 2350
5 1500 1650
6 1400 1600
7 2250 2550
8 1900 2150
9 1400 1600
10 2050 2600
11 1950 2200
12 1580 1710
13 2550 2900
14 1100 1250
15 1800 2000
\ No newline at end of file
../calibration_CsI/cuts/
\ No newline at end of file
../calibration_CsI/data/
\ No newline at end of file
//#include "../../AculCalib/AculCalPars.h"
//#include "../../AculCalib/AculCalibScint.h"
//#include "../../AculCalib/AculCalibSi.h"
//#include "TSystem.h"
//#include <iostream>
//
using std::cout;
using std::endl;
void parTest()
{
gSystem->Load("../../libTELoss.so");
gSystem->Load("../../libAculCalib.so");
/* AculCalibSi ps;
ps.SetParFile("parforcal.par");
ps.Init();
ps.PrintParameters();
return;
*/
// 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("");
p.PrintParameters("all");
// return;
p.Reset();
// p.PrintParameters("");
// return;
cout << "-----------------------" << endl;
AculCalibScint c;
c.SetParFile("SQ13Alpha.par");
c.Init();
c.PrintParameters();
// return;
// c.PrintParameters("all");
// c.OpenFiles();
// c.LoadTrees();
c.PrintTrees();
TCanvas *c1 = new TCanvas("c1", "Plain");
TCanvas *c2 = new TCanvas("c2", "Plain");
TCanvas *c3 = new TCanvas("c3", "Plain");
TCanvas *c4 = new TCanvas("c4", "Plain");
// c.DrawVariable("SQ13", 2, c1);
// c.DrawBeam(c1, 4, "SQ13");
// c.GetPeakMean("SQ13", 0, c1, "cutSQ13Alpha16Amp", 256);
c.GetPeakMean("SQ13", 0, c1, "cutSQ13Ala16Amp", 256);
c.GetPeakMean("SQ13", 1, c2, "cutSQ13Alpha21Amp", 256);
c.GetPeakMean("SQ13", 2, c3, "cutSQ13Alpha26Amp", 256);
c.GetPeakMean("SQ13", 3, c4, "cutSQ13Alpha30Amp", 256);
//return;
// c.PrintFiles();
// c.PrintCuts();
// TCanvas *c1 = new TCanvas("c1", "Plain");
// c.GetPeakMean("SQ13", 0, 0, c1, "cutSQ13Alpha16Amp", 256);
TCanvas *cCal = new TCanvas("cCal", "calibration Alpha");
c.Calibrate(cCal);
return;
}
...@@ -25,25 +25,41 @@ ROOTCFLAGS = $(shell root-config --cflags) ...@@ -25,25 +25,41 @@ ROOTCFLAGS = $(shell root-config --cflags)
PWD = $(shell pwd) PWD = $(shell pwd)
#INSTALLFOLDER = $(HOME)/AculLib #INSTALLFOLDER = $(HOME)/AculLib
UTILITIES = $(PWD)/Utilities
ACULDATA = $(PWD)/AculData ACULDATA = $(PWD)/AculData
ACULCALIB = $(PWD)/AculCalib
TELOSS = $(PWD)/TELoss TELOSS = $(PWD)/TELoss
-include $(UTILITIES)/Utilities.mk
-include $(ACULDATA)/AculData.mk -include $(ACULDATA)/AculData.mk
-include $(ACULCALIB)/AculCalib.mk
-include $(TELOSS)/TELoss.mk -include $(TELOSS)/TELoss.mk
all: libAculData.so \ all: libUtilities.so \
libAculData.so \
libAculCalib.so \
libTELoss.so libTELoss.so
#ROOT html documentation, it will be done as a program which will be alsa compiled by this makefile, program will be as a last condition after all of the libraries #ROOT html documentation, it will be done as a program which will be alsa compiled by this makefile, program will be as a last condition after all of the libraries
htmldoc: libAculData.so htmldoc: libAculData.so libAculCalib.so libTELoss.so
-$(RM) htmldoc -$(RM) htmldoc
root -l -q html.cxx root -l -q htmldoc.cxx
clean_htmldoc:
-$(RM) htmldoc
-@echo ' '
clean: clean:
-$(RM) $(UTILITIESOBJS) $(UTILITIESCPP_DEPS)
-$(RM) $(UTILITIES)/UtilitiesDict.* libUtilities.so
-@echo ' '
-$(RM) $(ACULDATAOBJS) $(ACULDATACPP_DEPS) -$(RM) $(ACULDATAOBJS) $(ACULDATACPP_DEPS)
-$(RM) $(ACULDATA)/AculDataDict.* *.pcm $(ACULDATA)/*.pcm -$(RM) $(ACULDATA)/AculDataDict.* *.pcm $(ACULDATA)/*.pcm
-$(RM) libAculData.so -$(RM) libAculData.so
-@echo ' ' -@echo ' '
-$(RM) $(ACULCALIBOBJS) $(ACULCALIBCPP_DEPS)
-$(RM) $(ACULCALIB)/AculCalibDict.* libAculCalib.so
-@echo ' '
-$(RM) $(TELOSSOBJS) $(TELOSSCPP_DEPS) -$(RM) $(TELOSSOBJS) $(TELOSSCPP_DEPS)
-$(RM) $(TELOSS)/TELossDict.* *.pcm $(TELOSS)/*.pcm -$(RM) $(TELOSS)/TELossDict.* *.pcm $(TELOSS)/*.pcm
-$(RM) libTELoss.so -$(RM) libTELoss.so
...@@ -51,7 +67,15 @@ clean: ...@@ -51,7 +67,15 @@ clean:
-$(RM) htmldoc -$(RM) htmldoc
-@echo ' ' -@echo ' '
# <<<<<<< HEAD
# Those *Dictionary* files below need special treating: # Those *Dictionary* files below need special treating:
$(UTILITIES)/UtilitiesDict.cpp:
-@echo 'Pre-building UtilitiesDict.cpp and UtilitiesDict.h files'
-rootcling -f $(UTILITIES)/UtilitiesDict.cpp -p $(UTILITIES_HEADERS)
-@echo 'Creating: link to UtilitiesDict_rdict.pcm'
-ln -s $(UTILITIES)/UtilitiesDict_rdict.pcm .
-@echo ' '
$(ACULDATA)/AculDataDict.cpp: $(ACULDATA)/AculDataDict.cpp:
-@echo 'Pre-building AculDataDict.cpp and AculDataCint.h files' -@echo 'Pre-building AculDataDict.cpp and AculDataCint.h files'
-rootcling -f $(ACULDATA)/AculDataDict.cpp -p $(ACULDATA_HEADERS) -rootcling -f $(ACULDATA)/AculDataDict.cpp -p $(ACULDATA_HEADERS)
...@@ -59,6 +83,13 @@ $(ACULDATA)/AculDataDict.cpp: ...@@ -59,6 +83,13 @@ $(ACULDATA)/AculDataDict.cpp:
-ln -s $(ACULDATA)/AculDataDict_rdict.pcm . -ln -s $(ACULDATA)/AculDataDict_rdict.pcm .
-@echo ' ' -@echo ' '
$(ACULCALIB)/AculCalibDict.cpp:
-@echo 'Pre-building AculCalibDict.cpp and AculCalibDict.h files'
-rootcling -f $(ACULCALIB)/AculCalibDict.cpp -p $(ACULCALIB_HEADERS)
-@echo 'Creating: link to AculCalibDict_rdict.pcm'
-ln -s $(ACULDATA)/AculCalibDict_rdict.pcm .
-@echo ' '
$(TELOSS)/TELossDict.cpp: $(TELOSS)/TELossDict.cpp:
-@echo 'Pre-building TELossDict.cpp and TELossDict_rdict.pcm files' -@echo 'Pre-building TELossDict.cpp and TELossDict_rdict.pcm files'
@echo @echo
...@@ -67,7 +98,36 @@ $(TELOSS)/TELossDict.cpp: ...@@ -67,7 +98,36 @@ $(TELOSS)/TELossDict.cpp:
-ln -s $(TELOSS)/TELossDict_rdict.pcm . -ln -s $(TELOSS)/TELossDict_rdict.pcm .
-@echo ' ' -@echo ' '
# =======
# Those *Cint* files below need special treating:
# $(UTILITIES)/UtilitiesDict.cpp:
# -@echo 'Pre-building UtilitiesDict.cpp and UtilitiesDict.h files'
# -rootcint -f $(UTILITIES)/UtilitiesDict.cpp -c -p $(UTILITIES_HEADERS)
# -@echo ' '
# $(ACULDATA)/AculDataCint.cpp:
# -@echo 'Pre-building AculDataCint.cpp and AculDataCint.h files'
# -rootcint -f $(ACULDATA)/AculDataCint.cpp -c -p $(ACULDATA_HEADERS)
# -@echo ' '
# $(ACULCALIB)/AculCalibDict.cpp:
# -@echo 'Pre-building AculCalibDict.cpp and AculCalibDict.h files'
# -rootcint -f $(ACULCALIB)/AculCalibDict.cpp -c -p $(ACULCALIB_HEADERS)
# -@echo ' '
# $(TELOSS)/TELossCint.cpp:
# -@echo 'Pre-building TELossCint.cpp and TELossCint.h files'
# -rootcint -f $(TELOSS)/TELossCint.cpp -c -p $(TELOSS)/TELoss.h $(TELOSS)/linkdef.h
# >>>>>>> newArch
#*.so files #*.so files
libUtilities.so: $(UTILITIESOBJS)
@echo 'Building target: $@'
@echo 'Invoking: $(CC) Linker'
$(CC) -L $(ROOTLIBS) -shared -o"libUtilities.so" $(UTILITIESOBJS) $(UTILITIESLIBS)
@echo 'Finished building target: $@'
@echo ' '
libAculData.so: libTELoss.so $(ACULDATAOBJS) libAculData.so: libTELoss.so $(ACULDATAOBJS)
@echo 'Building target: $@' @echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker' @echo 'Invoking: GCC C++ Linker'
...@@ -75,6 +135,13 @@ libAculData.so: libTELoss.so $(ACULDATAOBJS) ...@@ -75,6 +135,13 @@ libAculData.so: libTELoss.so $(ACULDATAOBJS)
@echo 'Finished building target: $@' @echo 'Finished building target: $@'
@echo ' ' @echo ' '
libAculCalib.so: libTELoss.so $(ACULCALIBOBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
$(CC) -L . -L $(ROOTLIBS) -shared -o"libAculCalib.so" $(ACULCALIBOBJS) $(ACULCALIBLIBS)
@echo 'Finished building target: $@'
@echo ' '
libTELoss.so: $(TELOSSOBJS) libTELoss.so: $(TELOSSOBJS)
@echo 'Building target: $@' @echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker' @echo 'Invoking: GCC C++ Linker'
......
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