Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:55

0001 #include "Dumper.h"
0002 #include "PHNodeDump.h"
0003 
0004 #include <fun4all/SubsysReco.h>
0005 
0006 #include <phool/PHCompositeNode.h>
0007 #include <phool/PHNode.h>
0008 #include <phool/PHNodeIterator.h>
0009 
0010 #include <vector>
0011 
0012 Dumper::Dumper(const std::string &name)
0013   : SubsysReco(name)
0014   , nodedump(new PHNodeDump())
0015 {
0016   return;
0017 }
0018 
0019 Dumper::~Dumper()
0020 {
0021   delete nodedump;
0022   return;
0023 }
0024 
0025 int Dumper::process_event(PHCompositeNode *topNode)
0026 {
0027   PHNodeIterator iter(topNode);
0028   nodedump->GetGlobalVars(topNode);
0029   PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
0030   if (dstNode)
0031   {
0032     iter.cd("DST");
0033     iter.forEach(*nodedump);
0034     iter.cd();
0035   }
0036   return 0;
0037 }
0038 
0039 int Dumper::End(PHCompositeNode *topNode)
0040 {
0041   PHNodeIterator nodeiter(topNode);
0042   std::vector<std::string> DumpNodeList;
0043   DumpNodeList.emplace_back("RUN");
0044   DumpNodeList.emplace_back("PAR");
0045   nodedump->PrintEvtSeq(0);
0046   for (const auto &iter : DumpNodeList)
0047   {
0048     if (nodeiter.cd(iter))
0049     {
0050       nodeiter.forEach(*nodedump);
0051       nodeiter.cd();
0052     }
0053   }
0054   nodedump->CloseOutputFiles();
0055   return 0;
0056 }
0057 
0058 void Dumper::SetOutDir(const std::string &outdir)
0059 {
0060   nodedump->SetOutDir(outdir);
0061   return;
0062 }
0063 
0064 void Dumper::SetPrecision(const int digits)
0065 {
0066   nodedump->SetPrecision(digits);
0067   return;
0068 }
0069 
0070 int Dumper::AddIgnore(const std::string &name)
0071 {
0072   return nodedump->AddIgnore(name);
0073 }
0074 
0075 int Dumper::Select(const std::string &name)
0076 {
0077   return nodedump->Select(name);
0078 }