Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NeuRad_tests
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vratislav Chudoba
NeuRad_tests
Commits
cdd6d9f8
Commit
cdd6d9f8
authored
Dec 30, 2016
by
Muzalevsky I.A
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
script for filling tree of class objects with data from all 4 channels added
parent
0c360be5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
81 deletions
+94
-81
read.cpp
convertTektronix/read.cpp
+94
-81
No files found.
convertTektronix/read.cpp
View file @
cdd6d9f8
//#include <iostream>
//#include <fstream>
//
//#include "TFile.h"
//#include "TTree.h"
//
//#include "../dataClasses/RawEvent.h"
void
read
()
{
void
read
()
{
//Double_t N[5]; // массив для чисел ()
//Double_t N[5]; // массив для чисел ()
//ifstream myfile;
//ifstream myfile;
//Double_t string_to_double( const std::string& s );
const
Int_t
par1
=
5
;
//
const Int_t par1 = 5;
const
Double_t
par2
=
5.34
;
//
const Double_t par2 = 5.34;
// ....
// ....
// ....
// ....
gSystem
->
Load
(
"../libData.so"
);
gSystem
->
Load
(
"../libData.so"
);
asdasd
();
Double_t
A
[
1000
];
Double_t
A
[
1000
];
Double_t
T
[
1000
];
Double_t
T
[
1000
];
Int_t
i
,
j
,
n
;
Int_t
i
,
j
,
n
,
p
,
Nchannel
;
TString
line
;
Double_t
amp
,
time
;
TFile
*
f1
=
new
TFile
(
"exp2.root"
,
"RECREATE"
);
TFile
*
f1
=
new
TFile
(
"exp2.root"
,
"RECREATE"
);
TTree
*
tree
=
new
TTree
(
"tree"
,
"signal"
);
TTree
*
tree
=
new
TTree
(
"tree"
,
"signal"
);
tree
->
Branch
(
"A"
,
A
,
"A[1000]/D"
);
tree
->
Branch
(
"A"
,
A
,
"A[1000]/D"
);
tree
->
Branch
(
"T"
,
T
,
"T[1000]/D"
);
tree
->
Branch
(
"T"
,
T
,
"T[1000]/D"
);
RawEvent
*
event
=
new
RawEvent
();
tree
->
Bronch
(
"rawEvent"
,
"RawEvent"
,
&
event
);
//std::vector<Double_t> *A = new std::vector<Double_t>();
//tree->Branch("mybranch","vector<Double_t>",A);
RawEvent
*
event1
=
new
RawEvent
();
tree
->
Bronch
(
"rawEvent1"
,
"RawEvent"
,
&
event1
);
RawEvent
*
event2
=
new
RawEvent
();
tree
->
Bronch
(
"rawEvent2"
,
"RawEvent"
,
&
event2
);
RawEvent
*
event3
=
new
RawEvent
();
tree
->
Bronch
(
"rawEvent3"
,
"RawEvent"
,
&
event3
);
RawEvent
*
event4
=
new
RawEvent
();
tree
->
Bronch
(
"rawEvent4"
,
"RawEvent"
,
&
event4
);
RawEvent
**
Nevent
;
Nevent
=
new
RawEvent
*
[
4
];
Nevent
[
0
]
=
event1
;
Nevent
[
1
]
=
event2
;
Nevent
[
2
]
=
event3
;
Nevent
[
3
]
=
event4
;
/////////
ifstream
myfile
;
// открываю файл с названиями файлов с данными
ifstream
myfile1
;
ifstream
myfile1
;
myfile1
.
open
(
"../data/rawDataTektronix/ch12016.12.07-02.11.54.dat"
);
myfile
.
open
(
"../data/rawDataTektronix/infiles.dat"
);
if
(
myfile
.
is_open
())
{
if
(
!
myfile1
.
is_open
())
{
TString
fileName
;
Error
(
"read.c"
,
"Some error when opening file"
);
while
(
!
myfile
.
eof
())
{
p
++
;
return
;
}
fileName
.
ReadLine
(
myfile
);
if
(
fileName
.
IsNull
()
)
break
;
Double_t
amp
=
0
;
Double_t
time
=
0
;
if
(
fileName
.
EqualTo
(
"ch1"
)
)
{
Nchannel
=
1
;
}
if
(
fileName
.
EqualTo
(
"ch2"
)
)
{
Nchannel
=
2
;
}
//rewrite using while-loop
if
(
fileName
.
EqualTo
(
"ch3"
)
)
{
Nchannel
=
3
;
}
for
(
i
=
0
;
i
<
100000
;
i
++
){
if
(
fileName
.
EqualTo
(
"ch4"
)
)
{
Nchannel
=
4
;
}
n
=
i
/
1000
;
// if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<<i<<" "<<n<<endl;}
cout
<<
fileName
.
Data
()
<<
" "
<<
p
<<
" nchannel = "
<<
Nchannel
<<
endl
;
myfile1
>>
amp
;
if
(
fileName
.
BeginsWith
(
"ch"
)
||
fileName
.
BeginsWith
(
"//"
)
)
continue
;
//есть строки ch1,2
time
=
5e-013
+
(
i
-
1000
*
n
)
*
1e-010
;
myfile1
.
open
(
fileName
.
Data
()
);
A
[
i
-
1000
*
n
]
=
amp
;
if
(
myfile1
.
is_open
())
{
T
[
i
-
1000
*
n
]
=
time
;
//cout<<" I found data! number "<<endl;
amp
=
time
=
0
;
event
->
SetAmp
(
amp
,
i
-
1000
*
n
);
event
->
SetTime
(
time
,
i
-
1000
*
n
);
while
(
!
myfile1
.
eof
())
{
line
.
ReadLine
(
myfile1
);
if
(
i
-
1000
*
n
==
999
)
{
n
=
i
/
1000
;
// if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<<i<<" "<<n<<endl;}
tree
->
Fill
();
time
=
5e-013
+
(
i
-
1000
*
n
)
*
1e-010
;
for
(
j
=
0
;
j
<
1000
;
j
++
){
sscanf
(
line
.
Data
(),
"%lf"
,
&
amp
);
T
[
j
]
=
0
;
A
[
i
-
1000
*
n
]
=
amp
;
A
[
j
]
=
0
;
T
[
i
-
1000
*
n
]
=
time
;
Nevent
[
Nchannel
-
1
]
->
SetAmp
(
amp
,
i
-
1000
*
n
);
Nevent
[
Nchannel
-
1
]
->
SetTime
(
time
,
i
-
1000
*
n
);
if
(
i
-
1000
*
n
==
999
)
{
tree
->
Fill
();
for
(
j
=
0
;
j
<
1000
;
j
++
){
T
[
j
]
=
0
;
A
[
j
]
=
0
;
}
Nevent
[
Nchannel
-
1
]
->
Reset
();
}
i
++
;
}
}
}
else
{
event
->
Reset
();
cout
<<
" asdasdasd "
<<
endl
;
}
Error
(
"read.cpp"
,
"Some error when opening file %s"
,
fileName
.
Data
());
}
return
;
myfile1
.
close
();
ifstream
myfile2
;
myfile2
.
open
(
"ch12016.12.07-08.48.05.dat"
);
for
(
i
=
0
;
i
<
100000
;
i
++
){
n
=
i
/
1000
;
// if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<<i<<" "<<n<<endl;}
myfile2
>>
A
[
i
-
1000
*
n
];
T
[
i
-
1000
*
n
]
=
5e-013
+
(
i
-
1000
*
n
)
*
1e-010
;
if
(
i
-
1000
*
n
==
999
){
tree
->
Fill
();
for
(
j
=
0
;
j
<
1000
;
j
++
){
T
[
j
]
=
0
;
A
[
j
]
=
0
;
}
}
myfile1
.
close
();
}
}
myfile
.
close
();
}
}
myfile2
.
close
();
else
{
Error
(
"read.cpp"
,
"Some error when opening file"
,
"infiles.dat"
);
return
;}
ifstream
myfile3
;
////////////////
myfile3
.
open
(
"ch12016.12.07-10.03.01.dat"
);
for
(
i
=
0
;
i
<
29000
;
i
++
){
n
=
i
/
1000
;
// if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<<i<<" "<<n<<endl;}
myfile3
>>
A
[
i
-
1000
*
n
];
T
[
i
-
1000
*
n
]
=
5e-013
+
(
i
-
1000
*
n
)
*
1e-010
;
if
(
i
-
1000
*
n
==
999
)
{
tree
->
Fill
();
TString
name
;
name
.
Form
(
"../data/rawDataTektronix/ch%d2016.12.07-02.11.54.dat"
,
1
);
////////////
for
(
j
=
0
;
j
<
1000
;
j
++
){
ifstream
myfile1
;
T
[
j
]
=
0
;
A
[
j
]
=
0
;
myfile1
.
open
(
name
.
Data
());
}
if
(
!
myfile1
.
is_open
())
{
}
Error
(
"read.c"
,
"Some error when opening file"
);
return
;
}
}
myfile3
.
close
();
i
=
0
;
myfile1
.
close
();
tree
->
Write
();
tree
->
Write
();
f1
->
Close
();
f1
->
Close
();
}
}
Double_t
asdasd
()
{
cout
<<
"Function called!!!!!!!!!!!"
<<
endl
;
}
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