Back to home page

EIC code displayed by LXR

 
 

    


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

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 runAndEvent/RE01/src/RE01CalorimeterHit.cc
0027 /// \brief Implementation of the RE01CalorimeterHit class
0028 //
0029 //
0030 //
0031 
0032 #include "RE01CalorimeterHit.hh"
0033 
0034 #include "G4AttDef.hh"
0035 #include "G4AttDefStore.hh"
0036 #include "G4AttValue.hh"
0037 #include "G4Colour.hh"
0038 #include "G4LogicalVolume.hh"
0039 #include "G4SystemOfUnits.hh"
0040 #include "G4UIcommand.hh"
0041 #include "G4UnitsTable.hh"
0042 #include "G4VVisManager.hh"
0043 #include "G4VisAttributes.hh"
0044 #include "G4ios.hh"
0045 
0046 G4ThreadLocal G4Allocator<RE01CalorimeterHit>* RE01CalorimeterHitAllocator = 0;
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 RE01CalorimeterHit::RE01CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi)
0050   : G4VHit(),
0051     fZCellID(z),
0052     fPhiCellID(phi),
0053     fEdep(0.0),
0054     fPos(0),
0055     fRot(0., 0., 0.),
0056     fPLogV(logVol),
0057     fEdepByATrack(0.0),
0058     fTrackInfo()
0059 {
0060   ;
0061 }
0062 
0063 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0064 RE01CalorimeterHit::~RE01CalorimeterHit()
0065 {
0066   ;
0067 }
0068 
0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0070 void RE01CalorimeterHit::Draw()
0071 {
0072   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0073   if (pVVisManager) {
0074     G4Transform3D trans(fRot, fPos);
0075     G4VisAttributes attribs;
0076     const G4VisAttributes* pVA = fPLogV->GetVisAttributes();
0077     if (pVA) attribs = *pVA;
0078     G4Colour colour(1., 0., 0.);
0079     attribs.SetColour(colour);
0080     attribs.SetForceWireframe(false);
0081     attribs.SetForceSolid(true);
0082     pVVisManager->Draw(*fPLogV, attribs, trans);
0083   }
0084 }
0085 
0086 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0087 const std::map<G4String, G4AttDef>* RE01CalorimeterHit::GetAttDefs() const
0088 {
0089   G4bool isNew;
0090   std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("RE01CalorimeterHit", isNew);
0091   if (isNew) {
0092     G4String hitType("HitType");
0093     (*store)[hitType] = G4AttDef(hitType, "Hit Type", "Physics", "", "G4String");
0094 
0095     G4String zCellID("ZCellID");
0096     (*store)[zCellID] = G4AttDef(zCellID, "Z Cell ID", "Physics", "", "G4int");
0097 
0098     G4String phiCellID("PhiCellID");
0099     (*store)[phiCellID] = G4AttDef(phiCellID, "Phi Cell ID", "Physics", "", "G4int");
0100 
0101     G4String energy("Energy");
0102     (*store)[energy] = G4AttDef(energy, "Energy Deposited", "Physics", "G4BestUnit", "G4double");
0103 
0104     G4String eTrack("ETrack");
0105     (*store)[eTrack] =
0106       G4AttDef(eTrack, "Energy Deposited By Track", "Physics", "G4BestUnit", "G4double");
0107 
0108     G4String pos("Pos");
0109     (*store)[pos] = G4AttDef(pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0110 
0111     G4String lvol("LVol");
0112     (*store)[lvol] = G4AttDef(lvol, "Logical Volume", "Physics", "", "G4String");
0113   }
0114 
0115   return store;
0116 }
0117 
0118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0119 std::vector<G4AttValue>* RE01CalorimeterHit::CreateAttValues() const
0120 {
0121   std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
0122 
0123   values->push_back(G4AttValue("HitType", "RE01CalorimeterHit", ""));
0124 
0125   values->push_back(G4AttValue("ZCellID", G4UIcommand::ConvertToString(fZCellID), ""));
0126 
0127   values->push_back(G4AttValue("PhiCellID", G4UIcommand::ConvertToString(fPhiCellID), ""));
0128 
0129   values->push_back(G4AttValue("Energy", G4BestUnit(fEdep, "Energy"), ""));
0130 
0131   values->push_back(G4AttValue("ETrack", G4BestUnit(fEdepByATrack, "Energy"), ""));
0132 
0133   values->push_back(G4AttValue("Pos", G4BestUnit(fPos, "Length"), ""));
0134 
0135   if (fPLogV)
0136     values->push_back(G4AttValue("LVol", fPLogV->GetName(), ""));
0137   else
0138     values->push_back(G4AttValue("LVol", " ", ""));
0139 
0140   return values;
0141 }
0142 
0143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0144 void RE01CalorimeterHit::Print()
0145 {
0146   G4cout << "Cell[" << fZCellID << "," << fPhiCellID << "]    " << fEdep / GeV << " [GeV]"
0147          << G4endl;
0148 }