-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroot.cc
More file actions
70 lines (59 loc) · 1.71 KB
/
root.cc
File metadata and controls
70 lines (59 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <cstdint>
#include <TFile.h>
#include <TTree.h>
int main(int argc, char* argv[]) {
//////////////////////////////////////////////////////
//// Check Input Parameters
//////////////////////////////////////////////////////
if (argc != 4) {
printf("Usage: ./Main N M R\n\
N = \n\
M = \n\
R = \n");
return -1;
}
//////////////////////////////////////////////////////
//// Initialize Input Parameters
//////////////////////////////////////////////////////
uint32_t N, M, R;
N = atol(argv[1]);
M = atol(argv[2]);
R = atol(argv[3]);
//////////////////////////////////////////////////////
//// Get pwd for File Saving
//////////////////////////////////////////////////////
std::string pwd;
char cwd[1024];
if (getcwd(cwd,sizeof(cwd)) != NULL)
pwd = cwd;
else {
printf("ERROR: Could not find cwd!\n");
return -1;
}
//////////////////////////////////////////////////////
//// ROOT Setup
//////////////////////////////////////////////////////
std::string outPref, outfileName;
outPref = pwd + "/raw_root/";
outfileName = outPref + "raw_Main.root";
// Create file
TFile *outFile;
outFile = TFile::Open(outfileName.c_str(), "RECREATE");
// Create tree (run)
std::string rT_id = "rawMain";
std::string rT_name = "Raw Main";
TTree *rawT = new TTree(rT_id.c_str(),rT_name.c_str());
// Create the ROOT stuff
//////////////////////////////////////////////////////
//// Do the ROOT Stuff
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//// Finalize ROOT
//////////////////////////////////////////////////////
rawT->Write();
outFile->Close();
return 0;
}