00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "G4VReadOutGeometry.hh"
00031 #include "G4Navigator.hh"
00032
00033
00034 G4VReadOutGeometry::G4VReadOutGeometry()
00035 :ROworld(0),fincludeList(0),
00036 fexcludeList(0),touchableHistory(0)
00037 {
00038 name = "unknown";
00039 ROnavigator = new G4Navigator();
00040 }
00041
00042 G4VReadOutGeometry::G4VReadOutGeometry(const G4VReadOutGeometry &right)
00043 {
00044 fincludeList = 0;
00045 fexcludeList = 0;
00046 name = right.name;
00047 ROworld = right.ROworld;
00048 touchableHistory = 0;
00049 ROnavigator = new G4Navigator();
00050
00051
00052 }
00053
00054 G4VReadOutGeometry::G4VReadOutGeometry(G4String n)
00055 :ROworld(0),fincludeList(0),
00056 fexcludeList(0),name(n),touchableHistory(0)
00057 {
00058 ROnavigator = new G4Navigator();
00059 }
00060
00061 G4VReadOutGeometry::~G4VReadOutGeometry()
00062 {
00063
00064 if(fincludeList) delete fincludeList;
00065 if(fexcludeList) delete fexcludeList;
00066 if(touchableHistory) delete touchableHistory;
00067 if(ROnavigator) delete ROnavigator;
00068 }
00069
00070 const G4VReadOutGeometry & G4VReadOutGeometry::operator=(const G4VReadOutGeometry &right)
00071 {
00072 delete fincludeList; fincludeList = 0;
00073 delete fexcludeList; fexcludeList = 0;
00074 name = right.name;
00075 ROworld = right.ROworld;
00076 delete touchableHistory; touchableHistory = 0;
00077 delete ROnavigator; ROnavigator = new G4Navigator();
00078 return *this;
00079 }
00080
00081 G4int G4VReadOutGeometry::operator==(const G4VReadOutGeometry &right) const
00082 { return (this == (G4VReadOutGeometry *) &right); }
00083
00084 G4int G4VReadOutGeometry::operator!=(const G4VReadOutGeometry &right) const
00085 { return (this != (G4VReadOutGeometry *) &right); }
00086
00087 void G4VReadOutGeometry::BuildROGeometry()
00088 {
00089 ROworld = Build();
00090 ROnavigator->SetWorldVolume(ROworld);
00091 }
00092
00093 G4bool G4VReadOutGeometry::CheckROVolume(G4Step*currentStep,G4TouchableHistory*& ROhist)
00094 {
00095 ROhist = 0;
00096 G4bool incFlg = true;
00097 G4VPhysicalVolume* PV = currentStep->GetPreStepPoint()->GetPhysicalVolume();
00098 if((fexcludeList)&&(fexcludeList->CheckPV(PV)))
00099 { incFlg = false; }
00100 else if ((fincludeList)&&(fincludeList->CheckPV(PV)))
00101 { incFlg = true; }
00102 else if((fexcludeList)&&(fexcludeList->CheckLV(PV->GetLogicalVolume())))
00103 { incFlg = false; }
00104 else if((fincludeList)&&(fincludeList->CheckLV(PV->GetLogicalVolume())))
00105 { incFlg = true; }
00106 if(!incFlg) return false;
00107
00108 if(ROworld)
00109 { incFlg = FindROTouchable(currentStep); }
00110 if(incFlg)
00111 { ROhist = touchableHistory; }
00112 return incFlg;
00113 }
00114
00115 G4bool G4VReadOutGeometry::FindROTouchable(G4Step*currentStep)
00116 {
00117
00118
00119
00120
00121
00122
00123
00124
00125 if(!touchableHistory)
00126 {
00127 touchableHistory = new G4TouchableHistory();
00128 ROnavigator->LocateGlobalPointAndUpdateTouchable(
00129 currentStep->GetPreStepPoint()->GetPosition(),
00130 currentStep->GetPreStepPoint()->GetMomentumDirection(),
00131 touchableHistory);
00132 }
00133 else
00134 {
00135 ROnavigator->LocateGlobalPointAndUpdateTouchable(
00136 currentStep->GetPreStepPoint()->GetPosition(),
00137 currentStep->GetPreStepPoint()->GetMomentumDirection(),
00138 touchableHistory,
00139 true);
00140 }
00141
00142
00143
00144
00145
00146
00147
00148
00149 G4VPhysicalVolume* currentVolume = touchableHistory->GetVolume();
00150
00151 if ( currentVolume )
00152 {
00153 return currentVolume->GetLogicalVolume()->
00154 GetSensitiveDetector() != 0;
00155 }
00156
00157 return false;
00158 }
00159