EIC 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 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3 #include <fun4all/SubsysReco.h>
9 #include <phool/recoConsts.h>
10 // here you need your package name (set in configure.ac)
11 #include <mytree/MakeSimpleTree.h>
12 R__LOAD_LIBRARY(libfun4all.so)
13 R__LOAD_LIBRARY(libmytree.so)
14 #endif
15 
16 void MakeTree()
17 {
18  gSystem->Load("libmytree.so");
20 
21  // since it doesn't matter we use a dummy input manager which just
22  // drives the event loop with a runnumber of 310000
24  rc->set_IntFlag( "RUNNUMBER", 310000);
26  se->registerInputManager( in );
27 
28  // normally it's a good idea to have the name of the module
29  // as argument. The name is needed if you want to have this module
30  // discard events from the output. In case you want to run a few of these
31  // modules you need to be able to set unique names somewhere
32  SubsysReco *mytree = new MakeSimpleTree("MYTREE");
33  se->registerSubsystem(mytree);
34  Fun4AllOutputManager *out = new Fun4AllDstOutputManager("OUT","mytree.root");
35  // This is one of the few places where the name of a module is actually important -
36  // e.g. using duplicate names will definitely screw you here
37  // The AddEventSelector tells the output manager which module can discard events
38  // multiple modules are allowed (no list, you need an AddEventSelector line for
39  // every module).
40  out->AddEventSelector("MYTREE");
41  // this adds these nodes to the output (if you do not select any the default is to
42  // write all nodes. The nodes under The RunNode are always saved entirely
43  out->AddNode("MYSIMPLETREE");
44  out->AddNode("MYTCARRAY");
45  se->registerOutputManager(out);
46  se->run(100);
47  se->End();
48  delete se;
49  gSystem->Exit(0);
50 }