Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AculUtils
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pavel Sharov
AculUtils
Commits
21729c50
Commit
21729c50
authored
Oct 05, 2016
by
Kostyleva D.A
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://er.jinr.ru/AculUtils
parents
f2af59b6
952ba2be
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
481 additions
and
31 deletions
+481
-31
AculCalibration.cpp
AculData/AculCalibration.cpp
+145
-26
AculCalibration.h
AculData/AculCalibration.h
+24
-5
AnalysisxTree.C
macros/myMacros/AnalysisxTree.C
+43
-0
AnalysisxTree.h
macros/myMacros/AnalysisxTree.h
+240
-0
makeClassFromTree.cxx
macros/myMacros/makeClassFromTree.cxx
+14
-0
myMacro.cxx
macros/myMacros/myMacro.cxx
+15
-0
No files found.
AculData/AculCalibration.cpp
View file @
21729c50
...
...
@@ -17,7 +17,7 @@
ClassImp
(
AculCalibration
);
AculCalibration
::
AculCalibration
()
AculCalibration
::
AculCalibration
()
:
fA
(
0
),
fB
(
0
)
{
//default constructor
...
...
@@ -43,7 +43,7 @@ AculCalibration::AculCalibration()
AculCalibration
::
AculCalibration
(
const
char
*
parfile
)
{
//constructor which fills fA
, fB
, fC, fD from file parfile
//constructor which fills fA
Old, fBOld
, fC, fD from file parfile
fCurrentHStack
=
NULL
;
fCurrentHistList
.
IsOwner
();
...
...
@@ -413,8 +413,8 @@ Bool_t AculCalibration::SetCalibrationParameters(const char* calparfile)
calFileR
.
getline
(
line
,
lineLength
);
if
(
line
[
0
]
!=
'*'
&&
line
[
0
]
!=
'#'
&&
line
[
0
]
!=
'%'
&&
(
line
[
0
]
!=
'/'
&&
line
[
1
]
!=
'/'
)
)
{
//possible comment characters
sscanf
(
line
,
"%s %d %d %s %s %s %s"
,
crate
,
&
i
,
&
j
,
cA
,
cB
,
cC
,
cD
);
fA
[
i
][
j
]
=
atof
(
cA
);
fB
[
i
][
j
]
=
atof
(
cB
);
fA
Old
[
i
][
j
]
=
atof
(
cA
);
fB
Old
[
i
][
j
]
=
atof
(
cB
);
fC
[
i
][
j
]
=
atof
(
cC
);
fD
[
i
][
j
]
=
atof
(
cD
);
}
...
...
@@ -428,7 +428,7 @@ void AculCalibration::PrintCalibrationParameters(const Int_t blockmin, const Int
{
for
(
Int_t
i
=
blockmin
;
i
<=
blockmax
;
i
++
)
{
for
(
Int_t
j
=
0
;
j
<
ADDRESSNUMBER
;
j
++
)
{
cout
<<
"C3["
<<
i
<<
"]["
<<
j
<<
"]"
<<
setw
(
10
)
<<
fA
[
i
][
j
]
<<
setw
(
10
)
<<
fB
[
i
][
j
]
<<
setw
(
10
)
<<
fC
[
i
][
j
]
<<
setw
(
10
)
<<
fD
[
i
][
j
]
<<
endl
;
cout
<<
"C3["
<<
i
<<
"]["
<<
j
<<
"]"
<<
setw
(
10
)
<<
fA
Old
[
i
][
j
]
<<
setw
(
10
)
<<
fBOld
[
i
][
j
]
<<
setw
(
10
)
<<
fC
[
i
][
j
]
<<
setw
(
10
)
<<
fD
[
i
][
j
]
<<
endl
;
}
}
}
...
...
@@ -805,8 +805,8 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch
<<
setprecision
(
4
)
<<
calFunction
->
GetParameter
(
0
)
<<
"
\t\t
"
<<
fitControl
<<
endl
;
fA
[
address
][
i
]
=
calFunction
->
GetParameter
(
1
);
fB
[
address
][
i
]
=
calFunction
->
GetParameter
(
0
);
fA
Old
[
address
][
i
]
=
calFunction
->
GetParameter
(
1
);
fB
Old
[
address
][
i
]
=
calFunction
->
GetParameter
(
0
);
//calibration of raw spectra using obtained parameters
...
...
@@ -821,9 +821,9 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch
Int_t
binCont
=
(
Int_t
)
hRaw
->
GetBinContent
(
j
);
// cout << j << ":\t" << hRaw->GetBinContent(j) << endl;
for
(
Int_t
k
=
0
;
k
<
binCont
;
k
++
)
{
hEnergy
->
Fill
(
fA
[
address
][
i
]
*
(
j
+
ranGen
.
Uniform
(
-
0.5
,
0.5
)
)
+
fB
[
address
][
i
]
);
// cout << j << ":\t" << fA
[address][i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fB
[address][i] << endl;
// cout << j << ":\t" << fA[address][i] << endl;
hEnergy
->
Fill
(
fA
Old
[
address
][
i
]
*
(
j
+
ranGen
.
Uniform
(
-
0.5
,
0.5
)
)
+
fBOld
[
address
][
i
]
);
// cout << j << ":\t" << fA
Old[address][i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fBOld
[address][i] << endl;
// cout << j << ":\t" << fA
Old
[address][i] << endl;
}
}
...
...
@@ -841,6 +841,125 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch
}
void
AculCalibration
::
CalibrateRawSpectra
()
{
//function parameters:
const
char
*
iFileName
=
"clb01_0001.root"
;
const
char
*
treeName
=
"AnalysisxTree"
;
const
char
*
branchName
=
"LiEvent.SQ22[32]"
;
const
Int_t
address
=
22
;
const
Int_t
lowerElement
=
0
;
const
Int_t
upperElement
=
32
;
const
Int_t
lowerChannel
=
100
,
upperChannel
=
4096
;
const
Int_t
nEBins
=
1000
;
//optional:
Long64_t
nentries
=
0
;
//function itself:
TString
iFile
=
iFileName
;
TFile
fr
(
iFile
.
Data
()
);
if
(
!
fr
.
IsOpen
()
)
{
Error
(
"CalibrateRawSpectra"
,
"File %s was not opened and won't be processed"
,
iFile
.
Data
());
return
;
}
TString
tName
=
treeName
;
TTree
*
tr
=
(
TTree
*
)
fr
.
Get
(
tName
.
Data
());
if
(
!
tr
)
{
Error
(
"CalibrateRawSpectra"
,
"Tree %s was not found in file %s"
,
tName
.
Data
(),
iFile
.
Data
());
return
;
}
tr
->
SetMakeClass
(
1
);
//!!!!!!!!!!!!!!!!!!!!!!!!!!!
UShort_t
variable
[
32
];
//!!!!!!!!!!!!!!!!!!!!!!!!!!!
TString
bName
=
branchName
;
tr
->
SetBranchAddress
(
bName
.
Data
(),
variable
);
if
(
nentries
==
0
)
nentries
=
tr
->
GetEntries
();
Info
(
"CalibrateRawSpectra"
,
"%lld entries from tree %s will be read."
,
nentries
,
tr
->
GetName
());
//make histogram to fill
const
Int_t
noElements
=
upperElement
-
lowerElement
+
1
;
//number of treated detector elements
TH1F
*
hEnergy
[
noElements
];
for
(
Int_t
i
=
0
;
i
<
noElements
;
i
++
)
{
hEnergy
[
i
]
=
0
;
}
TString
histName
;
TString
histTitle
;
for
(
Int_t
i
=
0
;
i
<
noElements
;
i
++
)
{
histName
.
Form
(
"%sE%d"
,
bName
.
Data
(),
i
+
lowerElement
);
histTitle
.
Form
(
"%s: %s"
,
iFile
.
Data
(),
bName
.
Data
());
hEnergy
[
i
]
=
new
TH1F
(
histName
.
Data
(),
histTitle
.
Data
(),
nEBins
,
0.
,
10.
);
}
TRandom3
ranGen
(
1
);
for
(
Long64_t
j
=
0
;
j
<
nentries
;
j
++
)
{
tr
->
GetEntry
(
j
);
for
(
Int_t
i
=
lowerElement
;
i
<=
upperElement
;
i
++
)
{
// printf("\n\n");
// Info("CalculateCalibParameters", "Calculating calibration parameters for detector channel %s[%d].", block, i);
//TH1I object preparing
// hRaw = new TH1I("name", "title", 4096, 0, 4095); //nastavovat hranice histogramu podle parametru fce
// detectorChannel.Form("%s[%d]", block, i);
// histName.Form("Hist%s[%d]", block, i);
// hRaw->SetName(histName.Data());
// fillCommand.Form("%s >> %s", detectorChannel.Data(), hRaw->GetName());
// fillCondition.Form("%s > %d && %s < %d",
// detectorChannel.Data(), lowerchannel, detectorChannel.Data(), upperchannel);
// //filling from the .root raw data file and content arrangement
// tr->Draw(fillCommand.Data(), fillCondition.Data(), "goff");
//calibration of raw spectra using obtained parameters
// Info("CalculateCalibParameters", "Energy spectrum from address %s[%d] calculating", block, i);
// histName.Form("%sE", hRaw->GetName());
// histTitle.Form("%s: %s", iFileName.Data(), histName.Data());
// detectorChannel.Form("%s[%d]", block, i);
// hEnergy->SetName(histName.Data());
if
(
variable
[
i
]
>
lowerChannel
&&
variable
[
i
]
<
upperChannel
)
{
hEnergy
[
i
-
lowerElement
]
->
Fill
(
fAOld
[
address
][
i
]
*
(
variable
[
i
]
+
ranGen
.
Uniform
(
-
0.5
,
0.5
)
)
+
fBOld
[
address
][
i
]
);
}
}
//for subaddresses
}
//for entries
fr
.
Close
();
TString
oFileName
;
//outputfile with calibrated spectra
if
(
(
lowerElement
==
0
)
&&
(
upperElement
==
ADDRESSNUMBER
-
1
)
)
{
oFileName
.
Form
(
"%sE.root"
,
bName
.
Data
());
}
else
{
if
(
lowerElement
==
upperElement
)
{
oFileName
.
Form
(
"%s[%d]E.root"
,
bName
.
Data
(),
lowerElement
);
}
else
{
oFileName
.
Form
(
"%s[%d-%d]E.root"
,
bName
.
Data
(),
lowerElement
,
upperElement
);
}
}
TFile
fw
(
oFileName
.
Data
(),
"RECREATE"
);
if
(
fw
.
IsOpen
()
==
0
)
{
Error
(
"CalculateCalibParameters"
,
"File %s was not created and won't be processed
\n\n
"
,
oFileName
.
Data
());
return
;
}
fw
.
cd
();
for
(
Int_t
i
=
0
;
i
<
noElements
;
i
++
)
{
hEnergy
[
i
]
->
Write
();
}
fw
.
Close
();
return
;
}
void
AculCalibration
::
CalibrateRawSpectra
(
const
char
*
inputfile
,
const
char
*
block
,
const
Int_t
address
,
const
char
*
treename
,
Int_t
lowerchannel
,
Int_t
upperchannel
,
Int_t
nEBins
,
Int_t
lowersubaddress
,
Int_t
uppersubaddress
)
{
...
...
@@ -935,8 +1054,8 @@ void AculCalibration::CalibrateRawSpectra(const char* inputfile, const char* blo
// << setprecision(4) << calFunction->GetParameter(0) << "\t\t"
// << fitControl
// << endl;
// fA[address][i] = calFunction->GetParameter(1);
// fB[address][i] = calFunction->GetParameter(0);
// fA
Old
[address][i] = calFunction->GetParameter(1);
// fB
Old
[address][i] = calFunction->GetParameter(0);
//calibration of raw spectra using obtained parameters
...
...
@@ -951,9 +1070,9 @@ void AculCalibration::CalibrateRawSpectra(const char* inputfile, const char* blo
Int_t
binCont
=
(
Int_t
)
hRaw
->
GetBinContent
(
j
);
// cout << j << ":\t" << hRaw->GetBinContent(j) << endl;
for
(
Int_t
k
=
0
;
k
<
binCont
;
k
++
)
{
hEnergy
->
Fill
(
fA
[
address
][
i
]
*
(
j
+
ranGen
.
Uniform
(
-
0.5
,
0.5
)
)
+
fB
[
address
][
i
]
);
// cout << j << ":\t" << fA
[address][i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fB
[address][i] << endl;
// cout << j << ":\t" << fA[address][i] << endl;
hEnergy
->
Fill
(
fA
Old
[
address
][
i
]
*
(
j
+
ranGen
.
Uniform
(
-
0.5
,
0.5
)
)
+
fBOld
[
address
][
i
]
);
// cout << j << ":\t" << fA
Old[address][i]*( j+ranGen.Uniform(-0.5, 0.5) ) + fBOld
[address][i] << endl;
// cout << j << ":\t" << fA
Old
[address][i] << endl;
}
}
...
...
@@ -1196,8 +1315,8 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi
//asi fce Reset()
for
(
Int_t
i
=
0
;
i
<
BLOCKSNUMBER
;
i
++
)
{
for
(
Int_t
j
=
0
;
j
<
ADDRESSNUMBER
;
j
++
)
{
fA
[
i
][
j
]
=
0
;
fB
[
i
][
j
]
=
0
;
fA
Old
[
i
][
j
]
=
0
;
fB
Old
[
i
][
j
]
=
0
;
}
}
...
...
@@ -1225,10 +1344,10 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi
sscanf
(
line
,
"%d %d %d %s %s %d %s"
,
&
crate
,
&
i
,
&
j
,
cA
,
cB
,
&
id
,
cSigma
);
// cout << line << endl;
if
(
id
==
0
)
{
fA
[
i
][
j
]
=
static_cast
<
Double_t
>
(
atof
(
cA
));
fB
[
i
][
j
]
=
static_cast
<
Double_t
>
(
atof
(
cB
));
fA
Old
[
i
][
j
]
=
static_cast
<
Double_t
>
(
atof
(
cA
));
fB
Old
[
i
][
j
]
=
static_cast
<
Double_t
>
(
atof
(
cB
));
// fMeanSigma[i][j] = static_cast<Double_t>(atof(cSigma));
cout
<<
fA
[
i
][
j
]
<<
"
\t
"
<<
fB
[
i
][
j
]
<<
endl
;
cout
<<
fA
Old
[
i
][
j
]
<<
"
\t
"
<<
fBOld
[
i
][
j
]
<<
endl
;
}
//if
}
//while
calFileR
.
close
();
...
...
@@ -1247,13 +1366,13 @@ void AculCalibration::MakeCalibrationFile(Char_t* calibrationfile, Char_t *calfi
for
(
Int_t
i
=
0
;
i
<
BLOCKSNUMBER
;
i
++
)
{
for
(
Int_t
j
=
0
;
j
<
ADDRESSNUMBER
;
j
++
)
{
if
(
fA
[
i
][
j
]
!=
0
)
{
if
(
fA
Old
[
i
][
j
]
!=
0
)
{
CalibFileW
<<
std
::
right
<<
setw
(
2
)
<<
"3"
<<
setw
(
4
)
<<
i
<<
setw
(
4
)
<<
j
<<
setw
(
12
)
<<
fA
[
i
][
j
]
<<
setw
(
12
)
<<
fB
[
i
][
j
]
<<
setw
(
12
)
<<
fA
Old
[
i
][
j
]
<<
setw
(
12
)
<<
fB
Old
[
i
][
j
]
// << setw(10) << fMeanSigma[i][j]
<<
endl
;
}
...
...
@@ -1280,12 +1399,12 @@ void AculCalibration::DeleteStacks(Option_t* option) {
void
AculCalibration
::
Reset
()
{
//reset calibration parameters fA
, fB
, fC, fD to zero
//reset calibration parameters fA
Old, fBOld
, fC, fD to zero
for
(
Int_t
i
=
0
;
i
<
BLOCKSNUMBER
;
i
++
)
{
for
(
Int_t
j
=
0
;
j
<
ADDRESSNUMBER
;
j
++
)
{
fA
[
i
][
j
]
=
0
;
fB
[
i
][
j
]
=
0
;
fA
Old
[
i
][
j
]
=
0
;
fB
Old
[
i
][
j
]
=
0
;
fC
[
i
][
j
]
=
0
;
fD
[
i
][
j
]
=
0
;
// fMeanSigma[i][j] = 0;
...
...
AculData/AculCalibration.h
View file @
21729c50
...
...
@@ -75,12 +75,14 @@ public:
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
//t
yto promenne jsou smyslem tridy, mely by tedy byt snad jako jedine verejne
Double_t
fA
[
BLOCKSNUMBER
][
ADDRESSNUMBER
];
//kalibracni parametry, f(x) = fA*x + fB
Double_t
fB
[
BLOCKSNUMBER
][
ADDRESSNUMBER
];
//kalibracni parametry, f(x) = fA*x + fB
//t
hese variables are the main for the class
Double_t
fA
Old
[
BLOCKSNUMBER
][
ADDRESSNUMBER
];
//calibration parameter, f(x) = fAOld*x + fBOld
Double_t
fB
Old
[
BLOCKSNUMBER
][
ADDRESSNUMBER
];
//calibration parameter, f(x) = fAOld*x + fBOld
Double_t
fC
[
BLOCKSNUMBER
][
ADDRESSNUMBER
];
//treti kalibracni parametr, jine zavislosti nez pol1
Double_t
fD
[
BLOCKSNUMBER
][
ADDRESSNUMBER
];
//ctvrty kalibracni parametr
TArrayD
fA
;
TArrayD
fB
;
...
...
@@ -126,7 +128,7 @@ public:
Bool_t
SetCalibrationParameters
(
const
char
*
calparfile
);
//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, fA
Old, fBOld
, fC, fD
//
// allowed comment characters: *, #, %, //
...
...
@@ -134,7 +136,7 @@ public:
//I hope this is selfunderstanding function
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 fA
Old, fBOld
, fC, fD which are currently saved in object AculCalibration
//
// blockmin: minimum block data are displayed for
// blockmax: maximum block data are displayed for
...
...
@@ -154,6 +156,23 @@ public:
// lowersubaddress: block subaddress
// 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
);
// Bool_t EnergyPositions(const char* inputfile, const char* block,
...
...
macros/myMacros/AnalysisxTree.C
0 → 100644
View file @
21729c50
#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;
}
}
macros/myMacros/AnalysisxTree.h
0 → 100644
View file @
21729c50
//////////////////////////////////////////////////////////
// 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
macros/myMacros/makeClassFromTree.cxx
0 → 100644
View file @
21729c50
#include "TROOT.h"
void
makeClassFromTree
()
{
gSystem
->
Load
(
"../libAculData.so"
);
TFile
fr
(
"clb01_0001.root"
);
TTree
*
tr
=
(
TTree
*
)
fr
.
Get
(
"AnalysisxTree"
);
tr
->
MakeClass
();
// tr->MakeCode();
}
macros/myMacros/myMacro.cxx
0 → 100644
View file @
21729c50
{
gSystem
->
Load
(
"../../libAculData.so"
);
cout
<<
"kasjbdjka"
<<
endl
;
AculCalibration
cal
;
UShort_t
SQ22
=
14
;
cal
.
SomeFunction
(
SQ22
,
3
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment