6 const std::string& outputFileName=
"conductivity_experiment.root"
7 ,
unsigned int numDataPoints=1000000){
9 TFile ofile(outputFileName.c_str(),
"RECREATE");
12 TTree cond_data(
"cond_data",
"Example N-Tuple");
15 float pot,cur,temp,pres;
16 cond_data.
Branch(
"Potential", &pot,
"Potential/F");
17 cond_data.
Branch(
"Current", &cur,
"Current/F");
18 cond_data.
Branch(
"Temperature", &temp,
"Temperature/F");
19 cond_data.
Branch(
"Pressure", &pres,
"Pressure/F");
21 for (
int i=0;i<numDataPoints;++i){
26 cur=pot/(10.+0.05*(temp-300.)-0.2*(pres-1.))*
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
void Close(Option_t *option="") override
Close a file.
A TTree represents a columnar dataset.
virtual Int_t Fill()
Fill all branches.
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
Write this object to the current directory.
void write_ntuple_to_file_advanced(const std::string &outputFileName="conductivity_experiment.root", unsigned int numDataPoints=1000000)