Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:21:37

0001 #ifndef MACRO_MAKETREE_C
0002 #define MACRO_MAKETREE_C
0003 
0004 // here you need your package name (set in configure.ac)
0005 #include <mytree/MakeSimpleTree.h>
0006 
0007 #include <fun4all/SubsysReco.h>
0008 #include <fun4all/Fun4AllServer.h>
0009 #include <fun4all/Fun4AllInputManager.h>
0010 #include <fun4all/Fun4AllDstOutputManager.h>
0011 #include <fun4all/Fun4AllOutputManager.h>
0012 #include <fun4all/Fun4AllDummyInputManager.h>
0013 
0014 #include <phool/recoConsts.h>
0015 
0016 R__LOAD_LIBRARY(libfun4all.so)
0017 R__LOAD_LIBRARY(libmytree.so)
0018 
0019 void  MakeTree()
0020 {
0021   Fun4AllServer *se = Fun4AllServer::instance();
0022 
0023   // since it doesn't matter we use a dummy input manager which just
0024   // drives the event loop with a runnumber of 310000
0025   recoConsts *rc = recoConsts::instance();
0026     rc->set_IntFlag( "RUNNUMBER", 310000);
0027   Fun4AllInputManager *in = new Fun4AllDummyInputManager( "DSTin");
0028   se->registerInputManager( in );
0029 
0030   // normally it's a good idea to have the name of the module
0031   // as argument. The name is needed if you want to have this module
0032   // discard events from the output. In case you want to run a few of these
0033   // modules you need to be able to set unique names somewhere
0034   SubsysReco *mytree = new MakeSimpleTree("MYTREE");
0035   se->registerSubsystem(mytree);
0036   Fun4AllOutputManager *out = new Fun4AllDstOutputManager("OUT","mytree.root");
0037   // This is one of the few places where the name of a module is actually important - 
0038   // e.g. using duplicate names will definitely screw you here
0039   // The AddEventSelector tells the output manager which module can discard events
0040   // multiple modules are allowed (no list, you need an AddEventSelector line for
0041   // every module).
0042   out->AddEventSelector("MYTREE");
0043   // this adds these nodes to the output (if you do not select any the default is to
0044   // write all nodes. The nodes under The RunNode are always saved entirely
0045   out->AddNode("MYSIMPLETREE");
0046   out->AddNode("MYTCARRAY");
0047   se->registerOutputManager(out);
0048   se->run(100);
0049   se->End();
0050   delete se;
0051   gSystem->Exit(0);
0052 }
0053 
0054 #endif