Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Fun4AllRunNodeInputManager.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file Fun4AllRunNodeInputManager.cc
1
#include "
Fun4AllRunNodeInputManager.h
"
2
3
#include "
Fun4AllReturnCodes.h
"
4
#include "
Fun4AllServer.h
"
5
6
#include <
ffaobjects/RunHeader.h
>
7
8
#include <
frog/FROG.h
>
9
10
#include <
phool/PHCompositeNode.h
>
11
#include <
phool/PHNodeIOManager.h
>
12
#include <
phool/PHNodeIntegrate.h
>
13
#include <
phool/getClass.h
>
14
#include <
phool/phool.h
>
// for PHWHERE, PHReadOnly, PHRunTree
15
#include <
phool/phooldefs.h
>
16
17
#include <TSystem.h>
18
19
#include <cstdlib>
20
#include <iostream>
21
22
Fun4AllRunNodeInputManager::Fun4AllRunNodeInputManager
(
const
std::string
&
name
,
23
const
std::string
&nodename,
24
const
std::string
&topnodename)
25
:
Fun4AllDstInputManager
(name, nodename, topnodename)
26
{
27
return
;
28
}
29
30
int
Fun4AllRunNodeInputManager::fileopen
(
const
std::string
&filenam)
31
{
32
Fun4AllServer
*se =
Fun4AllServer::instance
();
33
if
(
IsOpen
())
34
{
35
std::cout <<
"Closing currently open file "
36
<<
FileName
()
37
<<
" and opening "
<< filenam << std::endl;
38
fileclose
();
39
}
40
FileName
(filenam);
41
FROG
frog;
42
fullfilename
= frog.
location
(
FileName
());
43
if
(
Verbosity
() > 0)
44
{
45
std::cout <<
Name
() <<
": opening file "
<<
fullfilename
<< std::endl;
46
}
47
// sanity check - the IManager must be nullptr when this method is executed
48
// if not something is very very wrong and we must not continue
49
if
(
IManager
())
50
{
51
std::cout <<
PHWHERE
<<
" IManager pointer is not nullptr but "
<<
IManager
()
52
<< std::endl;
53
std::cout <<
"Send mail to off-l with this printout and the macro you used"
54
<< std::endl;
55
std::cout <<
"Trying to execute IManager->print() to display more info"
56
<< std::endl;
57
std::cout <<
"Code will probably segfault now"
<< std::endl;
58
IManager
()->
print
();
59
std::cout <<
"Have someone look into this problem - Exiting now"
<< std::endl;
60
exit(1);
61
}
62
IManager
(
new
PHNodeIOManager
(
fullfilename
,
PHReadOnly
,
PHRunTree
));
63
if
(
IManager
()->isFunctional())
64
{
65
runNode
(se->
getNode
(
RunNodeName
(),
TopNodeName
()));
66
IManager
()->
read
(
runNode
());
67
// get the current run number from an existing run noder
68
RunHeader
*runheader = findNode::getClass<RunHeader>(
runNode
(),
"RunHeader"
);
69
if
(runheader)
70
{
71
SetRunNumber
(runheader->
get_RunNumber
());
72
}
73
}
74
// DLW: move the delete outside the if block to cover the case where isFunctional() fails
75
delete
IManager
();
76
IManager
(
nullptr
);
77
IsOpen
(1);
78
return
0;
79
}
80
81
int
Fun4AllRunNodeInputManager::run
(
const
int
/*nevents*/
)
82
{
83
if
(!
IsOpen
())
84
{
85
if
(
FileListEmpty
())
86
{
87
if
(
Verbosity
() > 0)
88
{
89
std::cout <<
Name
() <<
": No Input file open"
<< std::endl;
90
}
91
return
-1;
92
}
93
else
94
{
95
if
(
OpenNextFile
())
96
{
97
std::cout <<
Name
() <<
": No Input file from filelist opened"
<< std::endl;
98
return
-1;
99
}
100
}
101
}
102
return
0;
103
}
coresoftware
blob
master
offline
framework
fun4all
Fun4AllRunNodeInputManager.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:04
using
1.8.2 with
sPHENIX GitHub integration