Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:21:58

0001 #include "PHG4HitReadBack.h"
0002 
0003 #include "PHG4Hit.h"
0004 #include "PHG4HitContainer.h"
0005 
0006 #include <fun4all/Fun4AllReturnCodes.h>
0007 
0008 #include <phool/getClass.h>
0009 
0010 #include <iostream>
0011 #include <map>      // for _Rb_tree_const_iterator
0012 #include <utility>  // for pair
0013 
0014 class PHCompositeNode;
0015 
0016 PHG4HitReadBack::PHG4HitReadBack(const std::string &name)
0017   : SubsysReco(name)
0018 {
0019   return;
0020 }
0021 
0022 int PHG4HitReadBack::process_event(PHCompositeNode *topNode)
0023 {
0024   PHG4HitContainer *phc = findNode::getClass<PHG4HitContainer>(topNode, "PHG4Hit");
0025   if (!phc)
0026   {
0027     std::cout << "No PHG4Hit found" << std::endl;
0028     return Fun4AllReturnCodes::ABORTEVENT;
0029   }
0030   phc->identify();
0031   std::pair<PHG4HitContainer::ConstIterator, PHG4HitContainer::ConstIterator> hititer = phc->getHits(1);
0032   PHG4HitContainer::ConstIterator begin;
0033   PHG4HitContainer::ConstIterator end;
0034   PHG4HitContainer::ConstIterator it;
0035   begin = hititer.first;
0036   end = hititer.second;
0037   for (it = begin; it != end; ++it)
0038   {
0039     std::cout << "key: 0x" << std::hex << it->first << std::dec << std::endl;
0040     std::cout << "x: " << it->second->get_x(0) << std::endl;
0041   }
0042   std::cout << "detid: 2" << std::endl;
0043   hititer = phc->getHits(2);
0044   begin = hititer.first;
0045   end = hititer.second;
0046   for (it = begin; it != end; ++it)
0047   {
0048     std::cout << "key: 0x" << std::hex << it->first << std::dec << std::endl;
0049     std::cout << "x: " << it->second->get_x(0) << std::endl;
0050   }
0051   std::cout << "detid: 3" << std::endl;
0052   hititer = phc->getHits(3);
0053   begin = hititer.first;
0054   end = hititer.second;
0055   for (it = begin; it != end; ++it)
0056   {
0057     std::cout << "key: 0x" << std::hex << it->first << std::dec << std::endl;
0058     std::cout << "x: " << it->second->get_x(0) << std::endl;
0059   }
0060   //   phc = findNode::getClass<PHG4HitContainer>(topNode,"PHG4Hit2");
0061   //   if (!phc)
0062   //     {
0063   //       std::cout << "No PHG4Hit found" << std::endl;
0064   //       return ABORTEVENT;
0065   //     }
0066   //   phc->identify();
0067   return Fun4AllReturnCodes::EVENT_OK;
0068 }