File indexing completed on 2025-08-03 08:15:56
0001 #include <iostream>
0002
0003
0004 #include <TreeMaker.h>
0005
0006
0007 #include <fun4all/Fun4AllServer.h>
0008 #include <phool/getClass.h>
0009 #include <phool/PHCompositeNode.h>
0010
0011
0012 #include <g4jets/JetMap.h>
0013 #include <g4jets/JetMapV1.h>
0014
0015
0016 #include <calobase/RawClusterContainer.h>
0017
0018 using std::cout;
0019 using std::endl;
0020
0021
0022
0023 int TreeMaker::CreateNode(PHCompositeNode *topNode)
0024 {
0025
0026 cout << "TreeMaker::CreateNode called" << endl;
0027
0028 PHNodeIterator iter(topNode);
0029
0030
0031
0032
0033
0034
0035 PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
0036 if ( !dstNode )
0037 {
0038 cout << PHWHERE << "DST node not found, doing nothing." << endl;
0039 return -2;
0040 }
0041
0042
0043 PHCompositeNode *antiktNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "ANTIKT"));
0044 if ( !antiktNode )
0045 {
0046 cout << PHWHERE << "ANTIKT node not found, doing nothing." << endl;
0047 return -2;
0048 }
0049
0050
0051 PHCompositeNode *towerNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "TOWER"));
0052 if ( !towerNode )
0053 {
0054 cout << PHWHERE << "TOWER node not found, doing nothing." << endl;
0055 return -2;
0056 }
0057
0058
0059 JetMap* check_jets = findNode::getClass<JetMap>(topNode,"AntiKt_Tower_Mod_r02");
0060 if ( !check_jets )
0061 {
0062
0063 cout << "TreeMaker::CreateNode : creating AntiKt_Tower_Mod_r02 node " << endl;
0064 JetMap *mod_jets = new JetMapV1();
0065 PHIODataNode<PHObject> *modjetNode = new PHIODataNode<PHObject>( mod_jets, "AntiKt_Tower_Mod_r02", "PHObject");
0066
0067 towerNode->addNode(modjetNode);
0068 }
0069 else
0070 {
0071
0072 cout << "TreeMaker::CreateNode : AntiKt_Tower_Mod_r02 already exists! " << endl;
0073 }
0074
0075
0076
0077
0078
0079
0080 PHCompositeNode *cemcNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "CEMC"));
0081 if ( !cemcNode )
0082 {
0083 cout << PHWHERE << "CEMC node not found, doing nothing." << endl;
0084 return -2;
0085 }
0086
0087
0088 RawClusterContainer* check_cemc_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_CEMC_MOD");
0089 if ( !check_cemc_clusters )
0090 {
0091
0092 cout << "TreeMaker::CreateNode : creating CLUSTER_CEMC_MOD node " << endl;
0093 RawClusterContainer *mod_cemc_clusters = new RawClusterContainer();
0094 PHIODataNode<PHObject> *clusterNode = new PHIODataNode<PHObject>( mod_cemc_clusters, "CLUSTER_CEMC_MOD", "PHObject");
0095
0096 cemcNode->addNode(clusterNode);
0097 }
0098 else
0099 {
0100
0101 cout << "TreeMaker::CreateNode : CLUSTER_CEMC_MOD already exists! " << endl;
0102 }
0103
0104
0105 PHCompositeNode *hcalinNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "HCALIN"));
0106 if ( !hcalinNode )
0107 {
0108 cout << PHWHERE << "HCALIN node not found, doing nothing." << endl;
0109 return -2;
0110 }
0111
0112
0113 RawClusterContainer* check_hcalin_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_HCALIN_MOD");
0114 if ( !check_hcalin_clusters )
0115 {
0116
0117 cout << "TreeMaker::CreateNode : creating CLUSTER_HCALIN_MOD node " << endl;
0118 RawClusterContainer *mod_hcalin_clusters = new RawClusterContainer();
0119 PHIODataNode<PHObject> *clusterNode = new PHIODataNode<PHObject>( mod_hcalin_clusters, "CLUSTER_HCALIN_MOD", "PHObject");
0120
0121 hcalinNode->addNode(clusterNode);
0122 }
0123 else
0124 {
0125
0126 cout << "TreeMaker::CreateNode : CLUSTER_HCALIN_MOD already exists! " << endl;
0127 }
0128
0129
0130 PHCompositeNode *hcaloutNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "HCALOUT"));
0131 if ( !hcaloutNode )
0132 {
0133 cout << PHWHERE << "HCALOUT node not found, doing nothing." << endl;
0134 return -2;
0135 }
0136
0137
0138 RawClusterContainer* check_hcalout_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_HCALOUT_MOD");
0139 if ( !check_hcalout_clusters )
0140 {
0141
0142 cout << "TreeMaker::CreateNode : creating CLUSTER_HCALOUT_MOD node " << endl;
0143 RawClusterContainer *mod_hcalout_clusters = new RawClusterContainer();
0144 PHIODataNode<PHObject> *clusterNode = new PHIODataNode<PHObject>( mod_hcalout_clusters, "CLUSTER_HCALOUT_MOD", "PHObject");
0145
0146 hcaloutNode->addNode(clusterNode);
0147 }
0148 else
0149 {
0150
0151 cout << "TreeMaker::CreateNode : CLUSTER_HCALOUT_MOD already exists! " << endl;
0152 }
0153
0154
0155
0156
0157
0158 return 0;
0159
0160 }