File indexing completed on 2025-12-16 09:20:17
0001 #include "PHNodeDump.h"
0002 #include "DumpObject.h"
0003
0004 #include "DumpCaloPacket.h"
0005 #include "DumpCaloPacketContainer.h"
0006 #include "DumpCaloTriggerInfo.h"
0007 #include "DumpCdbUrlSave.h"
0008 #include "DumpCentralityInfo.h"
0009 #include "DumpEpdGeom.h"
0010 #include "DumpEventHeader.h"
0011 #include "DumpFlagSave.h"
0012 #include "DumpGl1Packet.h"
0013 #include "DumpGl1RawHit.h"
0014 #include "DumpGlobalVertexMap.h"
0015 #include "DumpInttDeadMap.h"
0016 #include "DumpInttRawHitContainer.h"
0017 #include "DumpJetContainer.h"
0018 #include "DumpJetMap.h"
0019 #include "DumpMbdGeom.h"
0020 #include "DumpMbdOut.h"
0021 #include "DumpMbdPmtContainer.h"
0022 #include "DumpMbdVertexMap.h"
0023 #include "DumpMicromegasRawHitContainer.h"
0024 #include "DumpMvtxRawEvtHeader.h"
0025 #include "DumpMvtxRawHitContainer.h"
0026 #include "DumpPHFieldConfig.h"
0027 #include "DumpPHG4BlockCellGeomContainer.h"
0028 #include "DumpPHG4BlockGeomContainer.h"
0029 #include "DumpPHG4CellContainer.h"
0030 #include "DumpPHG4CylinderCellContainer.h"
0031 #include "DumpPHG4CylinderCellGeomContainer.h"
0032 #include "DumpPHG4CylinderGeomContainer.h"
0033 #include "DumpPHG4HitContainer.h"
0034 #include "DumpPHG4InEvent.h"
0035 #include "DumpPHG4ParticleSvtxMap.h"
0036 #include "DumpPHG4ScintillatorSlatContainer.h"
0037 #include "DumpPHG4TpcCylinderGeomContainer.h"
0038 #include "DumpPHG4TruthInfoContainer.h"
0039 #include "DumpPHGenIntegral.h"
0040 #include "DumpPHHepMCGenEventMap.h"
0041 #include "DumpParticleFlowElementContainer.h"
0042 #include "DumpPdbParameterMap.h"
0043 #include "DumpPdbParameterMapContainer.h"
0044 #include "DumpRawClusterContainer.h"
0045 #include "DumpRawTowerContainer.h"
0046 #include "DumpRawTowerGeomContainer.h"
0047 #include "DumpRunHeader.h"
0048 #include "DumpSvtxPHG4ParticleMap.h"
0049 #include "DumpSvtxTrackMap.h"
0050 #include "DumpSvtxVertexMap.h"
0051 #include "DumpSyncObject.h"
0052 #include "DumpTowerBackground.h"
0053 #include "DumpTowerInfoContainer.h"
0054 #include "DumpTpcRawHitContainer.h"
0055 #include "DumpTpcSeedTrackMap.h"
0056 #include "DumpTrackSeedContainer.h"
0057 #include "DumpTrkrClusterContainer.h"
0058 #include "DumpTrkrClusterCrossingAssoc.h"
0059 #include "DumpTrkrClusterHitAssoc.h"
0060 #include "DumpTrkrHitSetContainer.h"
0061 #include "DumpTrkrHitTruthAssoc.h"
0062 #include "DumpTruthVertexMap.h"
0063 #include "DumpZdcinfo.h"
0064
0065 #include <ffaobjects/EventHeader.h>
0066 #include <ffaobjects/RunHeader.h>
0067
0068 #include <phool/PHIODataNode.h>
0069 #include <phool/PHNode.h>
0070 #include <phool/getClass.h>
0071 #include <phool/phool.h>
0072
0073 #include <TObject.h>
0074
0075 #include <iostream>
0076 #include <string>
0077 #include <utility>
0078
0079 PHNodeDump::~PHNodeDump()
0080 {
0081 ignore.clear();
0082 exclusive.clear();
0083 while (dumpthis.begin() != dumpthis.end())
0084 {
0085 delete dumpthis.begin()->second;
0086 dumpthis.erase(dumpthis.begin());
0087 }
0088 return;
0089 }
0090
0091 int PHNodeDump::AddIgnore(const std::string &name)
0092 {
0093 if (ignore.contains(name))
0094 {
0095 std::cout << PHWHERE << " "
0096 << name << "already in ignore list" << std::endl;
0097 return -1;
0098 }
0099 ignore.insert(name);
0100 return 0;
0101 }
0102
0103 int PHNodeDump::Select(const std::string &name)
0104 {
0105 if (exclusive.contains(name))
0106 {
0107 std::cout << PHWHERE << " "
0108 << name << "already in exclusive list" << std::endl;
0109 return -1;
0110 }
0111 exclusive.insert(name);
0112 return 0;
0113 }
0114
0115 int PHNodeDump::GetGlobalVars(PHCompositeNode *topNode)
0116 {
0117 RunHeader *runheader = findNode::getClass<RunHeader>(topNode, "RunHeader");
0118 if (runheader)
0119 {
0120 runnumber = runheader->get_RunNumber();
0121 }
0122 EventHeader *eventheader = findNode::getClass<EventHeader>(topNode, "EventHeader");
0123 if (eventheader)
0124 {
0125 evtsequence = eventheader->get_EvtSequence();
0126 }
0127 return 0;
0128 }
0129
0130 void PHNodeDump::perform(PHNode *node)
0131 {
0132 std::map<std::string, DumpObject *>::iterator iter;
0133 if (node->getType() == "PHIODataNode")
0134 {
0135 std::string NodeName = node->getName();
0136 iter = dumpthis.find(NodeName);
0137 if (iter == dumpthis.end())
0138 {
0139 std::cout << "Adding Dump Object for " << NodeName << std::endl;
0140 AddDumpObject(NodeName, node);
0141 iter = dumpthis.find(NodeName);
0142 }
0143
0144 if (iter != dumpthis.end())
0145 {
0146 iter->second->process_event(node);
0147 }
0148 else
0149 {
0150
0151
0152
0153
0154 std::cout << "Something went wrong with adding Dump Object for " << NodeName
0155 << ", it should exist !! Trying to create it again" << std::endl;
0156 AddDumpObject(NodeName, node);
0157 }
0158 }
0159 return;
0160 }
0161
0162 int PHNodeDump::CloseOutputFiles()
0163 {
0164 std::map<std::string, DumpObject *>::iterator iter;
0165 for (iter = dumpthis.begin(); iter != dumpthis.end(); ++iter)
0166 {
0167 iter->second->CloseOutputFile();
0168 }
0169 return 0;
0170 }
0171
0172 int PHNodeDump::AddDumpObject(const std::string &NodeName, PHNode *node)
0173 {
0174 DumpObject *newdump;
0175 if (!exclusive.empty())
0176 {
0177 if (!exclusive.contains(NodeName))
0178 {
0179 std::cout << "Exclusive find: Ignoring " << NodeName << std::endl;
0180 newdump = new DumpObject(NodeName);
0181 newdump->NoOutput();
0182 return initdump(NodeName, newdump);
0183 }
0184 }
0185 if (ignore.contains(NodeName))
0186 {
0187 std::cout << "Ignoring " << NodeName << std::endl;
0188 newdump = new DumpObject(NodeName);
0189 newdump->NoOutput();
0190 }
0191 else
0192 {
0193 if (node->getType() == "PHIODataNode")
0194 {
0195
0196
0197 TObject *tmp = static_cast<TObject *>((static_cast<PHIODataNode<TObject> *>(node))->getData());
0198 if (tmp->InheritsFrom("CaloPacket"))
0199 {
0200 newdump = new DumpCaloPacket(NodeName);
0201 }
0202 else if (tmp->InheritsFrom("CaloPacketContainer"))
0203 {
0204 newdump = new DumpCaloPacketContainer(NodeName);
0205 }
0206 else if (tmp->InheritsFrom("CaloTriggerInfo"))
0207 {
0208 newdump = new DumpCaloTriggerInfo(NodeName);
0209 }
0210 else if (tmp->InheritsFrom("CdbUrlSave"))
0211 {
0212 newdump = new DumpCdbUrlSave(NodeName);
0213 }
0214 else if (tmp->InheritsFrom("CentralityInfo"))
0215 {
0216 newdump = new DumpCentralityInfo(NodeName);
0217 }
0218 else if (tmp->InheritsFrom("EpdGeom"))
0219 {
0220 newdump = new DumpEpdGeom(NodeName);
0221 }
0222 else if (tmp->InheritsFrom("EventHeader"))
0223 {
0224 newdump = new DumpEventHeader(NodeName);
0225 }
0226 else if (tmp->InheritsFrom("FlagSave"))
0227 {
0228 newdump = new DumpFlagSave(NodeName);
0229 }
0230 else if (tmp->InheritsFrom("Gl1Packet"))
0231 {
0232 newdump = new DumpGl1Packet(NodeName);
0233 }
0234 else if (tmp->InheritsFrom("Gl1RawHit"))
0235 {
0236 newdump = new DumpGl1RawHit(NodeName);
0237 }
0238 else if (tmp->InheritsFrom("GlobalVertexMap"))
0239 {
0240 newdump = new DumpGlobalVertexMap(NodeName);
0241 }
0242 else if (tmp->InheritsFrom("InttDeadMap"))
0243 {
0244 newdump = new DumpInttDeadMap(NodeName);
0245 }
0246 else if (tmp->InheritsFrom("InttRawHitContainer"))
0247 {
0248 newdump = new DumpInttRawHitContainer(NodeName);
0249 }
0250 else if (tmp->InheritsFrom("JetMap"))
0251 {
0252 newdump = new DumpJetMap(NodeName);
0253 }
0254 else if (tmp->InheritsFrom("JetContainer"))
0255 {
0256 newdump = new DumpJetContainer(NodeName);
0257 }
0258 else if (tmp->InheritsFrom("MbdGeom"))
0259 {
0260 newdump = new DumpMbdGeom(NodeName);
0261 }
0262 else if (tmp->InheritsFrom("MbdOut"))
0263 {
0264 newdump = new DumpMbdOut(NodeName);
0265 }
0266 else if (tmp->InheritsFrom("MbdPmtContainer"))
0267 {
0268 newdump = new DumpMbdPmtContainer(NodeName);
0269 }
0270 else if (tmp->InheritsFrom("MbdVertexMap"))
0271 {
0272 newdump = new DumpMbdVertexMap(NodeName);
0273 }
0274 else if (tmp->InheritsFrom("MicromegasRawHitContainer"))
0275 {
0276 newdump = new DumpMicromegasRawHitContainer(NodeName);
0277 }
0278 else if (tmp->InheritsFrom("MvtxRawEvtHeader"))
0279 {
0280 newdump = new DumpMvtxRawEvtHeader(NodeName);
0281 }
0282 else if (tmp->InheritsFrom("MvtxRawHitContainer"))
0283 {
0284 newdump = new DumpMvtxRawHitContainer(NodeName);
0285 }
0286 else if (tmp->InheritsFrom("ParticleFlowElementContainer"))
0287 {
0288 newdump = new DumpParticleFlowElementContainer(NodeName);
0289 }
0290 else if (tmp->InheritsFrom("PdbParameterMap"))
0291 {
0292 newdump = new DumpPdbParameterMap(NodeName);
0293 }
0294 else if (tmp->InheritsFrom("PdbParameterMapContainer"))
0295 {
0296 newdump = new DumpPdbParameterMapContainer(NodeName);
0297 }
0298 else if (tmp->InheritsFrom("PHFieldConfig"))
0299 {
0300 newdump = new DumpPHFieldConfig(NodeName);
0301 }
0302 else if (tmp->InheritsFrom("PHG4BlockGeomContainer"))
0303 {
0304 newdump = new DumpPHG4BlockGeomContainer(NodeName);
0305 }
0306 else if (tmp->InheritsFrom("PHG4BlockCellGeomContainer"))
0307 {
0308 newdump = new DumpPHG4BlockCellGeomContainer(NodeName);
0309 }
0310 else if (tmp->InheritsFrom("PHG4CellContainer"))
0311 {
0312 newdump = new DumpPHG4CellContainer(NodeName);
0313 }
0314 else if (tmp->InheritsFrom("PHG4CylinderCellContainer"))
0315 {
0316 newdump = new DumpPHG4CylinderCellContainer(NodeName);
0317 }
0318 else if (tmp->InheritsFrom("PHG4CylinderGeomContainer"))
0319 {
0320 newdump = new DumpPHG4CylinderGeomContainer(NodeName);
0321 }
0322 else if (tmp->InheritsFrom("PHG4CylinderCellGeomContainer"))
0323 {
0324 newdump = new DumpPHG4CylinderCellGeomContainer(NodeName);
0325 }
0326 else if (tmp->InheritsFrom("PHG4HitContainer"))
0327 {
0328 newdump = new DumpPHG4HitContainer(NodeName);
0329 }
0330 else if (tmp->InheritsFrom("PHG4InEvent"))
0331 {
0332 newdump = new DumpPHG4InEvent(NodeName);
0333 }
0334 else if (tmp->InheritsFrom("PHG4ParticleSvtxMap"))
0335 {
0336 newdump = new DumpPHG4ParticleSvtxMap(NodeName);
0337 }
0338 else if (tmp->InheritsFrom("PHG4ScintillatorSlatContainer"))
0339 {
0340 newdump = new DumpPHG4ScintillatorSlatContainer(NodeName);
0341 }
0342 else if (tmp->InheritsFrom("PHG4TpcCylinderGeomContainer"))
0343 {
0344 newdump = new DumpPHG4TpcCylinderGeomContainer(NodeName);
0345 }
0346 else if (tmp->InheritsFrom("PHG4TruthInfoContainer"))
0347 {
0348 newdump = new DumpPHG4TruthInfoContainer(NodeName);
0349 }
0350 else if (tmp->InheritsFrom("PHGenIntegral"))
0351 {
0352 newdump = new DumpPHGenIntegral(NodeName);
0353 }
0354 else if (tmp->InheritsFrom("PHHepMCGenEventMap"))
0355 {
0356 newdump = new DumpPHHepMCGenEventMap(NodeName);
0357 }
0358 else if (tmp->InheritsFrom("RawClusterContainer"))
0359 {
0360 newdump = new DumpRawClusterContainer(NodeName);
0361 }
0362 else if (tmp->InheritsFrom("RawTowerContainer"))
0363 {
0364 newdump = new DumpRawTowerContainer(NodeName);
0365 }
0366 else if (tmp->InheritsFrom("RawTowerGeomContainer"))
0367 {
0368 newdump = new DumpRawTowerGeomContainer(NodeName);
0369 }
0370 else if (tmp->InheritsFrom("RunHeader"))
0371 {
0372 newdump = new DumpRunHeader(NodeName);
0373 }
0374 else if (tmp->InheritsFrom("SvtxPHG4ParticleMap"))
0375 {
0376 newdump = new DumpSvtxPHG4ParticleMap(NodeName);
0377 }
0378 else if (tmp->InheritsFrom("SvtxTrackMap"))
0379 {
0380 newdump = new DumpSvtxTrackMap(NodeName);
0381 }
0382 else if (tmp->InheritsFrom("SvtxVertexMap"))
0383 {
0384 newdump = new DumpSvtxVertexMap(NodeName);
0385 }
0386 else if (tmp->InheritsFrom("SyncObject"))
0387 {
0388 newdump = new DumpSyncObject(NodeName);
0389 }
0390 else if (tmp->InheritsFrom("TowerBackground"))
0391 {
0392 newdump = new DumpTowerBackground(NodeName);
0393 }
0394 else if (tmp->InheritsFrom("TowerInfoContainer"))
0395 {
0396 newdump = new DumpTowerInfoContainer(NodeName);
0397 }
0398 else if (tmp->InheritsFrom("TpcRawHitContainer"))
0399 {
0400 newdump = new DumpTpcRawHitContainer(NodeName);
0401 }
0402 else if (tmp->InheritsFrom("TpcSeedTrackMap"))
0403 {
0404 newdump = new DumpTpcSeedTrackMap(NodeName);
0405 }
0406 else if (tmp->InheritsFrom("TrackSeedContainer"))
0407 {
0408 newdump = new DumpTrackSeedContainer(NodeName);
0409 }
0410 else if (tmp->InheritsFrom("TrkrClusterContainer"))
0411 {
0412 newdump = new DumpTrkrClusterContainer(NodeName);
0413 }
0414 else if (tmp->InheritsFrom("TrkrClusterCrossingAssoc"))
0415 {
0416 newdump = new DumpTrkrClusterCrossingAssoc(NodeName);
0417 }
0418 else if (tmp->InheritsFrom("TrkrClusterHitAssoc"))
0419 {
0420 newdump = new DumpTrkrClusterHitAssoc(NodeName);
0421 }
0422 else if (tmp->InheritsFrom("TrkrHitSetContainer"))
0423 {
0424 newdump = new DumpTrkrHitSetContainer(NodeName);
0425 }
0426 else if (tmp->InheritsFrom("TrkrHitTruthAssoc"))
0427 {
0428 newdump = new DumpTrkrHitTruthAssoc(NodeName);
0429 }
0430 else if (tmp->InheritsFrom("TruthVertexMap"))
0431 {
0432 newdump = new DumpTruthVertexMap(NodeName);
0433 }
0434 else if (tmp->InheritsFrom("Zdcinfo"))
0435 {
0436 newdump = new DumpZdcinfo(NodeName);
0437 }
0438 else
0439 {
0440 std::cout << "Registering Dummy for " << NodeName
0441 << ", Class: " << tmp->ClassName() << std::endl;
0442 newdump = new DumpObject(NodeName);
0443 }
0444 }
0445 else
0446 {
0447 std::cout << "ignoring PHDataNode: " << NodeName << std::endl;
0448 newdump = new DumpObject(NodeName);
0449 }
0450 }
0451 newdump->PrintEvtSeq(print_evtseq);
0452 return initdump(NodeName, newdump);
0453 }
0454
0455 int PHNodeDump::initdump(const std::string &newnode, DumpObject *dmp)
0456 {
0457 dmp->SetParentNodeDump(this);
0458 dmp->SetOutDir(outdir);
0459 dmp->SetPrecision(fp_precision);
0460 dmp->Init();
0461 dumpthis[newnode] = dmp;
0462 return 0;
0463 }