File indexing completed on 2025-08-03 08:14:01
0001
0002 #include "WaveFormPacket.h"
0003
0004 #include <ffarawobjects/CaloPacket.h>
0005 #include <ffarawobjects/CaloPacketContainer.h>
0006
0007 #include <fun4all/Fun4AllReturnCodes.h>
0008
0009 #include <phool/PHCompositeNode.h>
0010 #include <phool/getClass.h>
0011
0012
0013 WaveFormPacket::WaveFormPacket(const std::string &name):
0014 SubsysReco(name)
0015 {
0016 outfile.open("data.txt",std::fstream::out);
0017 }
0018
0019
0020
0021 int WaveFormPacket::process_event(PHCompositeNode *topNode)
0022 {
0023 CaloPacketContainer *calocont = findNode::getClass<CaloPacketContainer>(topNode, "CEMCPackets");
0024 if (calocont)
0025 {
0026 for (unsigned int i = 0; i < calocont->get_npackets(); i++)
0027 {
0028 CaloPacket *calopacket = calocont->getPacket(i);
0029 for (int k = 0; k < calopacket->iValue(0, "CHANNELS"); k++)
0030 {
0031 if (calopacket->iValue(k, "SUPPRESSED"))
0032 {
0033 continue;
0034 }
0035 for (int j = 0; j < calopacket->iValue(0, "SAMPLES"); j++)
0036 {
0037 std::cout << "channel " << k << ", sample " << j << "wf: " << calopacket->iValue(j, k) << std::endl;
0038 outfile << calopacket->iValue(j, k) << std::endl;
0039 }
0040
0041 }
0042 }
0043 }
0044 return Fun4AllReturnCodes::EVENT_OK;
0045 }
0046
0047
0048 int WaveFormPacket::End(PHCompositeNode * )
0049 {
0050 outfile.close();
0051 return Fun4AllReturnCodes::EVENT_OK;
0052 }