File indexing completed on 2025-08-05 08:16:07
0001 #include "StreamingCheck.h"
0002
0003 #include <fun4all/Fun4AllInputManager.h>
0004 #include <fun4all/Fun4AllReturnCodes.h>
0005 #include <fun4all/SubsysReco.h> // for SubsysReco
0006
0007 #include <ffarawobjects/Gl1RawHit.h>
0008 #include <ffarawobjects/InttRawHit.h>
0009 #include <ffarawobjects/InttRawHitContainer.h>
0010 #include <ffarawobjects/MicromegasRawHit.h>
0011 #include <ffarawobjects/MicromegasRawHitContainer.h>
0012 #include <ffarawobjects/MvtxRawHit.h>
0013 #include <ffarawobjects/MvtxRawHitContainer.h>
0014 #include <ffarawobjects/TpcRawHit.h>
0015 #include <ffarawobjects/TpcRawHitContainer.h>
0016
0017 #include <phool/PHCompositeNode.h>
0018 #include <phool/PHDataNode.h>
0019 #include <phool/PHNode.h> // for PHNode
0020 #include <phool/PHNodeIterator.h> // for PHNodeIterator
0021 #include <phool/getClass.h>
0022
0023 #include <TSystem.h>
0024
0025 #include <iostream> // for operator<<, endl, basic_ost...
0026 #include <set>
0027 #include <utility> // for pair
0028 #include <vector> // for vector
0029
0030
0031 StreamingCheck::StreamingCheck(const std::string &name)
0032 : SubsysReco(name)
0033 {
0034 }
0035
0036
0037 int StreamingCheck::Init(PHCompositeNode * )
0038 {
0039 return Fun4AllReturnCodes::EVENT_OK;
0040 }
0041
0042
0043 int StreamingCheck::process_event(PHCompositeNode *topNode)
0044 {
0045 Gl1RawHit *gl1rawhit = findNode::getClass<Gl1RawHit>(topNode, "GL1RAWHIT");
0046 if (!gl1rawhit)
0047 {
0048 std::cout << "could not find node GL1RAWHIT" << std::endl;
0049 exit(1);
0050 }
0051 uint64_t refBCO = gl1rawhit->get_bco();
0052 uint64_t refBCO_40Bits = refBCO & 0xFFFFFFFFFFU;
0053 TpcRawHitContainer *tpccont = findNode::getClass<TpcRawHitContainer>(topNode, "TPCRAWHIT");
0054 if (tpccont)
0055 {
0056 if (Verbosity() > 0)
0057 {
0058 tpccont->identify();
0059 }
0060 for (unsigned int i = 0; i < tpccont->get_nhits(); i++)
0061 {
0062 TpcRawHit *inh = tpccont->get_hit(i);
0063 if (inh->get_gtm_bco() < refBCO_40Bits)
0064 {
0065 std::cout << "bco mismatch (too small), gl1: 0x" << std::hex << refBCO_40Bits
0066 << ", tpc: 0x" << inh->get_gtm_bco() << std::endl;
0067 }
0068 if (inh->get_gtm_bco() > refBCO_40Bits + tpc_bcorange)
0069 {
0070 std::cout << "bco mismatch (too large), gl1: 0x" << std::hex << refBCO_40Bits
0071 << ", tpc: 0x" << inh->get_gtm_bco() << std::endl;
0072 }
0073 }
0074 }
0075 InttRawHitContainer *inttcont = findNode::getClass<InttRawHitContainer>(topNode, "INTTRAWHIT");
0076 if (inttcont)
0077 {
0078 if (Verbosity() > 0)
0079 {
0080 inttcont->identify();
0081 }
0082 for (unsigned int i = 0; i < inttcont->get_nhits(); i++)
0083 {
0084 InttRawHit *inh = inttcont->get_hit(i);
0085 if (inh->get_bco() != refBCO_40Bits)
0086 {
0087 std::cout << "bco mismatch (too small), gl1: 0x" << std::hex << refBCO_40Bits
0088 << ", intt: 0x" << inh->get_bco() << std::endl;
0089 }
0090 }
0091 }
0092 return Fun4AllReturnCodes::EVENT_OK;
0093 }