source: trunk/examples/extended/runAndEvent/RE01/src/RE01TrackerHit.cc @ 807

Last change on this file since 807 was 807, checked in by garnier, 16 years ago

update

File size: 4.4 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26// $Id: RE01TrackerHit.cc,v 1.5 2006/11/14 07:07:38 perl Exp $
27// GEANT4 tag $Name:  $
28//
29
30
31#include "RE01TrackerHit.hh"
32#include "G4VVisManager.hh"
33#include "G4Circle.hh"
34#include "G4Colour.hh"
35#include "G4AttDefStore.hh"
36#include "G4AttDef.hh"
37#include "G4AttValue.hh"
38#include "G4UIcommand.hh"
39#include "G4UnitsTable.hh"
40#include "G4VisAttributes.hh"
41
42
43G4Allocator<RE01TrackerHit> RE01TrackerHitAllocator;
44
45RE01TrackerHit::RE01TrackerHit()
46{;}
47
48RE01TrackerHit::~RE01TrackerHit()
49{;}
50
51RE01TrackerHit::RE01TrackerHit(const RE01TrackerHit &right)
52  : G4VHit()
53{
54  edep = right.edep;
55  pos = right.pos;
56  trackID = right.trackID;
57}
58
59const RE01TrackerHit& RE01TrackerHit::operator=(const RE01TrackerHit &right)
60{
61  edep = right.edep;
62  pos = right.pos;
63  trackID = right.trackID;
64  return *this;
65}
66
67G4int RE01TrackerHit::operator==(const RE01TrackerHit &right) const
68{
69  return (this==&right) ? 1 : 0;
70}
71
72void RE01TrackerHit::Draw()
73{
74  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
75  if(pVVisManager)
76  {
77    G4Circle circle(pos);
78    circle.SetScreenSize(0.04);
79    circle.SetFillStyle(G4Circle::filled);
80    G4Colour colour(1.,0.,0.);
81    G4VisAttributes attribs(colour);
82    circle.SetVisAttributes(attribs);
83    pVVisManager->Draw(circle);
84  }
85}
86
87const std::map<G4String,G4AttDef>* RE01TrackerHit::GetAttDefs() const
88{
89  G4bool isNew;
90  std::map<G4String,G4AttDef>* store
91    = G4AttDefStore::GetInstance("RE01TrackerHit",isNew);
92  if (isNew) {
93    G4String HitType("HitType");
94    (*store)[HitType] = G4AttDef(HitType,"Hit Type","Physics","","G4String");
95
96    G4String TrackID("TrackID");
97    (*store)[TrackID] = G4AttDef(TrackID,"Track ID","Physics","","G4int");
98
99    G4String Energy("Energy");
100    (*store)[Energy] = G4AttDef(Energy,"Energy Deposited","Physics","G4BestUnit","G4double");
101
102    G4String ETrack("ETrack");
103    (*store)[ETrack] = G4AttDef(ETrack,"Energy Deposited By Track","Physics","G4BestUnit","G4double");
104
105    G4String Pos("Pos");
106    (*store)[Pos] = G4AttDef(Pos, "Position",
107                      "Physics","G4BestUnit","G4ThreeVector");
108  }
109  return store;
110}
111
112std::vector<G4AttValue>* RE01TrackerHit::CreateAttValues() const
113{
114  std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
115
116  values->push_back(G4AttValue("HitType","RE01TrackerHit",""));
117
118  values->push_back
119    (G4AttValue("TrackID",G4UIcommand::ConvertToString(trackID),""));
120
121  values->push_back
122    (G4AttValue("Energy",G4BestUnit(edep,"Energy"),""));
123
124  G4double noEnergy = 0.*MeV;
125  values->push_back
126    (G4AttValue("ETrack",G4BestUnit(noEnergy,"Energy"),""));
127
128  values->push_back
129    (G4AttValue("Pos",G4BestUnit(pos,"Length"),""));
130 
131   return values;
132}
133
134void RE01TrackerHit::Print()
135{
136  G4cout << "TrackID " << trackID << "   Position " << pos << "       : " << edep/keV << " [keV]" << G4endl;
137}
138
139
Note: See TracBrowser for help on using the repository browser.