Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:42

0001 #pragma once
0002 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
0003 #include <hepmcjettrigger/HepMCJetTrigger.h>
0004 #include "sPhenixStyle.h"
0005 #include "sPhenixStyle.C"
0006 #include <fun4all/Fun4AllInputManager.h>
0007 #include <fun4all/Fun4AllServer.h>
0008 #include <phhepmc/Fun4AllHepMCInputManager.h>
0009 #include <fun4all/Fun4AllDstInputManager.h>
0010 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0011 #include <fun4allraw/Fun4AllPrdfInputPoolManager.h>
0012 #include <fun4all/Fun4AllDstOutputManager.h>
0013 #include <phhepmc/Fun4AllHepMCOutputManager.h>
0014 #include <fun4all/SubsysReco.h>
0015 #include <phool/PHRandomSeed.h>
0016 #include <sstream>
0017 #include <string>
0018 #include <G4_Global.C>
0019 #include <algorithm>
0020 #include <fstream> 
0021 
0022 R__LOAD_LIBRARY(libfun4all.so);
0023 R__LOAD_LIBRARY(libfun4allraw.so);
0024 R__LOAD_LIBRARY(libHepMCJetTrigger.so);
0025 R__LOAD_LIBRARY(libffamodules.so);
0026 R__LOAD_LIBRARY(libffarawmodules.so);
0027 R__LOAD_LIBRARY(libphhepmc.so);
0028 
0029 int RunHerwigHepMCFilter(std::string filename="/sphenix/user/sgross/sphenix_herwig/herwig_files/sphenix_10GeV_jetpt.hepmc", std::string trig="10", int goal_event_number=1000)
0030 {
0031     float threshold=0.;
0032     try{
0033         threshold=std::stof(trig);
0034     }
0035     catch(std::exception& e){threshold=10.;}
0036     Fun4AllServer* se=Fun4AllServer::instance();
0037     std::string outfile=filename;
0038     outfile.insert(filename.find("-"),"_filtered");
0039     Fun4AllHepMCInputManager *in =new Fun4AllHepMCInputManager("in");
0040     Fun4AllHepMCOutputManager *out=new Fun4AllHepMCOutputManager("out", outfile);
0041     HepMCJetTrigger* hf=new HepMCJetTrigger(threshold, goal_event_number, true);
0042     //std::fstream f;
0043     //f.open(filename);
0044     se->registerInputManager(in);
0045     in->fileopen(filename);
0046     se->registerOutputManager(out);
0047     se->registerSubsystem(hf);
0048     se->run();
0049     se->End();
0050     std::cout<<"Ran over " <<hf->n_evts <<" and found " <<hf->n_good <<" events" <<std::endl;
0051     return 0;
0052 }   
0053 #endif