Commit 8bd7b5f0 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Probably all functionality of CsI calibration works in newArch.

parent 33892834
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "TString.h" #include "TString.h"
#include "TArrayD.h" #include "TArrayD.h"
#include "TArrayI.h" #include "TArrayI.h"
#include "TCutG.h"
//todo ommit this constant //todo ommit this constant
#define NOCALFILES 5 #define NOCALFILES 5
...@@ -58,17 +59,20 @@ public: ...@@ -58,17 +59,20 @@ public:
//getters //getters
const char* GetParFileName() {return fParFileName.Data();} const char* GetParFileName() {return fParFileName.Data();}
// Int_t GetNoCrystals() {return fNoCrystals;} // Int_t GetNoCrystals() {return fNoCrystals;}
// const char* GetDetName() {return fDetName.Data();} virtual const char* GetDetName() {return 0;}
// const char* GetParticleName() {return fPartName.Data();} 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); // const char* GetCutName(Int_t i);
// Int_t GetNoEPoints() {return fEnergyPoints;} virtual Int_t GetNoEPoints() {return 0;}
// Double_t GetCalEnergy(Int_t i); virtual Double_t GetCalEnergy(Int_t i) {return 0.;};
virtual const char* GetCutsFileName() {return 0;} virtual const char* GetCutsFileName() {return 0;}
Int_t GetNoCuts() {return 0;} virtual Int_t GetNoCuts() {return 0;}
// Int_t GetMinChannel(Int_t energy, Int_t crystal); virtual TCutG* GetCut(Int_t i) {return 0;};
// Int_t GetMaxChannel(Int_t energy, Int_t crystal); 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;};
void SetParFileName(const char* parFile) {fParFileName = parFile;} void SetParFileName(const char* parFile) {fParFileName = parFile;}
......
...@@ -204,6 +204,32 @@ const char* AculCalParsScint::GetCutName(Int_t i) { ...@@ -204,6 +204,32 @@ const char* AculCalParsScint::GetCutName(Int_t i) {
return fCutName[i].Data(); 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) {
// 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++) {
if (cName.EqualTo(fCutName[i])) { return &fCuts[i]; }
}
cerr << "\"AculCalParsScint::GetCut\" cut \"" << cutName << "\" was not found." << endl;
return 0;
}
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)fE.size()-1 ) {
...@@ -262,9 +288,12 @@ void AculCalParsScint::LoadCuts() { ...@@ -262,9 +288,12 @@ void AculCalParsScint::LoadCuts() {
for (Int_t i = 0; i < (Int_t)fCutName.size(); i++) { for (Int_t i = 0; i < (Int_t)fCutName.size(); i++) {
TCutG *currentCut = (TCutG*)cutFile.Get(fCutName[i]); TCutG *currentCut = (TCutG*)cutFile.Get(fCutName[i]);
if (currentCut) { if (!currentCut) {
fCuts.push_back(*currentCut); cout << "\"AculCalParsScint::LoadCuts\" Cut \"" << fCutName[i]
<< "\" was not found in file " << fCutsFileName << "." << endl;
continue;
} }
fCuts.push_back(*currentCut);
} }
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#define ACULCALIB_ACULCALPARSSCINT_H_ #define ACULCALIB_ACULCALPARSSCINT_H_
#include "AculCalPars.h" #include "AculCalPars.h"
#include "TCutG.h" //#include "TCutG.h"
using std::cerr; using std::cerr;
...@@ -60,6 +60,8 @@ public: ...@@ -60,6 +60,8 @@ public:
Double_t GetCalEnergy(Int_t i); Double_t GetCalEnergy(Int_t i);
const char* GetCutsFileName() {return fCutsFileName.Data();} const char* GetCutsFileName() {return fCutsFileName.Data();}
Int_t GetNoCuts() {return fNoCuts;} Int_t GetNoCuts() {return fNoCuts;}
TCutG* GetCut(Int_t i);
TCutG* GetCut(const char* cutName);
Int_t GetMinChannel(Int_t energy, Int_t crystal); Int_t GetMinChannel(Int_t energy, Int_t crystal);
Int_t GetMaxChannel(Int_t energy, Int_t crystal); Int_t GetMaxChannel(Int_t energy, Int_t crystal);
......
...@@ -68,3 +68,18 @@ Double_t AculCalib::GetB(Int_t i) { ...@@ -68,3 +68,18 @@ Double_t AculCalib::GetB(Int_t i) {
} }
return fB[i]; 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;
}
}
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "TArrayD.h" #include "TArrayD.h"
#include "TString.h" #include "TString.h"
#include "TCanvas.h"
#include "./AculCalPars.h" #include "./AculCalPars.h"
...@@ -45,6 +46,7 @@ public: ...@@ -45,6 +46,7 @@ public:
protected: protected:
//essential //essential
void CanDivider(TCanvas *c, Int_t noPads, Int_t columns = 0, Int_t rows = 0);
}; };
......
This diff is collapsed.
...@@ -4,19 +4,21 @@ ...@@ -4,19 +4,21 @@
//#include "TROOT.h" //#include "TROOT.h"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
//#include <vector>
#include "TFile.h" #include "TFile.h"
#include "TTree.h" #include "TTree.h"
#include "TCanvas.h" //#include "TCanvas.h"
//#include "TH1I.h" #include "TH1I.h"
//#include "TGraphErrors.h" #include "TGraphErrors.h"
//#include "TArrayD.h" //#include "TArrayD.h"
//#include "TF1.h" #include "TF1.h"
#include "./AculCalib.h" #include "./AculCalib.h"
using std::cout; using std::cout;
using std::endl; using std::endl;
//using std::vector;
class AculCalibScint : public AculCalib { class AculCalibScint : public AculCalib {
...@@ -29,13 +31,18 @@ private: ...@@ -29,13 +31,18 @@ private:
TFile *fCutFile; TFile *fCutFile;
// TClonesArray cutsCol; // TClonesArray cutsCol;
// //
// TH1I *hfull[NOCALFILES][16]; // TH1I *fHistFull[NOCALFILES][16];
// TH1I *hcut[NOCALFILES][16]; vector< vector<TH1I*> > fHistFull;
// TH1I *fHistCut[NOCALFILES][16];
vector< vector<TH1I*> > fHistCut;
// //
// Double_t mean[NOCALFILES][16]; // Double_t fMeanPeakPos[NOCALFILES][16];
// Double_t meanRMS[NOCALFILES][16]; vector< vector<Double_t> > fMeanPeakPos;
// Double_t fMeanPeakRMS[NOCALFILES][16];
vector< vector<Double_t> > fMeanPeakRMS;
// //
// TGraphErrors *gCal[16]; //todo make vector of graphs
TGraphErrors *gCal[16];
// TFile *fGraphs; // TFile *fGraphs;
public: public:
...@@ -54,10 +61,15 @@ public: ...@@ -54,10 +61,15 @@ public:
// void PrintParameters(const char* option = ""); // void PrintParameters(const char* option = "");
// void PrintPeakRanges(); // void PrintPeakRanges();
void DrawVariable(const char* variable, Int_t tree, TCanvas *canvas, Int_t lowRange = 0, Int_t upRange = 4096); void DrawVariable(const char* variable, Int_t treeID, TCanvas *canvas, Int_t lowRange = 0, Int_t upRange = 4096);
// void DrawBeam(TCanvas *canvas, Int_t files, const char* variable); void DrawBeam(TCanvas *canvas, Int_t file, 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 treeID, 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 WriteClbParameters(const char* filename);
TTree* GetTree(Int_t treeID);
//private functions: //private functions:
// void LoadCuts(); // void LoadCuts();
...@@ -65,5 +77,10 @@ public: ...@@ -65,5 +77,10 @@ public:
private: private:
void OpenFiles(); void OpenFiles();
void LoadTrees(); 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(); // void SetPars();
}; };
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
// cal.DrawBeam(c4, 4, "SQ13"); // cal.DrawBeam(c4, 4, "SQ13");
//return; //return;
// cal.DrawVariableCut("SQ13", 0, c1, "cutsSQ13Alpha16"); // cal.DrawVariableCut("SQ13", 0, c1, "cutsSQ13Alpha16");
// return;
// cal.DrawVariableCut("SQ13", 0, c1, "cutsSQ13Alpha16", "cutSQ13Alpha16Amp"); // cal.DrawVariableCut("SQ13", 0, c1, "cutsSQ13Alpha16", "cutSQ13Alpha16Amp");
//return; //return;
// cal.DrawVariableCut("SQ13", 1, c2, "cutSQ13Alpha21", "cutSQ13Alpha21Amp"); // cal.DrawVariableCut("SQ13", 1, c2, "cutSQ13Alpha21", "cutSQ13Alpha21Amp");
......
//#include "../../AculCalib/AculCalPars.h" //#include "../../AculCalib/AculCalPars.h"
//#include "../../AculCalib/AculCalibScint.h"
//#include "TSystem.h"
void parTest() void parTest()
{ {
...@@ -19,16 +21,27 @@ void parTest() ...@@ -19,16 +21,27 @@ void parTest()
// c.LoadTrees(); // c.LoadTrees();
c.PrintTrees(); c.PrintTrees();
// c.DrawVariable(.........) 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, 0, c1, "cutSQ13Alpha16Amp", 256);
c.GetPeakMean("SQ13", 1, 1, c2, "cutSQ13Alpha21Amp", 256);
c.GetPeakMean("SQ13", 2, 2, c3, "cutSQ13Alpha26Amp", 256);
c.GetPeakMean("SQ13", 3, 3, c4, "cutSQ13Alpha30Amp", 256);
//return;
// c.PrintFiles(); // c.PrintFiles();
// c.PrintCuts(); // c.PrintCuts();
// TCanvas *c1 = new TCanvas("c1", "Plain"); // TCanvas *c1 = new TCanvas("c1", "Plain");
// c.GetPeakMean("SQ13", 0, 0, c1, "cutSQ13Alpha16Amp", 256); // c.GetPeakMean("SQ13", 0, 0, c1, "cutSQ13Alpha16Amp", 256);
// TCanvas *cCal = new TCanvas("cCal", "calibration Alpha"); TCanvas *cCal = new TCanvas("cCal", "calibration Alpha");
// cal.Calibrate(cCal); c.Calibrate(cCal);
return; return;
} }
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