Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
garsoft
Ana
ParamSim
main
cafanatree_module.cxx
Go to the documentation of this file.
1
#include "CAF.h"
2
#include "TFile.h"
3
#include "TTree.h"
4
5
#include <iostream>
6
#include <string>
7
8
////////////////////////////////////////////////////////////////////////
9
//// Class: cafanatree
10
//// File Name: cafanatree_module.cc
11
////
12
//// Authors: Tanaz Mohayai and Eldwan Brianne
13
//// To run this module:
14
//// 1) cd Build
15
//// 2) rm -rf *
16
//// 3) cmake ${module home direcory}
17
//// 4) make install
18
//// 5) cd ${module home direcory}
19
//// 6) bin/cafanatree_module --infile ${name of the anatree file that is output from anatree module, not to be confused with edepsim file} --outfile ${a name of your choosing for the output file}
20
//////////////////////////////////////////////////////////////////////////
21
22
void
ShowHelp
()
23
{
24
std::cout <<
"./cafanatree_module --infile <inputfile> --outfile <outputfile> --correct4origin <0/1> --originTPC <x> <y> <z> (in cm)"
<<
std::endl
;
25
}
26
27
int
main
(
int
argc,
char
const
*
argv
[] )
28
{
29
if
( argc == 1 || ((argc == 2) && ((
std::string
(
"--help"
) == argv[1]) || (
std::string
(
"-h"
) == argv[1]))) || argc < 8 ){
30
ShowHelp
();
31
return
2;
32
}
33
34
if
( argv[1] !=
std::string
(
"--infile"
) || argv[3] !=
std::string
(
"--outfile"
) || argv[5] !=
std::string
(
"--correct4origin"
) || argv[7] !=
std::string
(
"--originTPC"
) ) {
35
ShowHelp
();
36
return
-2;
37
}
38
39
// get command line options
40
std::string
outfile
=
""
;
41
std::string
infile
=
""
;
42
std::string
correct4origin =
""
;
43
std::string
x
,
y
,
z
=
""
;
44
int
p
= 0;
45
while
( p < argc )
46
{
47
if
( argv[p] ==
std::string
(
"--infile"
) ){
48
infile = argv[p+1];
49
p++;
50
}
51
else
if
( argv[p] ==
std::string
(
"--outfile"
) ){
52
outfile = argv[p+1];
53
p++;
54
}
55
else
if
( argv[p] ==
std::string
(
"--correct4origin"
) ){
56
correct4origin = argv[p+1];
57
p++;
58
}
59
else
if
( argv[p] ==
std::string
(
"--originTPC"
) ){
60
//origin fixed
61
if
( argc == 11 )
62
{
63
x = argv[p+1];
64
y = argv[p+2];
65
z = argv[p+3];
66
p += 3;
67
}
68
else
{
69
std::cout <<
"Missing an origin coordinate!"
<<
std::endl
;
70
ShowHelp
();
71
return
-2;
72
}
73
}
74
else
{
75
p++;
76
}
77
}
78
79
if
(correct4origin !=
"0"
&& correct4origin !=
"1"
)
80
{
81
ShowHelp
();
82
return
-2;
83
}
84
85
if
( x ==
""
&& y ==
""
&& z ==
""
)
86
{
87
printf(
"No TPC offset given, defaulting to (0, 0, 0)!!\n"
);
88
x = y = z =
"0"
;
89
}
90
91
printf(
"Making CAF from tree dump: %s\n"
, infile.c_str() );
92
printf(
"Output CAF file: %s\n"
, outfile.c_str() );
93
printf(
"Correct for Origin: %s\n"
, correct4origin.c_str() );
94
printf(
"TPC offset: (%s, %s, %s) cm\n"
, x.c_str(), y.c_str(), z.c_str() );
95
96
double
originTPC[3] = {std::atof(x.c_str()), std::atof(y.c_str()), std::atof(z.c_str())};
97
98
CAF
*
caf
=
new
CAF
(infile, outfile, std::atoi(correct4origin.c_str()), &originTPC[0]);
99
if
(not caf->BookTFile())
return
-1;
100
101
caf->loop();
102
103
caf->WriteTTree();
104
printf(
"-30-\n"
);
105
caf->CloseTFile();
106
107
return
0;
108
}
string
std::string string
Definition:
nybbler.cc:12
make_norm_csv.outfile
outfile
Definition:
make_norm_csv.py:55
freeze_graph.argv
argv
Definition:
freeze_graph.py:218
makePolycone.z
z
Definition:
makePolycone.py:153
ShowHelp
void ShowHelp()
Definition:
cafanatree_module.cxx:22
infile
string infile
Definition:
INukeNucleonCorr.cxx:62
test.p
p
Definition:
test.py:223
wirecell.validate.cmaps.y
y
Definition:
cmaps.py:73
CAF
Definition:
CAF.h:12
main
int main(int argc, char const *argv[])
Definition:
cafanatree_module.cxx:27
train.x
list x
Definition:
train.py:276
caf
Common Analysis Files.
Definition:
SRGAr.h:13
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11