File indexing completed on 2025-08-06 08:16:09
0001
0002 #ifndef MACRO_FUN4ALL_READDST_C
0003 #define MACRO_FUN4ALL_READDST_C
0004
0005 #include <tpcrawtottree/TPCRawDataTree.h>
0006
0007 #include <fun4all/Fun4AllServer.h>
0008 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0009
0010 #include <phool/recoConsts.h>
0011
0012 R__LOAD_LIBRARY(libfun4allraw.so)
0013 R__LOAD_LIBRARY(libTPCRawDataTree.so)
0014
0015 int Fun4All_TPC_UnpackPRDF_Batch(
0016 const int nEvents = 10,
0017 const int sector = 0,
0018 const int run = 42456,
0019 const string &mode = "calib")
0020 {
0021
0022
0023
0024 Fun4AllServer *se = Fun4AllServer::instance();
0025 se->Verbosity(1);
0026
0027 const string inputFile =
0028 Form("/sphenix/lustre01/sphnxpro/commissioning/tpc/%s/TPC_ebdc%02d_%s-000%05d-0000.evt",
0029 mode.c_str(), sector, mode.c_str(), run);
0030
0031 string outFile = Form("/phenix/u/jinhuang/links/sPHENIX_work/TPC/commissioning/TPC_ebdc%02d_%s-000%05d-0000.evt.TPCRawDataTree.root",
0032 sector, mode.c_str(), run);
0033
0034 string fileName = inputFile;
0035 size_t pos = fileName.find("TPC_ebdc");
0036 fileName.erase(fileName.begin(), fileName.begin() + pos);
0037
0038 TPCRawDataTree *r2tree = new TPCRawDataTree(outFile);
0039
0040
0041 for (int packet = 4000; packet <= 4230; packet += 10)
0042 {
0043 r2tree->AddPacket(packet);
0044 r2tree->AddPacket(packet + 1);
0045 }
0046
0047 se->registerSubsystem(r2tree);
0048
0049 Fun4AllPrdfInputManager *in1 = new Fun4AllPrdfInputManager("PRDF1");
0050 in1->fileopen(inputFile);
0051 se->registerInputManager(in1);
0052
0053
0054 se->run(nEvents);
0055
0056 se->End();
0057
0058 delete se;
0059 std::cout << "All done processing" << std::endl;
0060 gSystem->Exit(0);
0061 return 0;
0062 }
0063 #endif
0064