Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:16:32

0001 #pragma once
0002 
0003 #include <fun4all/Fun4AllServer.h>
0004 #include <fun4all/Fun4AllUtils.h>
0005 #include <fun4all/Fun4AllInputManager.h>
0006 #include <fun4all/Fun4AllDstInputManager.h>
0007 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0008 
0009 #include <TString.h>
0010 
0011 #include <smdhistgen/SmdHistGen.h>
0012 
0013 R__LOAD_LIBRARY(libfun4all.so)
0014 R__LOAD_LIBRARY(libfun4allraw.so)
0015 R__LOAD_LIBRARY(libSmdHistGen.so)
0016 
0017 void Fun4All_SmdHistGen(
0018              std::string mode = "dst",
0019                      int nEvents = 1,
0020                      const char *infilelist = "42200.list",
0021              std::string outfilename = "")
0022 {
0023   // this convenience library knows all our i/o objects so you don't
0024   // have to figure out what is in each dst type
0025   gSystem->Load("libg4dst.so");
0026 
0027   Fun4AllServer *se = Fun4AllServer::instance();
0028   se->Verbosity(0);  // set it to 1 if you want event printouts
0029 
0030   Fun4AllInputManager *in_smd = new Fun4AllDstInputManager("DSTSMD");
0031   in_smd->AddListFile(infilelist);
0032   se->registerInputManager(in_smd);
0033 
0034   const char* outname;
0035   if (outfilename != "") outname = outfilename.c_str();
0036   else
0037   {
0038     std::list<std::string> inputfiles = in_smd->GetFileList();
0039     std::string inputFile = inputfiles.front();
0040     std::pair<int, int> runseg = Fun4AllUtils::GetRunSegment(inputFile);
0041     int runnumber = runseg.first;
0042     outname = Form("SmdHists-%d.root", runnumber);
0043   }
0044   std::cout << "Output file will be " << outname << std::endl;
0045 
0046   SmdHistGen *eval = new SmdHistGen("SmdHistGen", mode, outname);
0047   se -> registerSubsystem(eval);
0048   
0049   se->run(nEvents);
0050   se->End();
0051   
0052   delete se;
0053   cout << "Analysis Completed" << endl;
0054   
0055   gSystem->Exit(0);
0056 }