BOSS
7.1.3
BESIII Offline Software System
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
a
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
v
w
x
z
Typedefs
c
d
e
g
h
i
l
m
n
o
p
r
s
t
Enumerations
Enumerator
a
b
c
d
e
f
i
k
l
m
n
o
p
r
s
t
u
w
x
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
m
n
p
r
s
t
v
w
Enumerations
b
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
v
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Related Symbols
:
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
v
w
x
Files
File List
File Members
All
!
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
!
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
!
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
h
i
j
k
l
m
n
p
r
s
t
u
v
w
z
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
k
m
n
o
p
r
s
t
u
w
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
▼
BOSS
Used Packages
Requirements
►
How to use the ERS package
Todo List
►
Namespaces
►
Classes
▼
Files
▼
File List
▼
7.1.3
►
Analysis
►
BesCxxPolicy
►
BesExamples
►
BesPolicy
►
Calibration
►
Control
►
Database
►
DetectorDescription
►
DistBoss
►
DQA
►
Emc
►
Event
►
EventDisplay
►
EventFilter
►
EvtPreSelect
►
External
►
Generator
►
InstallArea
►
LumTauAlg
►
MagneticField
▼
Mdc
▼
DedxCalibAlg
▼
DedxCalibAlg-00-02-01
►
DedxCalibAlg
▼
share
►
shell
▼
template
►
CheckChargeSpace
►
CheckRung
►
Costheta
►
CosthetaSec
►
Curve
►
DocaEangle
►
DocaEangleSec
►
Eangle1D
►
Eangle1DSec
►
FirstRung
►
HadronCalib
►
HadronConstants
►
RungCos
►
RungCosSec
►
RungDoca
►
RungDocaSec
►
RungEangle
►
RungWire
►
select
▼
Simulation
►
check
►
hadron_track
▼
histgen
►
betagamma.cxx
►
binning.cxx
►
binning.h
►
curve.h
►
draw_check_curve.cxx
►
draw_illustration_hist.cxx
►
drawmom.cxx
►
global.h
►
histgen.cxx
►
prepare_data.cxx
►
root_to_csv.cxx
►
test.cxx
►
T0
►
WireGain
►
src
►
DedxCorrecSvc
►
DedxCurSvc
►
DedxSimSvc
►
MdcAlignAlg
►
MdcCalibAlg
►
MdcCalibFunSvc
►
MdcCheckUtil
►
MdcGeomSvc
►
MdcHvDropSvc
►
MdcNavigation
►
MdcRawEvent
►
MdcRecEvent
►
MdcTables
►
Muc
►
OfflineEvtFilter
►
Reconstruction
►
RootPolicy
►
Simulation
►
Tof
►
Trigger
►
Utilities
►
Validation
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
root_to_csv.cxx
Go to the documentation of this file.
1
#include <iostream>
2
#include "TFile.h"
3
#include "TTree.h"
4
#include <fstream>
5
using namespace
std
;
6
7
void
root_to_csv
(){
8
TFile *
f
=
new
TFile(
"pre_data.root"
);
// opens the root file
9
TTree *
tr
=(TTree*)
f
->Get(
"n103"
);
// creates the TTree object
10
//tr->Scan(); // prints the content on the screen
11
12
Float_t de, co, ch,
bg
;
13
Int_t nh;
// create variables of the same type as the branches you want to access
14
15
tr
->SetBranchAddress(
"dEdx_meas"
,&de);
// for all the TTree branches you need this
16
tr
->SetBranchAddress(
"costheta"
,&co);
17
tr
->SetBranchAddress(
"charge"
,&ch);
18
tr
->SetBranchAddress(
"bg"
,&
bg
);
19
tr
->SetBranchAddress(
"nhits"
,&nh);
20
21
ofstream myfile;
22
myfile.open (
"pre_data.txt"
);
23
24
for
(
int
i=0; i<
tr
->GetEntries(); i++){
25
// loop over the tree
26
tr
->GetEntry(i);
27
myfile << de <<
","
<< co <<
","
<< ch <<
","
<<
bg
<<
","
<< nh <<
"\n"
;
//write to file
28
}
29
myfile.close();
30
}
7
void
root_to_csv
() {
…
}
f
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
tr
DOUBLE_PRECISION tr[3]
Definition
EvtPhokharaDef.hh:67
std
Definition
RootEventData/RootEventData_rootcint.cxx:38
bg
float bg
Definition
prepare_data.cxx:28
root_to_csv
void root_to_csv()
Definition
root_to_csv.cxx:7
7.1.3
Mdc
DedxCalibAlg
DedxCalibAlg-00-02-01
share
template
Simulation
histgen
root_to_csv.cxx
Generated by
1.13.2