Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-02 08:12:37

0001 #include "BcoLumiCheck.h"
0002 
0003 #include "BcoInfo.h"
0004 
0005 #include <ffaobjects/SyncDefs.h>
0006 #include <ffaobjects/SyncObject.h>
0007 
0008 #include <ffarawobjects/Gl1Packet.h>
0009 
0010 #include <fun4all/Fun4AllReturnCodes.h>
0011 #include <fun4all/SubsysReco.h>  // for SubsysReco
0012 
0013 #include <phool/PHCompositeNode.h>
0014 #include <phool/PHNode.h>          // for PHNode
0015 #include <phool/PHNodeIterator.h>  // for PHNodeIterator
0016 #include <phool/getClass.h>
0017 #include <phool/phool.h>  // for PHWHERE
0018 
0019 #include <iostream>
0020 
0021 BcoLumiCheck::BcoLumiCheck(const std::string &name)
0022   : SubsysReco(name)
0023 {
0024   return;
0025 }
0026 
0027 int BcoLumiCheck::Init(PHCompositeNode *topNode)
0028 {
0029   int iret = CreateNodeTree(topNode);
0030   return iret;
0031 }
0032 
0033 int BcoLumiCheck::InitRun(PHCompositeNode * /*topNode*/)
0034 {
0035   return Fun4AllReturnCodes::EVENT_OK;
0036 }
0037 
0038 int BcoLumiCheck::CreateNodeTree(PHCompositeNode *topNode)
0039 {
0040   PHNodeIterator iter(topNode);
0041   PHCompositeNode *dstNode;
0042   dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
0043   if (!dstNode)
0044   {
0045     std::cout << PHWHERE << " DST Node is missing doing nothing" << std::endl;
0046     return Fun4AllReturnCodes::ABORTRUN;
0047   }
0048   return Fun4AllReturnCodes::EVENT_OK;
0049 }
0050 
0051 int BcoLumiCheck::process_event(PHCompositeNode *topNode)
0052 {
0053   BcoInfo *bcoinfo = findNode::getClass<BcoInfo>(topNode, "BCOINFO");
0054   SyncObject *syncobject = findNode::getClass<SyncObject>(topNode, syncdefs::SYNCNODENAME);
0055   Gl1Packet *gl1packet = findNode::getClass<Gl1Packet>(topNode, 14001);
0056   if (gl1packet)
0057   {
0058     std::cout << "Event No: " << syncobject->EventNumber() << std::hex
0059               << " gl1:  bco 0x" << gl1packet->lValue(0, "BCO") << std::dec << std::endl;
0060     if (bcoinfo)
0061     {
0062       std::cout << "prev event: " << bcoinfo->get_previous_evtno() << std::hex
0063                 << " bco: 0x" << bcoinfo->get_previous_bco() << std::dec << std::endl;
0064       std::cout << "curr event: " << bcoinfo->get_current_evtno() << std::hex
0065                 << " bco: 0x" << bcoinfo->get_current_bco() << std::dec << std::endl;
0066       std::cout << "futu event: " << bcoinfo->get_future_evtno() << std::hex
0067                 << " bco: 0x" << bcoinfo->get_future_bco() << std::dec << std::endl;
0068     }
0069   }
0070   return Fun4AllReturnCodes::EVENT_OK;
0071 }