Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Riccardo Longo
JZCaPA
Commits
bc328592
Commit
bc328592
authored
Nov 05, 2021
by
Chad Lantz
Browse files
Added run tags
parent
6aa991d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Analysis/include/DataReader2021.h
View file @
bc328592
...
...
@@ -54,6 +54,7 @@ class DataReader2021{
void
SetDebugMode
(
)
{
m_debug
=
true
;
}
void
SetVerbosity
(
int
_level
){
m_verbose
=
_level
;
}
void
SetOutputDirectory
(
std
::
string
_dir
){
m_outputDir
=
_dir
;
}
void
SetOutputTag
(
std
::
string
_tag
)
{
m_outputTag
=
_tag
;
}
void
UpdateConsole
(
Long_t
_updateRate
);
int
GetMaxEvents
(
void
)
{
return
m_maxEvents
;
}
...
...
@@ -85,6 +86,8 @@ class DataReader2021{
TTree
*
m_tOut
;
// Output directory
std
::
string
m_outputDir
=
""
;
// Output tag for file/directory naming
std
::
string
m_outputTag
=
""
;
//Maximum events to be processed in a run
int
m_maxEvents
=
-
1
;
...
...
Analysis/src/DataReader2021.cpp
View file @
bc328592
...
...
@@ -543,17 +543,20 @@ void DataReader2021::Initialize(){
std
::
cout
<<
Form
(
"Reading Input File: %s"
,
m_fNameIn
.
c_str
())
<<
std
::
endl
;
// If no output directory is specified by the user
// one is created for this run in $JZCaPA/results
if
(
m_outputDir
==
""
){
m_outputDir
=
(
std
::
string
)
std
::
getenv
(
"JZCaPA"
)
+
Form
(
"/results/run%d/"
,
m_runNumber
);
gSystem
->
Exec
(
(
"mkdir -p "
+
m_outputDir
).
c_str
()
);
}
// one is created for this run in $JZCaPA/results. Default is $JZCaPA/results/
// If an output tag has been chosen, use it to name the directory. Default is "run"
std
::
string
outDir
=
(
m_outputDir
!=
""
)
?
m_outputDir
:
(
std
::
string
)
std
::
getenv
(
"JZCaPA"
)
+
"/results"
;
std
::
string
dirName
=
(
m_outputTag
==
""
)
?
"run"
:
m_outputTag
;
m_outputDir
+=
Form
(
"/%s%d/"
,
dirName
.
c_str
(),
m_runNumber
);
gSystem
->
Exec
(
(
"mkdir -p "
+
m_outputDir
).
c_str
()
);
// If we are reading a list of files, or have no run number
// make default name output.root, otherwise make it
// outputN.root, where N is a run number of a file.
// If an output tag has been chosen, use it to name the file
std
::
string
fTag
=
(
m_outputTag
==
""
)
?
"output"
:
m_outputTag
;
std
::
string
fNameOut
=
m_readListOfFiles
?
(
m_outputDir
+
"output.root"
)
:
Form
(
(
m_outputDir
+
"
output
%d.root"
).
c_str
(),
m_runNumber
);
(
m_outputDir
+
fTag
+
".root"
).
c_str
(
)
:
Form
(
(
m_outputDir
+
"
%s
%d.root"
).
c_str
(),
fTag
.
c_str
(),
m_runNumber
);
m_fOut
=
new
TFile
(
fNameOut
.
c_str
(),
"RECREATE"
);
m_tOut
=
new
TTree
(
"AnalysisTree"
,
"AnalysisTree"
);
...
...
Analysis/userFunctions/AnalysisExample2021.cpp
View file @
bc328592
...
...
@@ -23,7 +23,8 @@ namespace {
void
PrintUsage
()
{
std
::
cout
<<
" Usage: AnalysisExample2021 [-d /path/to/input/files/ ] [-f /list/of.root /files/here.root]"
<<
std
::
endl
<<
" [-o /output/directory/] [-c /config/file.xml] [-a /alignment/file.xml]"
<<
std
::
endl
<<
" [-s /survey/file.xml] [-t /timing/file.txt] [-n #events] [-v (verbose)] [--help]"
<<
std
::
endl
;
<<
" [-s /survey/file.xml] [-t /timing/file.txt] [-tag tag] [-n #events]"
<<
std
::
endl
<<
" [-v (verbose)] [--help]"
<<
std
::
endl
;
}
}
...
...
@@ -39,6 +40,7 @@ void PrintHelp(){
std
::
cout
<<
" a Alignment file to be used"
<<
std
::
endl
;
std
::
cout
<<
" s Survey file to be used"
<<
std
::
endl
;
std
::
cout
<<
" t Timing file to be used"
<<
std
::
endl
;
std
::
cout
<<
" tag Tag the output directory/file"
<<
std
::
endl
;
std
::
cout
<<
" v Verbose. Currently prints event#, CPU/RAM usage if flag is used. Takes no argument"
<<
std
::
endl
;
}
...
...
@@ -82,6 +84,7 @@ int main(int argc, char *argv[]){
std
::
string
config_file
=
""
;
std
::
string
alignment_file
=
""
;
std
::
string
survey_file
=
""
;
std
::
string
output_tag
=
""
;
std
::
string
timing_file
=
(
std
::
string
)
std
::
getenv
(
"JZCaPA"
)
+
"/Utils/Timing_data/2021_PreliminaryTiming.txt"
;
int
verbosity
=
0
;
std
::
vector
<
std
::
string
>
root_files
;
...
...
@@ -105,6 +108,7 @@ int main(int argc, char *argv[]){
else
if
(
TString
(
argv
[
i
])
==
"-a"
)
alignment_file
=
argv
[
i
+
1
];
else
if
(
TString
(
argv
[
i
])
==
"-s"
)
survey_file
=
argv
[
i
+
1
];
else
if
(
TString
(
argv
[
i
])
==
"-t"
)
timing_file
=
argv
[
i
+
1
];
else
if
(
TString
(
argv
[
i
])
==
"-tag"
)
output_tag
=
argv
[
i
+
1
];
else
if
(
TString
(
argv
[
i
])
==
"-v"
)
verbosity
=
1
;
else
if
(
TString
(
argv
[
i
])
==
"--help"
)
PrintHelp
();
else
{
...
...
@@ -128,10 +132,9 @@ int main(int argc, char *argv[]){
DataReader2021
*
r
=
new
DataReader2021
(
nCh
,
nSamp
,
fNameIn
,
runNum
);
r
->
SetVerbosity
(
1
);
if
(
output_dir
!=
""
){
r
->
SetOutputDirectory
(
Form
(
"%s/run%d/"
,
output_dir
.
c_str
(),
runNum
)
);
gSystem
->
Exec
(
Form
(
"mkdir -p %s/run%d/"
,
output_dir
.
c_str
(),
runNum
)
);
}
if
(
output_tag
!=
""
)
r
->
SetOutputTag
(
output_tag
);
if
(
output_dir
!=
""
)
r
->
SetOutputDirectory
(
output_dir
);
//ADD DETECTORS AND WF ANALYSIS VARIABLES
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment