File indexing completed on 2025-08-05 08:13:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #define TESTPHFLAGS_CC
0012
0013
0014 #include "TestPHFlags.h"
0015
0016
0017 #include <fun4all/Fun4AllReturnCodes.h>
0018
0019
0020 #include <pdbcalbase/PdbParameterMap.h>
0021
0022
0023 #include <phool/getClass.h>
0024 #include <phool/PHCompositeNode.h>
0025 #include <phool/phool.h>
0026
0027
0028 #include <iostream>
0029 #include <vector>
0030
0031
0032
0033
0034
0035
0036
0037
0038 TestPHFlags::TestPHFlags(const std::string& name, const std::string& flags, const bool debug)
0039 : SubsysReco(name)
0040 , m_flags(name)
0041 , m_doDebug(debug)
0042 , m_flagNode(flags)
0043 {
0044
0045 if (m_doDebug)
0046 {
0047 std::cout << "TestPHFlags::TestPHFlags(std::string &name, std::string&, bool) Calling ctor" << std::endl;
0048 }
0049
0050 }
0051
0052
0053
0054
0055
0056
0057 TestPHFlags::~TestPHFlags()
0058 {
0059
0060 if (m_doDebug)
0061 {
0062 std::cout << "TestPHFlags::~TestPHFlags() Calling dtor" << std::endl;
0063 }
0064
0065 }
0066
0067
0068
0069
0070
0071
0072
0073
0074 int TestPHFlags::process_event(PHCompositeNode* topNode)
0075 {
0076
0077 if (m_doDebug)
0078 {
0079 std::cout << "TestPHFlags::process_event(PHCompositeNode *topNode) Processing Event" << std::endl;
0080 }
0081
0082
0083 PHNodeIterator itNode(topNode);
0084 PHCompositeNode* parNode = dynamic_cast<PHCompositeNode*>(itNode.findFirst("PHCompositeNode", "PAR"));
0085 if (!parNode)
0086 {
0087 std::cerr << PHWHERE << " PANIC: PAR node not found! No flags present, and aborting event!" << std::endl;
0088 return Fun4AllReturnCodes::EVENT_OK;
0089 }
0090
0091
0092 PdbParameterMap* flagNode = findNode::getClass<PdbParameterMap>(parNode, m_flagNode);
0093 if (!flagNode)
0094 {
0095 std::cerr << PHWHERE << " PANIC: " << m_flagNode << " node not found! Aborting event!" << std::endl;
0096 return Fun4AllReturnCodes::EVENT_OK;
0097 }
0098
0099
0100
0101 m_flags.FillFrom(flagNode);
0102 m_flags.printint();
0103
0104
0105 std::vector<std::string> flagsToCheck = {
0106 "HasBeamBackground_NullFilter",
0107 "HasBeamBackground_StreakSidebandFilter",
0108 "HasBeamBackground"
0109 };
0110
0111
0112 for (const std::string& flag : flagsToCheck)
0113 {
0114 std::cout << "[" << flag << "] exists? " << m_flags.exist_int_param(flag);
0115 if (m_flags.exist_int_param(flag))
0116 {
0117 std::cout << " : value = " << m_flags.get_int_param(flag) << std::endl;
0118 }
0119 else
0120 {
0121 std::cout << std::endl;
0122 }
0123 }
0124 return Fun4AllReturnCodes::EVENT_OK;
0125
0126 }
0127
0128