Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Riccardo Longo
JZCaPA
Commits
4a4a1f41
Commit
4a4a1f41
authored
Feb 13, 2019
by
Riccardo Longo
Browse files
Major modifications of ProcessEvents and of annexes classes
parent
fa9512b1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Analysis/include/Containers.h
View file @
4a4a1f41
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#define CONTAINERS_H
#define CONTAINERS_H
#include
"Containers.h"
#include
"Containers.h"
#include
"TH1.h"
#include
<iostream>
#include
<iostream>
#include
<vector>
#include
<vector>
...
@@ -47,6 +48,8 @@ class Channel {
...
@@ -47,6 +48,8 @@ class Channel {
int
Vop
;
int
Vop
;
/** Raw waveform for a particular event **/
/** Raw waveform for a particular event **/
std
::
vector
<
float
>
WF
;
std
::
vector
<
float
>
WF
;
/** Histrogram for visualization and analysis of the waveform **/
TH1D
*
WF_histo
;
};
};
...
...
Analysis/include/Detector.h
View file @
4a4a1f41
...
@@ -31,10 +31,13 @@ class Detector{
...
@@ -31,10 +31,13 @@ class Detector{
virtual
double
*
GetPosition
(
)
{
return
m_Position
;
}
virtual
double
*
GetPosition
(
)
{
return
m_Position
;
}
virtual
double
*
GetAngle
(
)
{
return
m_Angle
;
}
virtual
double
*
GetAngle
(
)
{
return
m_Angle
;
}
virtual
void
SetNSamples
(
int
_nSamples
)
{
m_nSamp
=
_nSamples
;
}
virtual
void
SetElement
(
Channel
*
_entry
)
{
m_Element
.
push_back
(
_entry
);
}
virtual
void
SetElement
(
Channel
*
_entry
)
{
m_Element
.
push_back
(
_entry
);
}
virtual
void
SetPosition
(
double
x
,
double
y
,
double
z
)
{
m_Position
[
0
]
=
x
;
m_Position
[
1
]
=
y
;
m_Position
[
2
]
=
z
;
}
virtual
void
SetPosition
(
double
x
,
double
y
,
double
z
)
{
m_Position
[
0
]
=
x
;
m_Position
[
1
]
=
y
;
m_Position
[
2
]
=
z
;
}
virtual
void
SetAngle
(
double
_cosx
=
0
,
double
_cosy
=
0
,
double
_cosz
=
0
)
{
m_Angle
[
0
]
=
_cosx
;
m_Angle
[
1
]
=
_cosy
;
m_Angle
[
2
]
=
_cosz
;
}
virtual
void
SetAngle
(
double
_cosx
=
0
,
double
_cosy
=
0
,
double
_cosz
=
0
)
{
m_Angle
[
0
]
=
_cosx
;
m_Angle
[
1
]
=
_cosy
;
m_Angle
[
2
]
=
_cosz
;
}
virtual
void
SetBranches
(
TTree
*
_dataTree
);
virtual
void
SetBranches
(
TTree
*
_dataTree
);
virtual
void
DeclareHistograms
(
);
virtual
void
FillHistograms
(
);
virtual
void
PrintMap
(
)
=
0
;
virtual
void
PrintMap
(
)
=
0
;
...
@@ -45,6 +48,9 @@ class Detector{
...
@@ -45,6 +48,9 @@ class Detector{
double
m_Position
[
3
];
double
m_Position
[
3
];
/** Three element array of angle about the x, y, and z axis **/
/** Three element array of angle about the x, y, and z axis **/
double
m_Angle
[
3
];
double
m_Angle
[
3
];
/** Number of samples per channel **/
int
m_nSamp
=
1024
;
};
};
#endif
#endif
Analysis/src/DataReader.cpp
View file @
4a4a1f41
/** @file DataReader.cxxs
/** @file DataReader.cxxs
* @brief Implementation of DataReader.
* @brief Implementation of DataReader.
*
*
* Function definitions for DataReader are provided.
* Function definitions for DataReader are provided.
...
@@ -188,9 +188,10 @@ void DataReader::LoadConfigurationFile(std::string _inFile = "$JCaPA/Utils/Confi
...
@@ -188,9 +188,10 @@ void DataReader::LoadConfigurationFile(std::string _inFile = "$JCaPA/Utils/Confi
ZDC
*
zdc2
=
new
ZDC
(
channelEntries
,
2
);
ZDC
*
zdc2
=
new
ZDC
(
channelEntries
,
2
);
RPD
*
rpd
=
new
RPD
(
channelEntries
);
RPD
*
rpd
=
new
RPD
(
channelEntries
);
m_detectors
.
push_back
(
zdc1
);
m_detectors
.
push_back
(
zdc1
);
//Position 0 goes for ZDC1
m_detectors
.
push_back
(
zdc2
);
m_detectors
.
push_back
(
zdc2
);
//Position 1 goes for ZDC2
m_detectors
.
push_back
(
rpd
);
m_detectors
.
push_back
(
rpd
);
//Position 2 goes for the RPD
std
::
cout
<<
"Detector configuration: loading complete! "
<<
std
::
endl
;
std
::
cout
<<
"Detector configuration: loading complete! "
<<
std
::
endl
;
return
;
return
;
...
@@ -291,7 +292,7 @@ void DataReader::Initialize(){
...
@@ -291,7 +292,7 @@ void DataReader::Initialize(){
*/
*/
void
DataReader
::
ProcessEvents
(){
void
DataReader
::
ProcessEvents
(){
// Raw data to read in as vector of vectors size NxM
//
Processed
Raw data to read in as vector of vectors size NxM
// Where N = nCh and M = nSamples per channel.
// Where N = nCh and M = nSamples per channel.
std
::
vector
<
std
::
vector
<
float
>
>
vWF
;
std
::
vector
<
std
::
vector
<
float
>
>
vWF
;
std
::
vector
<
std
::
vector
<
float
>*
>
pvWF
;
std
::
vector
<
std
::
vector
<
float
>*
>
pvWF
;
...
@@ -305,30 +306,44 @@ void DataReader::ProcessEvents(){
...
@@ -305,30 +306,44 @@ void DataReader::ProcessEvents(){
pvWF
.
resize
(
m_nCh
);
pvWF
.
resize
(
m_nCh
);
vWFH
.
resize
(
m_nCh
);
vWFH
.
resize
(
m_nCh
);
/** TODO : add reading for list of files */
/** TODO : add reading for list of files
* Please note that many of the implementations are now for a single-file treatment
*/
TTree
*
tree
=
static_cast
<
TTree
*
>
(
m_fIn
->
Get
(
"tree"
)
);
TTree
*
tree
=
static_cast
<
TTree
*
>
(
m_fIn
->
Get
(
"tree"
)
);
// Connect raw data to tree
//Specific pointers to each detector, if needed afterwards
// For the moment, the only reading implemented is the raw data from each channel.
ZDC
*
zdc1
=
static_cast
<
ZDC
*
>
(
GetDetector
(
"ZDC1"
)
);
ZDC
*
zdc2
=
static_cast
<
ZDC
*
>
(
GetDetector
(
"ZDC2"
)
);
RPD
*
rpd
=
static_cast
<
RPD
*
>
(
GetDetector
(
"RPD"
)
);
//All the raw channels addresses set for read-out
for
(
uint
detID
=
0
;
detID
<
(
int
)
m_detectors
.
size
();
detID
++
){
m_detectors
.
at
(
detID
)
->
SetBranches
(
tree
);
m_detectors
.
at
(
detID
)
->
SetNSamples
(
m_nSamp
);
m_detectors
.
at
(
detID
)
->
DeclareHistograms
();
}
// Connect raw data to tree. For the moment, the only reading implemented is the raw data from each channel.
// Other items should be implemented in the same way if needed.
// Other items should be implemented in the same way if needed.
// Also create the histograms to fill
// Also create the histograms to fill
for
(
uint
ch
=
0
;
ch
<
m_nCh
;
ch
++
){
for
(
uint
ch
=
0
;
ch
<
m_nCh
;
ch
++
){
//Example - here we retrieve the already processed waveform (M.Phipps approach during the data production)
pvWF
[
ch
]
=
&
vWF
[
ch
];
pvWF
[
ch
]
=
&
vWF
[
ch
];
tree
->
SetBranchAddress
(
Form
(
"
Raw
C%d"
,
ch
),
&
pvWF
[
ch
]
);
tree
->
SetBranchAddress
(
Form
(
"C%d"
,
ch
),
&
pvWF
[
ch
]
);
vWFH
[
ch
]
=
new
TH1D
(
Form
(
"hWF%d"
,
ch
),
Form
(
"hWF%d;samp;amp"
,
ch
),
m_nSamp
,
0
,
m_nSamp
);
vWFH
[
ch
]
=
new
TH1D
(
Form
(
"hWF%d"
,
ch
),
Form
(
"hWF%d;samp;amp"
,
ch
),
m_nSamp
,
0
,
m_nSamp
);
}
}
std
::
cout
<<
"File: "
<<
m_fIn
->
GetName
()
<<
" has "
std
::
cout
<<
"File: "
<<
m_fIn
->
GetName
()
<<
" has "
<<
tree
->
GetEntries
()
<<
" events."
<<
std
::
endl
;
<<
tree
->
GetEntries
()
<<
" events."
<<
std
::
endl
;
// !! EVENT LOOP
// !! EVENT LOOP
for
(
int
ev
=
0
;
ev
<
tree
->
GetEntries
();
ev
++
){
for
(
int
ev
=
0
;
ev
<
tree
->
GetEntries
();
ev
++
){
tree
->
GetEntry
(
ev
);
tree
->
GetEntry
(
ev
);
// Fill the waveforms
// Fill the waveforms
for
(
uint
ch
=
0
;
ch
<
m_nCh
;
ch
++
){
for
(
uint
detID
=
0
;
detID
<
(
int
)
m_detectors
.
size
();
detID
++
)
m_detectors
.
at
(
detID
)
->
FillHistograms
();
vWFH
[
ch
]
->
Reset
();
for
(
uint
ch
=
0
;
ch
<
m_nCh
;
ch
++
)
{
// Loop over samples in each channel
// Loop over samples in each channel
for
(
uint
samp
=
0
;
samp
<
m_nSamp
;
samp
++
){
for
(
uint
samp
=
0
;
samp
<
m_nSamp
;
samp
++
){
vWFH
[
ch
]
->
SetBinContent
(
samp
+
1
,
vWF
[
ch
][
samp
]
);
vWFH
[
ch
]
->
SetBinContent
(
samp
+
1
,
vWF
[
ch
][
samp
]
);
...
...
Analysis/src/Detector.cpp
View file @
4a4a1f41
...
@@ -62,6 +62,10 @@ Channel* Detector::GetElement(std::string _name){
...
@@ -62,6 +62,10 @@ Channel* Detector::GetElement(std::string _name){
}
}
/**
* @brief Set the branches of the tree to the channels of the detectors (according to their name, read from the mapping)
* @param _dataTree : processed data tree
*/
void
Detector
::
SetBranches
(
TTree
*
_dataTree
){
void
Detector
::
SetBranches
(
TTree
*
_dataTree
){
std
::
vector
<
std
::
vector
<
float
>*
>
pvWF
;
std
::
vector
<
std
::
vector
<
float
>*
>
pvWF
;
...
@@ -74,6 +78,30 @@ void Detector::SetBranches( TTree *_dataTree ){
...
@@ -74,6 +78,30 @@ void Detector::SetBranches( TTree *_dataTree ){
}
}
/**
* @brief Declare histograms to be filled with the raw waveform
*/
void
Detector
::
DeclareHistograms
(){
for
(
uint
ch
=
0
;
ch
<
m_Element
.
size
();
ch
++
){
m_Element
.
at
(
ch
)
->
WF_histo
=
new
TH1D
(
m_Element
.
at
(
ch
)
->
name
.
c_str
(),
(
m_Element
.
at
(
ch
)
->
name
+
", "
+
m_Element
.
at
(
ch
)
->
detector
).
c_str
(),
m_nSamp
,
0
,
m_nSamp
);
}
}
/**
* @brief Fill histograms with the current raw waveform
*/
void
Detector
::
FillHistograms
(){
for
(
uint
ch
=
0
;
ch
<
m_Element
.
size
();
ch
++
){
m_Element
.
at
(
ch
)
->
WF_histo
->
Reset
();
// Loop over samples in each channel
for
(
uint
samp
=
0
;
samp
<
m_nSamp
;
samp
++
){
m_Element
.
at
(
ch
)
->
WF_histo
->
SetBinContent
(
samp
+
1
,
m_Element
.
at
(
ch
)
->
WF
[
samp
]
);
}
// End loop over samples in each channel
}
}
...
...
Analysis/userFunctions/AnalysisExample.cpp
View file @
4a4a1f41
...
@@ -30,7 +30,7 @@ int main(int argc, char *argv[]){
...
@@ -30,7 +30,7 @@ int main(int argc, char *argv[]){
r
->
AddAnalysis
(
new
WFAnalysis
()
);
r
->
AddAnalysis
(
new
WFAnalysis
()
);
r
->
LoadConfigurationFile
(
"${JCaPA}/Utils/ConfigFile2018.xml"
);
r
->
LoadConfigurationFile
(
"${JCaPA}/Utils/ConfigFile2018.xml"
);
r
->
LoadAlignmentFile
(
"${JCaPA}/Utils/
ConfigFile
2018.xml"
);
r
->
LoadAlignmentFile
(
"${JCaPA}/Utils/
Alignment_
2018.xml"
);
r
->
Run
();
r
->
Run
();
...
...
Write
Preview
Supports
Markdown
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