Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MakeTree.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MakeTree.C
1 #ifndef MACRO_MAKETREE_C
2 #define MACRO_MAKETREE_C
3 
4 // here you need your package name (set in configure.ac)
5 #include <mytree/MakeSimpleTree.h>
6 
7 #include <fun4all/SubsysReco.h>
13 
14 #include <phool/recoConsts.h>
15 
16 R__LOAD_LIBRARY(libfun4all.so)
17 R__LOAD_LIBRARY(libmytree.so)
18 
19 void MakeTree()
20 {
22 
23  // since it doesn't matter we use a dummy input manager which just
24  // drives the event loop with a runnumber of 310000
26  rc->set_IntFlag( "RUNNUMBER", 310000);
28  se->registerInputManager( in );
29 
30  // normally it's a good idea to have the name of the module
31  // as argument. The name is needed if you want to have this module
32  // discard events from the output. In case you want to run a few of these
33  // modules you need to be able to set unique names somewhere
34  SubsysReco *mytree = new MakeSimpleTree("MYTREE");
35  se->registerSubsystem(mytree);
36  Fun4AllOutputManager *out = new Fun4AllDstOutputManager("OUT","mytree.root");
37  // This is one of the few places where the name of a module is actually important -
38  // e.g. using duplicate names will definitely screw you here
39  // The AddEventSelector tells the output manager which module can discard events
40  // multiple modules are allowed (no list, you need an AddEventSelector line for
41  // every module).
42  out->AddEventSelector("MYTREE");
43  // this adds these nodes to the output (if you do not select any the default is to
44  // write all nodes. The nodes under The RunNode are always saved entirely
45  out->AddNode("MYSIMPLETREE");
46  out->AddNode("MYTCARRAY");
47  se->registerOutputManager(out);
48  se->run(100);
49  se->End();
50  delete se;
51  gSystem->Exit(0);
52 }
53 
54 #endif