26 TString filename =
"cernstaff.root";
30 FILE *fp = fopen(
Form(
"%scernstaff.dat", dir.
Data()),
"r");
51 printf(
"you must run the script in a directory with write access\n");
55 auto tree =
new TTree(
"T",
"CERN 1988 staff data");
56 tree->Branch(
"Category", &Category,
"Category/I");
57 tree->Branch(
"Flag", &Flag,
"Flag/i");
58 tree->Branch(
"Age", &Age,
"Age/I");
59 tree->Branch(
"Service", &Service,
"Service/I");
60 tree->Branch(
"Children", &Children,
"Children/I");
61 tree->Branch(
"Grade", &Grade,
"Grade/I");
62 tree->Branch(
"Step", &Step,
"Step/I");
63 tree->Branch(
"Hrweek", &Hrweek,
"Hrweek/I");
64 tree->Branch(
"Cost", &Cost,
"Cost/I");
65 tree->Branch(
"Division", Division,
"Division/C");
66 tree->Branch(
"Nation", Nation,
"Nation/C");
68 while (fgets(
line, 80, fp)) {
69 sscanf(&
line[0],
"%d %d %d %d %d %d %d %d %d %s %s",
70 &Category, &Flag, &Age, &Service, &Children, &Grade, &Step, &Hrweek, &Cost, Division, Nation);
int Int_t
Signed integer 4 bytes (int).
char Char_t
Character 1 byte (char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TString & Append(const char *cs)
A TTree represents a columnar dataset.
void Step(const gsl_rng *r, void *xp, double step_size)