File indexing completed on 2025-08-05 08:13:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #define TRIGGERCLUSTERTUPLEMAKER_CC
0012
0013
0014 #include "TriggerClusterTupleMaker.h"
0015
0016
0017
0018
0019
0020
0021
0022
0023 TriggerClusterTupleMaker::TriggerClusterTupleMaker(const std::string &name) : SubsysReco(name) {
0024
0025
0026 if (m_config.debug && (Verbosity() > 0)) {
0027 std::cout << "TriggerClusterTupleMaker::TriggerClusterTupleMaker(const std::string &name) Calling ctor" << std::endl;
0028 }
0029
0030
0031 m_vecOutVars.clear();
0032
0033 }
0034
0035
0036
0037
0038
0039
0040 TriggerClusterTupleMaker::~TriggerClusterTupleMaker() {
0041
0042
0043 if (m_config.debug && (Verbosity() > 0)) {
0044 std::cout << "TriggerClusterTupleMaker::~TriggerClusterTupleMaker() Calling dtor" << std::endl;
0045 }
0046
0047
0048
0049 }
0050
0051
0052
0053
0054
0055
0056
0057
0058 int TriggerClusterTupleMaker::Init(PHCompositeNode* topNode) {
0059
0060 if (m_config.debug) {
0061 std::cout << "TriggerClusterTupleMaker::Init(PHCompositeNode *topNode) Initializing" << std::endl;
0062 }
0063
0064
0065 InitOutput(topNode);
0066 return Fun4AllReturnCodes::EVENT_OK;
0067
0068 }
0069
0070
0071
0072
0073
0074
0075 int TriggerClusterTupleMaker::process_event(PHCompositeNode* topNode) {
0076
0077 if (m_config.debug) {
0078 std::cout << "TriggerClusterTupleMaker::process_event(PHCompositeNode *topNode) Processing Event" << std::endl;
0079 }
0080
0081
0082 GrabInputNodes(topNode);
0083
0084
0085
0086
0087 return Fun4AllReturnCodes::EVENT_OK;
0088
0089 }
0090
0091
0092
0093
0094
0095
0096 int TriggerClusterTupleMaker::End(PHCompositeNode *topNode) {
0097
0098 if (m_config.debug) {
0099 std::cout << "TriggerClusterTupleMaker::End(PHCompositeNode *topNode) This is the End..." << std::endl;
0100 }
0101
0102
0103 SaveOutput();
0104 return Fun4AllReturnCodes::EVENT_OK;
0105
0106 }
0107
0108
0109
0110
0111
0112
0113
0114
0115 void TriggerClusterTupleMaker::InitOutput() {
0116
0117
0118 if (m_config.debug && (Verbosity() > 0)) {
0119 std::cout << "TriggerClusterTupleMaker::InitOutput(PHCompositeNode*) Creating output" << std::endl;
0120 }
0121
0122
0123 m_outFile = new TFile(m_config.outFile.data(), "recreate");
0124 if (!m_outFile) {
0125 std::cerr << PHWHERE << ": PANIC! Couldn't open output file!" << std::endl;
0126 assert(m_outFile);
0127 }
0128
0129
0130 const std::vector<std::string> vecLeaves = {
0131 "ntowers",
0132 "energy",
0133 "ecore",
0134 "phi",
0135 "rx",
0136 "ry",
0137 "rz",
0138 "z",
0139 "r"
0140 };
0141
0142
0143 std::string argLeaves("");
0144 for (size_t iLeaf = 0; iLeaf < vecLeaves.size(); ++iLeaf) {
0145 argLeaves.append(vecLeaves[iLeaf]);
0146 if ((iLeaf + 1) != vecLeaves.size()) {
0147 argLeaves.append(":");
0148 }
0149 }
0150
0151
0152 m_outTuple = new TNtuple(m_config.outTuple.data(), "Trigger Clusters", argLeaves.data());
0153 return;
0154
0155 }
0156
0157
0158
0159
0160
0161
0162 void TriggerClusterTupleMaker::GrabInputNodes(PHCompositeNode* topNode) {
0163
0164
0165 if (m_config.debug && (Verbosity() > 0)) {
0166 std::cout << "TriggerClusterTupleMaker::GrabTowerNodes(PHCompositeNode*) Grabbing input tower nodes" << std::endl;
0167 }
0168
0169
0170 m_inTrgClusts = findNode::getClass<RawClusterContainer>(topNode, m_config.inNode);
0171 if (!m_inTrgClusts) {
0172 std::cerr << PHWHERE << ": PANIC! Couldn't grab node '" << m_config.inNode << "'!" << std::endl;
0173 assert(m_inTrgClusts);
0174 }
0175 return;
0176
0177 }
0178
0179
0180
0181
0182
0183
0184 void TriggerClusterTupleMaker::SetClusterVariables(RawClusterv1* cluster) {
0185
0186
0187 if (m_config.debug && (Verbosity() > 0)) {
0188 std::cout << "TriggerClusterTupleMaker::GrabTowerNodes(PHCompositeNode*) Grabbing input tower nodes" << std::endl;
0189 }
0190
0191
0192 m_inTrgClusts = findNode::getClass<RawClusterContainer>(topNode, m_config.inNode);
0193 if (!m_inTrgClusts) {
0194 std::cerr << PHWHERE << ": PANIC! Couldn't grab node '" << m_config.inNode << "'!" << std::endl;
0195 assert(m_inTrgClusts);
0196 }
0197 return;
0198
0199 }
0200
0201
0202
0203
0204
0205
0206