00001
00002
00003 #include "musrTrackerHit.hh"
00004 #include "G4UnitsTable.hh"
00005 #include "G4VVisManager.hh"
00006 #include "G4Circle.hh"
00007 #include "G4Colour.hh"
00008 #include "G4VisAttributes.hh"
00009 #include <fstream.h>
00010 #include <iostream.h>
00011 #include "G4ios.hh"
00012 #include "G4MagneticField.hh"
00013 #include "G4FieldManager.hh"
00014 #include "G4TransportationManager.hh"
00015 #include <iomanip>
00016 #include "globals.hh"
00017 #include "G4Transform3D.hh"
00018 #include "G4ProcessManager.hh"
00019 #include "G4Track.hh"
00020 #include "G4ThreeVector.hh"
00021
00022 G4Allocator<musrTrackerHit> musrTrackerHitAllocator;
00023
00024
00025
00026 musrTrackerHit::musrTrackerHit() {}
00027
00028
00029
00030 musrTrackerHit::~musrTrackerHit() {}
00031
00032
00033
00034 musrTrackerHit::musrTrackerHit(const musrTrackerHit& right)
00035 : G4VHit()
00036 {
00037 particle_name = right.particle_name;
00038 trackID = right.trackID;
00039 edep = right.edep;
00040 pos = right.pos;
00041 pol = right.pol;
00042 }
00043
00044
00045
00046 const musrTrackerHit& musrTrackerHit::operator=(const musrTrackerHit& right)
00047 {
00048 particle_name = right.particle_name;
00049 trackID = right.trackID;
00050 edep = right.edep;
00051 pos = right.pos;
00052 pol = right.pol;
00053 return *this;
00054 }
00055
00056
00057
00058 G4int musrTrackerHit::operator==(const musrTrackerHit& right) const
00059 {
00060 return (this==&right) ? 1 : 0;
00061 }
00062
00063
00064
00065 void musrTrackerHit::Draw()
00066 {
00067 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
00068 if(pVVisManager)
00069 {
00070 G4Circle circle(pos);
00071 circle.SetScreenSize(0.04);
00072 circle.SetFillStyle(G4Circle::filled);
00073 G4Colour colour(1.,0.,0.);
00074 G4VisAttributes attribs(colour);
00075 circle.SetVisAttributes(attribs);
00076 pVVisManager->Draw(circle);
00077 }
00078 }
00079
00080
00081
00082 void musrTrackerHit::Print()
00083 {
00084
00085 if (trackID==1)
00086 {
00087
00088 G4FieldManager *fMgr=G4TransportationManager::GetTransportationManager()->GetFieldManager();
00089
00090
00091 point[0]=0.;
00092 point[1]=0.;
00093 point[2]=0.;
00094
00095 B[2]=0.0;
00096
00097
00098 if(!fMgr->DoesFieldChangeEnergy())
00099 {
00100 mfield = fMgr->GetDetectorField();
00101 mfield->GetFieldValue(point,B);
00102 B[0]=B[0]*1000;
00103 B[1]=B[1]*1000;
00104 B[2]=B[2]*1000;
00105
00106 }
00107 else{
00108
00109 }
00110
00111
00112 ofstream mufile1;
00113 mufile1.open ("muposition.dat", ios::out | ios::app);
00114 mufile1 << fabs(B[2]) <<" "<< pos.x()/cm<<" "<<pos.y()/cm <<" "<< pos.z()/cm << G4endl;
00115 mufile1.close();
00116
00117 ofstream mufile2;
00118 mufile2.open ("mupol.dat", ios::out | ios::app);
00119 mufile2 << pos.x()/m<<" "<<pos.y()/m <<" "<< pos.z()/m<<" "
00120 << pol.x()<<" "<<pol.y()<<" "<< pol.z() <<G4endl;
00121 mufile2.close();
00122 }
00123 }
00124
00125
00126