Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-11 08:31:12

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file RE01CalorimeterHit.cc
0027 /// \brief Implementation of the RE01CalorimeterHit class
0028 
0029 #include "RE01CalorimeterHit.hh"
0030 
0031 #include "G4AttDef.hh"
0032 #include "G4AttDefStore.hh"
0033 #include "G4AttValue.hh"
0034 #include "G4Colour.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4SystemOfUnits.hh"
0037 #include "G4UIcommand.hh"
0038 #include "G4UnitsTable.hh"
0039 #include "G4VVisManager.hh"
0040 #include "G4VisAttributes.hh"
0041 #include "G4ios.hh"
0042 
0043 G4ThreadLocal G4Allocator<RE01CalorimeterHit>* RE01CalorimeterHitAllocator = 0;
0044 
0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0046 RE01CalorimeterHit::RE01CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi)
0047   : G4VHit(),
0048     fZCellID(z),
0049     fPhiCellID(phi),
0050     fEdep(0.0),
0051     fPos(0),
0052     fRot(0., 0., 0.),
0053     fPLogV(logVol),
0054     fEdepByATrack(0.0),
0055     fTrackInfo()
0056 {
0057   ;
0058 }
0059 
0060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0061 RE01CalorimeterHit::~RE01CalorimeterHit()
0062 {
0063   ;
0064 }
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0067 void RE01CalorimeterHit::Draw()
0068 {
0069   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0070   if (pVVisManager) {
0071     G4Transform3D trans(fRot, fPos);
0072     G4VisAttributes attribs;
0073     const G4VisAttributes* pVA = fPLogV->GetVisAttributes();
0074     if (pVA) attribs = *pVA;
0075     G4Colour colour(1., 0., 0.);
0076     attribs.SetColour(colour);
0077     attribs.SetForceWireframe(false);
0078     attribs.SetForceSolid(true);
0079     pVVisManager->Draw(*fPLogV, attribs, trans);
0080   }
0081 }
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0084 const std::map<G4String, G4AttDef>* RE01CalorimeterHit::GetAttDefs() const
0085 {
0086   G4bool isNew;
0087   std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("RE01CalorimeterHit", isNew);
0088   if (isNew) {
0089     G4String hitType("HitType");
0090     (*store)[hitType] = G4AttDef(hitType, "Hit Type", "Physics", "", "G4String");
0091 
0092     G4String zCellID("ZCellID");
0093     (*store)[zCellID] = G4AttDef(zCellID, "Z Cell ID", "Physics", "", "G4int");
0094 
0095     G4String phiCellID("PhiCellID");
0096     (*store)[phiCellID] = G4AttDef(phiCellID, "Phi Cell ID", "Physics", "", "G4int");
0097 
0098     G4String energy("Energy");
0099     (*store)[energy] = G4AttDef(energy, "Energy Deposited", "Physics", "G4BestUnit", "G4double");
0100 
0101     G4String eTrack("ETrack");
0102     (*store)[eTrack] =
0103       G4AttDef(eTrack, "Energy Deposited By Track", "Physics", "G4BestUnit", "G4double");
0104 
0105     G4String pos("Pos");
0106     (*store)[pos] = G4AttDef(pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0107 
0108     G4String lvol("LVol");
0109     (*store)[lvol] = G4AttDef(lvol, "Logical Volume", "Physics", "", "G4String");
0110   }
0111 
0112   return store;
0113 }
0114 
0115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0116 std::vector<G4AttValue>* RE01CalorimeterHit::CreateAttValues() const
0117 {
0118   std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
0119 
0120   values->push_back(G4AttValue("HitType", "RE01CalorimeterHit", ""));
0121 
0122   values->push_back(G4AttValue("ZCellID", G4UIcommand::ConvertToString(fZCellID), ""));
0123 
0124   values->push_back(G4AttValue("PhiCellID", G4UIcommand::ConvertToString(fPhiCellID), ""));
0125 
0126   values->push_back(G4AttValue("Energy", G4BestUnit(fEdep, "Energy"), ""));
0127 
0128   values->push_back(G4AttValue("ETrack", G4BestUnit(fEdepByATrack, "Energy"), ""));
0129 
0130   values->push_back(G4AttValue("Pos", G4BestUnit(fPos, "Length"), ""));
0131 
0132   if (fPLogV)
0133     values->push_back(G4AttValue("LVol", fPLogV->GetName(), ""));
0134   else
0135     values->push_back(G4AttValue("LVol", " ", ""));
0136 
0137   return values;
0138 }
0139 
0140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0141 void RE01CalorimeterHit::Print()
0142 {
0143   G4cout << "Cell[" << fZCellID << "," << fPhiCellID << "]    " << fEdep / GeV << " [GeV]"
0144          << G4endl;
0145 }