File indexing completed on 2025-08-05 08:16:19
0001 #include "PHNodeIntegrate.h"
0002
0003 #include "PHCompositeNode.h"
0004 #include "PHDataNode.h"
0005 #include "PHIODataNode.h"
0006 #include "PHNode.h"
0007 #include "PHObject.h"
0008 #include "getClass.h"
0009
0010 #include <iostream>
0011 #include <string>
0012
0013 void PHNodeIntegrate::perform(PHNode *node)
0014 {
0015 if (verbosity > 0)
0016 {
0017 std::cout << "PHNodeIntegrate: Integrating " << node->getName() << std::endl;
0018 }
0019 if (node->getType() == "PHDataNode" || node->getType() == "PHIODataNode")
0020 {
0021 if (node->getObjectType() == "PHObject")
0022 {
0023
0024 PHObject *obj = static_cast<PHDataNode<PHObject> *>(node)->getData();
0025 if (obj->Integrate())
0026 {
0027
0028 PHObject *sumobj = findNode::getClass<PHObject>(runsumnode, node->getName());
0029 if (sumobj)
0030 {
0031 sumobj->Integrate(obj);
0032
0033
0034
0035
0036 PHObject *runobj = findNode::getClass<PHObject>(runnode, node->getName());
0037 runobj->CopyFrom(sumobj);
0038 }
0039 else
0040 {
0041
0042
0043
0044 sumobj = obj->CloneMe();
0045 PHIODataNode<PHObject> *sumobjnode = new PHIODataNode<PHObject>(sumobj, node->getName(), "PHObject");
0046 runsumnode->addNode(sumobjnode);
0047 }
0048 }
0049 }
0050 }
0051 }