Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-29 07:52:07

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 RE05CalorimeterHit.cc
0027 /// \brief Implementation of the RE05CalorimeterHit class
0028 
0029 #include "RE05CalorimeterHit.hh"
0030 
0031 #include "G4AttCheck.hh"
0032 #include "G4AttDef.hh"
0033 #include "G4AttValue.hh"
0034 #include "G4Colour.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4UIcommand.hh"
0037 #include "G4UnitsTable.hh"
0038 #include "G4VVisManager.hh"
0039 #include "G4VisAttributes.hh"
0040 #include "G4ios.hh"
0041 
0042 G4ThreadLocal G4Allocator<RE05CalorimeterHit>* RE05CalorimeterHitAllocator = 0;
0043 
0044 std::map<G4String, G4AttDef> RE05CalorimeterHit::fAttDefs;
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0047 
0048 RE05CalorimeterHit::RE05CalorimeterHit()
0049   : G4VHit(), fZCellID(-1), fPhiCellID(-1), fEdep(0.), fPos(), fRot(), fLogV(0)
0050 {}
0051 
0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0053 
0054 RE05CalorimeterHit::RE05CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi)
0055   : G4VHit(), fZCellID(z), fPhiCellID(phi), fEdep(0.), fPos(), fRot(), fLogV(logVol)
0056 {}
0057 
0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0059 
0060 RE05CalorimeterHit::~RE05CalorimeterHit() {}
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0063 
0064 RE05CalorimeterHit::RE05CalorimeterHit(const RE05CalorimeterHit& right) : G4VHit()
0065 {
0066   fZCellID = right.fZCellID;
0067   fPhiCellID = right.fPhiCellID;
0068   fEdep = right.fEdep;
0069   fPos = right.fPos;
0070   fRot = right.fRot;
0071   fLogV = right.fLogV;
0072 }
0073 
0074 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0075 
0076 const RE05CalorimeterHit& RE05CalorimeterHit::operator=(const RE05CalorimeterHit& right)
0077 {
0078   fZCellID = right.fZCellID;
0079   fPhiCellID = right.fPhiCellID;
0080   fEdep = right.fEdep;
0081   fPos = right.fPos;
0082   fRot = right.fRot;
0083   fLogV = right.fLogV;
0084   return *this;
0085 }
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 
0089 G4bool RE05CalorimeterHit::operator==(const RE05CalorimeterHit& right) const
0090 {
0091   return ((fZCellID == right.fZCellID) && (fPhiCellID == right.fPhiCellID));
0092 }
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0095 
0096 void RE05CalorimeterHit::Draw()
0097 {
0098   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0099   if (pVVisManager) {
0100     G4Transform3D trans(fRot, fPos);
0101     G4VisAttributes attribs;
0102     const G4VisAttributes* pVA = fLogV->GetVisAttributes();
0103     if (pVA) attribs = *pVA;
0104     G4Colour colour(1., 0., 0.);
0105     attribs.SetColour(colour);
0106     attribs.SetForceSolid(true);
0107     pVVisManager->Draw(*fLogV, attribs, trans);
0108   }
0109 }
0110 
0111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0112 
0113 const std::map<G4String, G4AttDef>* RE05CalorimeterHit::GetAttDefs() const
0114 {
0115   // G4AttDefs have to have long life.  Use static member...
0116   if (fAttDefs.empty()) {
0117     fAttDefs["HitType"] = G4AttDef("HitType", "Type of hit", "Physics", "", "G4String");
0118     fAttDefs["ZID"] = G4AttDef("ZID", "Z Cell ID", "Physics", "", "G4int");
0119     fAttDefs["PhiID"] = G4AttDef("PhiID", "Phi Cell ID", "Physics", "", "G4int");
0120     fAttDefs["EDep"] = G4AttDef("EDep", "Energy defPosited", "Physics", "G4BestUnit", "G4double");
0121   }
0122   return &fAttDefs;
0123 }
0124 
0125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0126 
0127 std::vector<G4AttValue>* RE05CalorimeterHit::CreateAttValues() const
0128 {
0129   // Create expendable G4AttsValues for picking...
0130   std::vector<G4AttValue>* attValues = new std::vector<G4AttValue>;
0131   attValues->push_back(G4AttValue("HitType", "RE05CalorimeterHit", ""));
0132   attValues->push_back(G4AttValue("ZID", G4UIcommand::ConvertToString(fZCellID), ""));
0133   attValues->push_back(G4AttValue("PhiID", G4UIcommand::ConvertToString(fPhiCellID), ""));
0134   attValues->push_back(G4AttValue("EDep", G4BestUnit(fEdep, "Energy"), ""));
0135   // G4cout << "Checking...\n" << G4AttCheck(attValues, GetAttDefs());
0136   return attValues;
0137 }
0138 
0139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0140 
0141 void RE05CalorimeterHit::Print() {}
0142 
0143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......