Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:45

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