Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
JZCaPA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Riccardo Longo
JZCaPA
Commits
7ad2ecd8
Commit
7ad2ecd8
authored
6 years ago
by
Riccardo Longo
Browse files
Options
Downloads
Patches
Plain Diff
Added comments to facilitate understanding for newcomers + some TODO
parent
4675f9b7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Analysis/src/DataReader.cpp
+32
-4
32 additions, 4 deletions
Analysis/src/DataReader.cpp
with
32 additions
and
4 deletions
Analysis/src/DataReader.cpp
+
32
−
4
View file @
7ad2ecd8
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
#include
<TTree.h>
#include
<TTree.h>
#include
<TH1.h>
#include
<TH1.h>
#include
<TCanvas.h>
#include
<TCanvas.h>
#include
<TChain.h>
#include
<iostream>
#include
<iostream>
...
@@ -74,6 +75,20 @@ DataReader::~DataReader(){
...
@@ -74,6 +75,20 @@ DataReader::~DataReader(){
delete
m_fIn
;
delete
m_fIn
;
}
}
/** @brief Enables the read from list of files option for DataReader
*
* @param1 name of the list of files to be processed (with the full path if it's not in the execution folder)
*
* @return none
*/
void
DataReader
::
ReadListOfFiles
(
std
::
string
listname
){
m_readListOfFiles
=
true
;
m_fListOfFiles
=
listname
;
}
/** @brief Initialization method for DataReader
/** @brief Initialization method for DataReader
*
*
* Select which file(s) to read. For now just a single
* Select which file(s) to read. For now just a single
...
@@ -92,9 +107,19 @@ void DataReader::Initialize(){
...
@@ -92,9 +107,19 @@ void DataReader::Initialize(){
"output.root"
:
Form
(
"output%d.root"
,
m_runNumber
);
"output.root"
:
Form
(
"output%d.root"
,
m_runNumber
);
if
(
m_readListOfFiles
){
if
(
m_readListOfFiles
){
// for now do nothing. Was thinking of having
// a file called inputFiles.txt, from which to
// Riccardo - 21/01/2019 - TChain implementation
// read a list of files. TBD (I am in Berlin now).
// The file list name is supposed to be already set
m_fileChain
=
new
TChain
(
"tree"
);
std
::
ifstream
inFile
;
inFile
.
open
(
m_fListOfFiles
.
c_str
());
std
::
string
reader_buff
;
while
(
inFile
>>
reader_buff
){
//Let's push all the files in the list into the TChain
m_fileChain
->
Add
(
reader_buff
.
c_str
());
}
/** TODO - Add fileChain reading below
*/
}
else
{
}
else
{
m_fIn
=
TFile
::
Open
(
m_fNameIn
.
c_str
()
);
m_fIn
=
TFile
::
Open
(
m_fNameIn
.
c_str
()
);
}
}
...
@@ -123,15 +148,18 @@ void DataReader::ProcessEvents(){
...
@@ -123,15 +148,18 @@ void DataReader::ProcessEvents(){
std
::
vector
<
std
::
vector
<
float
>
>
vWF
;
std
::
vector
<
std
::
vector
<
float
>
>
vWF
;
std
::
vector
<
std
::
vector
<
float
>*
>
pvWF
;
std
::
vector
<
std
::
vector
<
float
>*
>
pvWF
;
std
::
vector
<
TH1
*
>
vWFH
;
std
::
vector
<
TH1
*
>
vWFH
;
//Buffer histograms for the raw waveforms at each event. They will go to AnalyzeEvent for processing
vWF
.
resize
(
m_nCh
);
vWF
.
resize
(
m_nCh
);
pvWF
.
resize
(
m_nCh
);
pvWF
.
resize
(
m_nCh
);
vWFH
.
resize
(
m_nCh
);
vWFH
.
resize
(
m_nCh
);
/** TODO : add reading for list of files */
TTree
*
tree
=
static_cast
<
TTree
*
>
TTree
*
tree
=
static_cast
<
TTree
*
>
(
m_fIn
->
Get
(
"tree"
)
);
(
m_fIn
->
Get
(
"tree"
)
);
// Connect raw data to tree
// 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.
// 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
++
){
pvWF
[
ch
]
=
&
vWF
[
ch
];
pvWF
[
ch
]
=
&
vWF
[
ch
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment