Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Fun4AllServer.h
Go to the documentation of this file.
1 #ifndef FUN4ALLSERVER_H
2 #define FUN4ALLSERVER_H
3 
4 #include "Fun4AllBase.h"
5 #include "Fun4AllHistoManager.h"
6 
7 #include <phool/PHTimer.h>
8 
9 #include <iostream>
10 #include <map>
11 #include <string>
12 #include <vector>
13 
15 class Fun4AllSyncManager;
17 class PHCompositeNode;
18 class PHTimeStamp;
19 class SubsysReco;
20 class TDirectory;
21 class TH1;
22 class TNamed;
23 
24 class Fun4AllServer : public Fun4AllBase
25 {
26  public:
27  static Fun4AllServer *instance();
28  virtual ~Fun4AllServer();
29 
30  virtual bool registerHisto(const char *hname, TNamed *h1d, const int replace = 0);
31  virtual bool registerHisto(TNamed *h1d, const int replace = 0);
32  template <typename T>
33  T *makeHisto(T *t)
34  {
35  return ServerHistoManager->makeHisto(t);
36  }
37  virtual int isHistoRegistered(const std::string &name) const;
38 
39  int registerSubsystem(SubsysReco *subsystem, const std::string &topnodename = "TOP");
40  int unregisterSubsystem(SubsysReco *subsystem);
41  SubsysReco *getSubsysReco(const std::string &name);
43  Fun4AllOutputManager *getOutputManager(const std::string &name);
45  Fun4AllHistoManager *getHistoManager(const std::string &name);
46  TNamed *getHisto(const std::string &hname) const;
47  TNamed *getHisto(const unsigned int ihisto) const;
48  const char *getHistoName(const unsigned int ihisto) const;
49  virtual void Print(const std::string &what = "ALL") const;
50 
51  void InitAll();
52  int BeginRunTimeStamp(PHTimeStamp &TimeStp);
53  int dumpHistos(const std::string &filename = "", const std::string &openmode = "RECREATE");
55  int Reset();
56  virtual int BeginRun(const int runno);
57  virtual int EndRun(const int runno = 0);
58  virtual int End();
59  PHCompositeNode *topNode() const { return TopNode; }
60  PHCompositeNode *topNode(const std::string &name);
61  int outfileclose();
62  virtual int process_event();
63  PHCompositeNode *getNode(const char *name, const char *topnodename = "TOP");
64  int AddTopNode(const std::string &name);
65  int MakeNodesTransient(PHCompositeNode *startNode);
66  int MakeNodesPersistent(PHCompositeNode *startNode);
67 
68  int AddComplaint(const std::string &complaint, const std::string &remedy);
69 
70  // Interface to the default Input Master
72  Fun4AllInputManager *getInputManager(const char *name);
73  int PrdfEvents() const;
74  int DstEvents() const;
75 
77  int run(const int nevnts = 0, const bool require_nevents = false);
78 
83  int skip(const int nevnts = 0);
84 
85  int fileopen(const char *managername = "NONE", const char *filename = "NONE");
86  int fileclose(const std::string &managername = "");
87  int SegmentNumber();
88  int ResetNodeTree();
89  int BranchSelect(const char *managername, const char *branch, int iflag);
90  int BranchSelect(const char *branch, int iflag);
91  int setBranches(const char *managername);
92  int setBranches();
93  virtual int DisconnectDB();
94  virtual void identify(std::ostream &out = std::cout) const;
95  unsigned GetTopNodes(std::vector<std::string> &names) const;
96  void GetInputFullFileList(std::vector<std::string> &fnames) const;
97  void GetOutputManagerList(std::vector<std::string> &names) const;
98  void GetModuleList(std::vector<std::string> &names) const;
99  Fun4AllSyncManager *getSyncManager(const std::string &name = "DefaultSyncManager");
100  int registerSyncManager(Fun4AllSyncManager *newmaster);
101  int retcodestats(const int iret) { return retcodesmap[iret]; }
102  void EventNumber(const int evtno) { eventnumber = evtno; }
103  void NodeIdentify(const std::string &name);
104  void KeepDBConnection(const int i = 1) { keep_db_connected = i; }
105  void PrintTimer(const std::string &name = "");
106 
107  protected:
108  Fun4AllServer(const std::string &name = "Fun4AllServer");
110  int CountOutNodes(PHCompositeNode *startNode);
111  int CountOutNodesRecursive(PHCompositeNode *startNode, const int icount);
114  int setRun(const int runnumber);
122  std::vector<std::string> ComplaintList;
124  std::vector<std::pair<SubsysReco *, PHCompositeNode *> > Subsystems;
125  std::vector<std::pair<SubsysReco *, PHCompositeNode *> > DeleteSubsystems;
126  std::vector<int> RetCodes;
127  std::vector<Fun4AllOutputManager *> OutputManager;
128  std::vector<TDirectory *> TDirCollection;
130  std::vector<Fun4AllHistoManager *> HistoManager;
131  std::map<std::string, PHCompositeNode *> topnodemap;
133  std::string default_Tdirectory;
135  std::vector<Fun4AllSyncManager *> SyncManagers;
136  std::map<int, int> retcodesmap;
137  std::map<const std::string, PHTimer> timer_map;
140 };
141 
142 #endif /* __FUN4ALLSERVER_H */
std::vector< std::string > ComplaintList
int registerInputManager(Fun4AllInputManager *InManager)
int AddComplaint(const std::string &complaint, const std::string &remedy)
virtual int End()
int registerSyncManager(Fun4AllSyncManager *newmaster)
std::vector< Fun4AllOutputManager * > OutputManager
static Fun4AllServer * __instance
int BeginRunTimeStamp(PHTimeStamp &TimeStp)
std::vector< Fun4AllSyncManager * > SyncManagers
PHTimeStamp * beginruntimestamp
virtual int EndRun(const int runno=0)
void GetInputFullFileList(std::vector< std::string > &fnames) const
virtual void Print(const std::string &what="ALL") const
int retcodestats(const int iret)
Fun4AllInputManager * getInputManager(const char *name)
void GetModuleList(std::vector< std::string > &names) const
int AddTopNode(const std::string &name)
Fun4AllSyncManager * getSyncManager(const std::string &name="DefaultSyncManager")
int fileopen(const char *managername="NONE", const char *filename="NONE")
TNamed * getHisto(const std::string &hname) const
static Fun4AllServer * instance()
void PrintTimer(const std::string &name="")
Fun4AllServer(const std::string &name="Fun4AllServer")
virtual int DisconnectDB()
unsigned GetTopNodes(std::vector< std::string > &names) const
int registerHistoManager(Fun4AllHistoManager *manager)
int skip(const int nevnts=0)
skip n events (0 means up to the end of file). Skip means read, don&#39;t process.
int dumpHistos(const std::string &filename="", const std::string &openmode="RECREATE")
int MakeNodesPersistent(PHCompositeNode *startNode)
std::string default_Tdirectory
Fun4AllHistoManager * ServerHistoManager
std::vector< std::pair< SubsysReco *, PHCompositeNode * > > DeleteSubsystems
int registerSubsystem(SubsysReco *subsystem, const std::string &topnodename="TOP")
std::map< int, int > retcodesmap
int unregisterSubsystemsNow()
PHCompositeNode * getNode(const char *name, const char *topnodename="TOP")
std::map< const std::string, PHTimer > timer_map
int run(const int nevnts=0, const bool require_nevents=false)
run n events (0 means up to end of file)
int CountOutNodes(PHCompositeNode *startNode)
Fun4AllHistoManager * getHistoManager(const std::string &name)
int registerOutputManager(Fun4AllOutputManager *manager)
std::vector< int > RetCodes
const char * getHistoName(const unsigned int ihisto) const
std::vector< Fun4AllHistoManager * > HistoManager
virtual int process_event()
void EventNumber(const int evtno)
int DstEvents() const
int unregisterSubsystem(SubsysReco *subsystem)
PHCompositeNode * topNode() const
Definition: Fun4AllServer.h:59
std::map< std::string, PHCompositeNode * > topnodemap
virtual int isHistoRegistered(const std::string &name) const
int BranchSelect(const char *managername, const char *branch, int iflag)
virtual bool registerHisto(const char *hname, TNamed *h1d, const int replace=0)
virtual void identify(std::ostream &out=std::cout) const
Fun4AllOutputManager * getOutputManager(const std::string &name)
int InitNodeTree(PHCompositeNode *topNode)
void GetOutputManagerList(std::vector< std::string > &names) const
std::vector< std::pair< SubsysReco *, PHCompositeNode * > > Subsystems
SubsysReco * getSubsysReco(const std::string &name)
void NodeIdentify(const std::string &name)
int UpdateEventSelector(Fun4AllOutputManager *manager)
Fun4AllSyncManager * defaultSyncManager
int fileclose(const std::string &managername="")
virtual int BeginRun(const int runno)
T * makeHisto(T *t)
Definition: Fun4AllServer.h:33
high precision timer
int PrdfEvents() const
int setRun(const int runnumber)
int CountOutNodesRecursive(PHCompositeNode *startNode, const int icount)
PHCompositeNode * TopNode
int MakeNodesTransient(PHCompositeNode *startNode)
virtual ~Fun4AllServer()
void KeepDBConnection(const int i=1)
std::vector< TDirectory * > TDirCollection