Commit 21729c50 authored by Kostyleva D.A's avatar Kostyleva D.A

Merge branch 'master' of http://er.jinr.ru/AculUtils

parents f2af59b6 952ba2be
This diff is collapsed.
...@@ -75,12 +75,14 @@ public: ...@@ -75,12 +75,14 @@ public:
Double_t fFitMinSigma; //pouziva se, 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 fFitPeakThreshold; //pouziva se, private, prozkoumat, k cemu vlastne slouzi ve fci ShowPeaks, popremyslet o vhodnem prednastaveni v konstruktoru
//tyto promenne jsou smyslem tridy, mely by tedy byt snad jako jedine verejne //these variables are the main for the class
Double_t fA[BLOCKSNUMBER][ADDRESSNUMBER]; //kalibracni parametry, f(x) = fA*x + fB Double_t fAOld[BLOCKSNUMBER][ADDRESSNUMBER]; //calibration parameter, f(x) = fAOld*x + fBOld
Double_t fB[BLOCKSNUMBER][ADDRESSNUMBER]; //kalibracni parametry, f(x) = fA*x + fB Double_t fBOld[BLOCKSNUMBER][ADDRESSNUMBER]; //calibration parameter, f(x) = fAOld*x + fBOld
Double_t fC[BLOCKSNUMBER][ADDRESSNUMBER]; //treti kalibracni parametr, jine zavislosti nez pol1 Double_t fC[BLOCKSNUMBER][ADDRESSNUMBER]; //treti kalibracni parametr, jine zavislosti nez pol1
Double_t fD[BLOCKSNUMBER][ADDRESSNUMBER]; //ctvrty kalibracni parametr Double_t fD[BLOCKSNUMBER][ADDRESSNUMBER]; //ctvrty kalibracni parametr
TArrayD fA;
TArrayD fB;
...@@ -126,7 +128,7 @@ public: ...@@ -126,7 +128,7 @@ public:
Bool_t SetCalibrationParameters(const char* calparfile); Bool_t SetCalibrationParameters(const char* calparfile);
//Loads the file with calibration parameters //Loads the file with calibration parameters
// //
// calparfile: file containing calibration parameters in format: crate number, address, subaddress, fA, fB, fC, fD // calparfile: file containing calibration parameters in format: crate number, address, subaddress, fAOld, fBOld, fC, fD
// //
// allowed comment characters: *, #, %, // // allowed comment characters: *, #, %, //
...@@ -134,7 +136,7 @@ public: ...@@ -134,7 +136,7 @@ public:
//I hope this is selfunderstanding function //I hope this is selfunderstanding function
void PrintCalibrationParameters(const Int_t blockmin = 1, const Int_t blockmax = BLOCKSNUMBER - 1); void PrintCalibrationParameters(const Int_t blockmin = 1, const Int_t blockmax = BLOCKSNUMBER - 1);
//Print calibration parameters fA, fB, fC, fD which are currently saved in object AculCalibration //Print calibration parameters fAOld, fBOld, fC, fD which are currently saved in object AculCalibration
// //
// blockmin: minimum block data are displayed for // blockmin: minimum block data are displayed for
// blockmax: maximum block data are displayed for // blockmax: maximum block data are displayed for
...@@ -154,6 +156,23 @@ public: ...@@ -154,6 +156,23 @@ public:
// lowersubaddress: block subaddress // lowersubaddress: block subaddress
// uppersubaddress: block subbaddress // uppersubaddress: block subbaddress
void CalibrateRawSpectra();
UShort_t SomeFunction(UShort_t x, int len);
template<typename T> T SomeFunction(T x, int len)
{
/*T max = x[0];
for(int i = 1; i < len; i++)
if(max < x[i])
max = x[i];*/
// return max;
return x;
}
void CalibrateRawSpectra(const char* inputfile, const char* block, const Int_t address, const char* treename, Int_t lowerchannel = 0, Int_t upperchannel = 4095, Int_t nEBins = 1000, Int_t lowersubaddress = 0, Int_t uppersubaddress = ADDRESSNUMBER-1); void CalibrateRawSpectra(const char* inputfile, const char* block, const Int_t address, const char* treename, Int_t lowerchannel = 0, Int_t upperchannel = 4095, Int_t nEBins = 1000, Int_t lowersubaddress = 0, Int_t uppersubaddress = ADDRESSNUMBER-1);
// Bool_t EnergyPositions(const char* inputfile, const char* block, // Bool_t EnergyPositions(const char* inputfile, const char* block,
......
#define AnalysisxTree_cxx
#include "AnalysisxTree.h"
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
void AnalysisxTree::Loop()
{
// In a ROOT session, you can do:
// Root > .L AnalysisxTree.C
// Root > AnalysisxTree t
// Root > t.GetEntry(12); // Fill t data members with entry number 12
// Root > t.Show(); // Show values of entry 12
// Root > t.Show(16); // Read and show values of entry 16
// Root > t.Loop(); // Loop on all entries
//
// This is the loop skeleton where:
// jentry is the global entry number in the chain
// ientry is the entry number in the current Tree
// Note that the argument to GetEntry must be:
// jentry for TChain::GetEntry
// ientry for TTree::GetEntry and TBranch::GetEntry
//
// To read only selected branches, Insert statements like:
// METHOD1:
// fChain->SetBranchStatus("*",0); // disable all branches
// fChain->SetBranchStatus("branchname",1); // activate branchname
// METHOD2: replace line
// fChain->GetEntry(jentry); //read all branches
//by b_branchname->GetEntry(ientry); //read only this branch
if (fChain == 0) return;
Long64_t nentries = fChain->GetEntriesFast();
Long64_t nbytes = 0, nb = 0;
for (Long64_t jentry=0; jentry<nentries;jentry++) {
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;
// if (Cut(ientry) < 0) continue;
}
}
//////////////////////////////////////////////////////////
// This class has been automatically generated on
// Mon Oct 3 10:53:30 2016 by ROOT version 5.34/30
// from TTree AnalysisxTree/Go4FileStore
// found on file: clb01_0001.root
//////////////////////////////////////////////////////////
#ifndef AnalysisxTree_h
#define AnalysisxTree_h
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
// Header file for the classes stored in the TTree if any.
// Fixed size dimensions of array or collections stored in the TTree if any.
const Int_t kMaxLiEvent = 1;
class AnalysisxTree {
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
Int_t fCurrent; //!current Tree number in a TChain
// Declaration of leaf types
//TLiEvent *LiEvent_;
//TLiEvent *LiEvent_TGo4EventElement;
UShort_t LiEvent_SQ11[16];
UShort_t LiEvent_SQ12[32];
UShort_t LiEvent_SQ13[16];
UShort_t LiEvent_SQ21[16];
UShort_t LiEvent_SQ22[32];
UShort_t LiEvent_SQ23[16];
UShort_t LiEvent_ANR[16];
UShort_t LiEvent_ANS[16];
UShort_t LiEvent_ANC[32];
UShort_t LiEvent_TSQ11[16];
UShort_t LiEvent_TSQ12[32];
UShort_t LiEvent_TSQ21[16];
UShort_t LiEvent_TSQ22[32];
UShort_t LiEvent_TANR[16];
UShort_t LiEvent_TANS[16];
UShort_t LiEvent_QDC[16];
UShort_t LiEvent_TDC[16];
UShort_t LiEvent_SCR[16];
UShort_t LiEvent_nx1;
UShort_t LiEvent_ny1;
UShort_t LiEvent_nx2;
UShort_t LiEvent_ny2;
UShort_t LiEvent_x1[32];
UShort_t LiEvent_y1[32];
UShort_t LiEvent_x2[32];
UShort_t LiEvent_y2[32];
UShort_t LiEvent_adc1[16];
UShort_t LiEvent_adc2[16];
UShort_t LiEvent_adc3[16];
UShort_t LiEvent_adc4[16];
UShort_t LiEvent_tdc1[32];
UShort_t LiEvent_tdc2[32];
UInt_t LiEvent_time;
Int_t LiEvent_nevent;
Int_t LiEvent_trigger;
Int_t LiEvent_subevents;
Int_t LiEvent_evsize;
// List of branches
TBranch *b_LiEvent_SQ11; //!
TBranch *b_LiEvent_SQ12; //!
TBranch *b_LiEvent_SQ13; //!
TBranch *b_LiEvent_SQ21; //!
TBranch *b_LiEvent_SQ22; //!
TBranch *b_LiEvent_SQ23; //!
TBranch *b_LiEvent_ANR; //!
TBranch *b_LiEvent_ANS; //!
TBranch *b_LiEvent_ANC; //!
TBranch *b_LiEvent_TSQ11; //!
TBranch *b_LiEvent_TSQ12; //!
TBranch *b_LiEvent_TSQ21; //!
TBranch *b_LiEvent_TSQ22; //!
TBranch *b_LiEvent_TANR; //!
TBranch *b_LiEvent_TANS; //!
TBranch *b_LiEvent_QDC; //!
TBranch *b_LiEvent_TDC; //!
TBranch *b_LiEvent_SCR; //!
TBranch *b_LiEvent_nx1; //!
TBranch *b_LiEvent_ny1; //!
TBranch *b_LiEvent_nx2; //!
TBranch *b_LiEvent_ny2; //!
TBranch *b_LiEvent_x1; //!
TBranch *b_LiEvent_y1; //!
TBranch *b_LiEvent_x2; //!
TBranch *b_LiEvent_y2; //!
TBranch *b_LiEvent_adc1; //!
TBranch *b_LiEvent_adc2; //!
TBranch *b_LiEvent_adc3; //!
TBranch *b_LiEvent_adc4; //!
TBranch *b_LiEvent_tdc1; //!
TBranch *b_LiEvent_tdc2; //!
TBranch *b_LiEvent_time; //!
TBranch *b_LiEvent_nevent; //!
TBranch *b_LiEvent_trigger; //!
TBranch *b_LiEvent_subevents; //!
TBranch *b_LiEvent_evsize; //!
AnalysisxTree(TTree *tree=0);
virtual ~AnalysisxTree();
virtual Int_t Cut(Long64_t entry);
virtual Int_t GetEntry(Long64_t entry);
virtual Long64_t LoadTree(Long64_t entry);
virtual void Init(TTree *tree);
virtual void Loop();
virtual Bool_t Notify();
virtual void Show(Long64_t entry = -1);
};
#endif
#ifdef AnalysisxTree_cxx
AnalysisxTree::AnalysisxTree(TTree *tree) : fChain(0)
{
// if parameter tree is not specified (or zero), connect the file
// used to generate this class and read the Tree.
if (tree == 0) {
TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("clb01_0001.root");
if (!f || !f->IsOpen()) {
f = new TFile("clb01_0001.root");
}
f->GetObject("AnalysisxTree",tree);
}
Init(tree);
}
AnalysisxTree::~AnalysisxTree()
{
if (!fChain) return;
delete fChain->GetCurrentFile();
}
Int_t AnalysisxTree::GetEntry(Long64_t entry)
{
// Read contents of entry.
if (!fChain) return 0;
return fChain->GetEntry(entry);
}
Long64_t AnalysisxTree::LoadTree(Long64_t entry)
{
// Set the environment to read one entry
if (!fChain) return -5;
Long64_t centry = fChain->LoadTree(entry);
if (centry < 0) return centry;
if (fChain->GetTreeNumber() != fCurrent) {
fCurrent = fChain->GetTreeNumber();
Notify();
}
return centry;
}
void AnalysisxTree::Init(TTree *tree)
{
// The Init() function is called when the selector needs to initialize
// a new tree or chain. Typically here the branch addresses and branch
// pointers of the tree will be set.
// It is normally not necessary to make changes to the generated
// code, but the routine can be extended by the user if needed.
// Init() will be called many times when running on PROOF
// (once per file to be processed).
// Set branch addresses and branch pointers
if (!tree) return;
fChain = tree;
fCurrent = -1;
fChain->SetMakeClass(1);
fChain->SetBranchAddress("LiEvent.SQ11[16]", LiEvent_SQ11, &b_LiEvent_SQ11);
fChain->SetBranchAddress("LiEvent.SQ12[32]", LiEvent_SQ12, &b_LiEvent_SQ12);
fChain->SetBranchAddress("LiEvent.SQ13[16]", LiEvent_SQ13, &b_LiEvent_SQ13);
fChain->SetBranchAddress("LiEvent.SQ21[16]", LiEvent_SQ21, &b_LiEvent_SQ21);
fChain->SetBranchAddress("LiEvent.SQ22[32]", LiEvent_SQ22, &b_LiEvent_SQ22);
fChain->SetBranchAddress("LiEvent.SQ23[16]", LiEvent_SQ23, &b_LiEvent_SQ23);
fChain->SetBranchAddress("LiEvent.ANR[16]", LiEvent_ANR, &b_LiEvent_ANR);
fChain->SetBranchAddress("LiEvent.ANS[16]", LiEvent_ANS, &b_LiEvent_ANS);
fChain->SetBranchAddress("LiEvent.ANC[32]", LiEvent_ANC, &b_LiEvent_ANC);
fChain->SetBranchAddress("LiEvent.TSQ11[16]", LiEvent_TSQ11, &b_LiEvent_TSQ11);
fChain->SetBranchAddress("LiEvent.TSQ12[32]", LiEvent_TSQ12, &b_LiEvent_TSQ12);
fChain->SetBranchAddress("LiEvent.TSQ21[16]", LiEvent_TSQ21, &b_LiEvent_TSQ21);
fChain->SetBranchAddress("LiEvent.TSQ22[32]", LiEvent_TSQ22, &b_LiEvent_TSQ22);
fChain->SetBranchAddress("LiEvent.TANR[16]", LiEvent_TANR, &b_LiEvent_TANR);
fChain->SetBranchAddress("LiEvent.TANS[16]", LiEvent_TANS, &b_LiEvent_TANS);
fChain->SetBranchAddress("LiEvent.QDC[16]", LiEvent_QDC, &b_LiEvent_QDC);
fChain->SetBranchAddress("LiEvent.TDC[16]", LiEvent_TDC, &b_LiEvent_TDC);
fChain->SetBranchAddress("LiEvent.SCR[16]", LiEvent_SCR, &b_LiEvent_SCR);
fChain->SetBranchAddress("LiEvent.nx1", &LiEvent_nx1, &b_LiEvent_nx1);
fChain->SetBranchAddress("LiEvent.ny1", &LiEvent_ny1, &b_LiEvent_ny1);
fChain->SetBranchAddress("LiEvent.nx2", &LiEvent_nx2, &b_LiEvent_nx2);
fChain->SetBranchAddress("LiEvent.ny2", &LiEvent_ny2, &b_LiEvent_ny2);
fChain->SetBranchAddress("LiEvent.x1[32]", LiEvent_x1, &b_LiEvent_x1);
fChain->SetBranchAddress("LiEvent.y1[32]", LiEvent_y1, &b_LiEvent_y1);
fChain->SetBranchAddress("LiEvent.x2[32]", LiEvent_x2, &b_LiEvent_x2);
fChain->SetBranchAddress("LiEvent.y2[32]", LiEvent_y2, &b_LiEvent_y2);
fChain->SetBranchAddress("LiEvent.adc1[16]", LiEvent_adc1, &b_LiEvent_adc1);
fChain->SetBranchAddress("LiEvent.adc2[16]", LiEvent_adc2, &b_LiEvent_adc2);
fChain->SetBranchAddress("LiEvent.adc3[16]", LiEvent_adc3, &b_LiEvent_adc3);
fChain->SetBranchAddress("LiEvent.adc4[16]", LiEvent_adc4, &b_LiEvent_adc4);
fChain->SetBranchAddress("LiEvent.tdc1[32]", LiEvent_tdc1, &b_LiEvent_tdc1);
fChain->SetBranchAddress("LiEvent.tdc2[32]", LiEvent_tdc2, &b_LiEvent_tdc2);
fChain->SetBranchAddress("LiEvent.time", &LiEvent_time, &b_LiEvent_time);
fChain->SetBranchAddress("LiEvent.nevent", &LiEvent_nevent, &b_LiEvent_nevent);
fChain->SetBranchAddress("LiEvent.trigger", &LiEvent_trigger, &b_LiEvent_trigger);
fChain->SetBranchAddress("LiEvent.subevents", &LiEvent_subevents, &b_LiEvent_subevents);
fChain->SetBranchAddress("LiEvent.evsize", &LiEvent_evsize, &b_LiEvent_evsize);
Notify();
}
Bool_t AnalysisxTree::Notify()
{
// The Notify() function is called when a new file is opened. This
// can be either for a new TTree in a TChain or when when a new TTree
// is started when using PROOF. It is normally not necessary to make changes
// to the generated code, but the routine can be extended by the
// user if needed. The return value is currently not used.
return kTRUE;
}
void AnalysisxTree::Show(Long64_t entry)
{
// Print contents of entry.
// If entry is not specified, print current entry
if (!fChain) return;
fChain->Show(entry);
}
Int_t AnalysisxTree::Cut(Long64_t entry)
{
// This function may be called from Loop.
// returns 1 if entry is accepted.
// returns -1 otherwise.
return 1;
}
#endif // #ifdef AnalysisxTree_cxx
#include "TROOT.h"
void makeClassFromTree()
{
gSystem->Load("../libAculData.so");
TFile fr("clb01_0001.root");
TTree *tr = (TTree*)fr.Get("AnalysisxTree");
tr->MakeClass();
// tr->MakeCode();
}
{
gSystem->Load("../../libAculData.so");
cout << "kasjbdjka" << endl;
AculCalibration cal;
UShort_t SQ22 = 14;
cal.SomeFunction(SQ22, 3);
}
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