Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:51

0001 #include "g4hitshift.h"
0002 
0003 #include <g4detectors/PHG4CylinderGeom_Spacalv3.h>
0004 
0005 #include <g4main/PHG4Hit.h>
0006 #include <g4main/PHG4HitContainer.h>
0007 
0008 #include <fun4all/Fun4AllReturnCodes.h>
0009 #include <fun4all/SubsysReco.h>                     // for SubsysReco
0010 
0011 #include <phool/PHCompositeNode.h>
0012 #include <phool/getClass.h>
0013 
0014 #include <map>                                      // for operator!=, _Rb_t...
0015 #include <string>
0016 #include <utility>                                  // for pair
0017 
0018 //____________________________________________________________________________..
0019 g4hitshift::g4hitshift(const std::string &name)
0020   : SubsysReco(name)
0021 {
0022 }
0023 
0024 //____________________________________________________________________________..
0025 int g4hitshift::process_event(PHCompositeNode *topNode)
0026 {
0027   PHG4HitContainer *hits = findNode::getClass<PHG4HitContainer>(topNode, "G4HIT_CEMC");
0028   if (hits)
0029   {
0030     //-----------------------------------------------------------------------
0031     // Loop over G4Hits
0032     //-----------------------------------------------------------------------
0033     PHG4HitContainer::ConstRange hit_range = hits->getHits();
0034     for (PHG4HitContainer::ConstIterator hit_iter = hit_range.first; hit_iter != hit_range.second; hit_iter++)
0035     {
0036       int scint_id = hit_iter->second->get_scint_id();
0037 
0038       PHG4CylinderGeom_Spacalv3::scint_id_coder decoder(scint_id);
0039 
0040       int sectornumber = decoder.sector_ID;
0041       int shiftedsector = sectornumber + 8;
0042       if (shiftedsector > 31)
0043       {
0044         shiftedsector = shiftedsector - 31;
0045       }
0046       PHG4CylinderGeom_Spacalv3::scint_id_coder encoder(shiftedsector, decoder.tower_ID, decoder.fiber_ID);
0047 
0048       hit_iter->second->set_scint_id(encoder.scint_ID);
0049     }
0050   }
0051   return Fun4AllReturnCodes::EVENT_OK;
0052 }