File indexing completed on 2025-08-05 08:14:59
0001 #include <g4main/PHG4Hit.h>
0002 #include <g4main/PHG4HitContainer.h>
0003
0004 #include "g4hitshift.h"
0005
0006 #include <fun4all/Fun4AllReturnCodes.h>
0007
0008 #include <fun4all/Fun4AllHistoManager.h>
0009
0010 #include <phool/PHCompositeNode.h>
0011
0012
0013 #include <g4main/PHG4Hit.h>
0014 #include <g4main/PHG4HitContainer.h>
0015 #include <g4main/PHG4TruthInfoContainer.h>
0016 #include <g4main/PHG4Particle.h>
0017 #include <g4main/PHG4HitDefs.h> // for hit_idbits
0018
0019
0020 #include <g4detectors/PHG4Cell.h>
0021 #include <g4detectors/PHG4CellContainer.h>
0022 #include <g4detectors/PHG4CellDefs.h> // for genkey, keytype
0023
0024
0025 #include <calobase/RawTower.h>
0026 #include <calobase/RawTowerContainer.h>
0027 #include <calobase/RawTowerGeom.h>
0028 #include <calobase/RawTowerGeomContainer.h>
0029 #include <calobase/RawTowerDefs.h>
0030
0031 #include <calobase/RawCluster.h>
0032 #include <calobase/RawClusterContainer.h>
0033
0034 #include <fun4all/Fun4AllHistoManager.h>
0035 #include <fun4all/Fun4AllReturnCodes.h>
0036
0037
0038 #include "g4detectors/PHG4CylinderGeomContainer.h"
0039 #include "g4detectors/PHG4CylinderGeom_Spacalv1.h" // for PHG4CylinderGeom_Spaca...
0040 #include "g4detectors/PHG4CylinderGeom_Spacalv3.h"
0041 #include "g4detectors/PHG4CylinderCellGeomContainer.h"
0042 #include "g4detectors/PHG4CylinderCellGeom_Spacalv1.h"
0043
0044
0045 #include <phool/getClass.h>
0046 #include <TProfile.h>
0047 #include <TFile.h>
0048 #include <TNtuple.h>
0049 #include <TMath.h>
0050 #include <cassert>
0051 #include <sstream>
0052 #include <string>
0053 #include <TF1.h>
0054
0055
0056
0057 g4hitshift::g4hitshift(const std::string &name):
0058 SubsysReco(name)
0059 {
0060 }
0061
0062
0063 g4hitshift::~g4hitshift()
0064 {
0065 }
0066
0067
0068 int g4hitshift::Init(PHCompositeNode *topNode)
0069 {
0070 return Fun4AllReturnCodes::EVENT_OK;
0071 }
0072
0073
0074 int g4hitshift::InitRun(PHCompositeNode *topNode)
0075 {
0076 return Fun4AllReturnCodes::EVENT_OK;
0077 }
0078
0079
0080 int g4hitshift::process_event(PHCompositeNode *topNode)
0081 {
0082 PHG4HitContainer* hits = findNode::getClass<PHG4HitContainer>(topNode, "G4HIT_CEMC");
0083 if (hits)
0084 {
0085
0086
0087
0088 PHG4HitContainer::ConstRange hit_range = hits->getHits();
0089 for (PHG4HitContainer::ConstIterator hit_iter = hit_range.first; hit_iter != hit_range.second; hit_iter++)
0090 {
0091 int scint_id = hit_iter->second->get_scint_id();
0092
0093 PHG4CylinderGeom_Spacalv3::scint_id_coder decoder(scint_id);
0094
0095 int sectornumber = decoder.sector_ID;
0096 int shiftedsector = sectornumber + 8;
0097 if (shiftedsector > 31)
0098 {
0099 shiftedsector = shiftedsector - 31;
0100 }
0101 PHG4CylinderGeom_Spacalv3::scint_id_coder encoder(shiftedsector,decoder.tower_ID,decoder.fiber_ID);
0102
0103 hit_iter->second->set_scint_id(encoder.scint_ID);
0104 }
0105 }
0106 return Fun4AllReturnCodes::EVENT_OK;
0107 }
0108
0109
0110 int g4hitshift::ResetEvent(PHCompositeNode *topNode)
0111 {
0112 return Fun4AllReturnCodes::EVENT_OK;
0113 }
0114
0115
0116 int g4hitshift::EndRun(const int runnumber)
0117 {
0118 return Fun4AllReturnCodes::EVENT_OK;
0119 }
0120
0121
0122 int g4hitshift::End(PHCompositeNode *topNode)
0123 {
0124 return Fun4AllReturnCodes::EVENT_OK;
0125 }
0126
0127
0128 int g4hitshift::Reset(PHCompositeNode *topNode)
0129 {
0130 return Fun4AllReturnCodes::EVENT_OK;
0131 }
0132
0133
0134 void g4hitshift::Print(const std::string &what) const
0135 {
0136 }