File indexing completed on 2025-08-06 08:12:52
0001 #pragma once
0002 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
0003 #include <fun4all/SubsysReco.h>
0004 #include <fun4all/Fun4AllServer.h>
0005 #include <fun4all/Fun4AllInputManager.h>
0006 #include <fun4all/Fun4AllDummyInputManager.h>
0007 #include <fun4all/Fun4AllOutputManager.h>
0008 #include <fun4all/Fun4AllDstInputManager.h>
0009 #include <fun4all/Fun4AllNoSyncDstInputManager.h>
0010 #include <fun4all/Fun4AllDstOutputManager.h>
0011 #include <phhepmc/Fun4AllHepMCInputManager.h>
0012 #include <phool/recoConsts.h>
0013 #include <eicana/DISKinematicsReco.h>
0014 R__LOAD_LIBRARY(libfun4all.so)
0015 R__LOAD_LIBRARY(libphhepmc.so)
0016 R__LOAD_LIBRARY(libeicana.so)
0017 #endif
0018
0019 using namespace std;
0020
0021 int Fun4All_EICAnalysis_DIS(
0022 const int nEvents = 100,
0023 const char * inputFile = "/sphenix/user/baschmoo/standard/macros/macros/g4simulations/G4EICDetector.root",
0024 const char * outputFile = "output.root"
0025 )
0026 {
0027
0028 bool readdst = true;
0029 bool readhepmc = false;
0030
0031
0032
0033
0034
0035 gSystem->Load("libfun4all.so");
0036 gSystem->Load("libphhepmc.so");
0037 gSystem->Load("libeicana.so");
0038
0039
0040
0041
0042
0043 Fun4AllServer *se = Fun4AllServer::instance();
0044 se->Verbosity(0);
0045
0046 recoConsts *rc = recoConsts::instance();
0047
0048
0049
0050
0051
0052 DISKinematicsReco *ana = new DISKinematicsReco(outputFile);
0053 ana->set_do_process_truth( true );
0054 ana->set_do_process_geant4_cluster( true );
0055 se->registerSubsystem( ana );
0056
0057
0058
0059
0060
0061
0062 if ( readdst )
0063 {
0064 Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
0065 hitsin->fileopen(inputFile);
0066 se->registerInputManager(hitsin);
0067 }
0068
0069 else if ( readhepmc )
0070 {
0071 Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN");
0072 se->registerInputManager( in );
0073 se->fileopen( in->Name().c_str(), inputFile );
0074 }
0075
0076
0077
0078
0079
0080 if (nEvents < 0)
0081 {
0082 return 0;
0083 }
0084
0085 if (nEvents == 0 && !readdst && !readhepmc)
0086 {
0087 cout << "using 0 for number of events is a bad idea when using particle generators" << endl;
0088 cout << "it will run forever, so I just return without running anything" << endl;
0089 return 0;
0090 }
0091
0092 se->run(nEvents);
0093
0094
0095
0096
0097
0098 se->End();
0099 std::cout << "All done" << std::endl;
0100 delete se;
0101 gSystem->Exit(0);
0102 return 0;
0103 }