#include "globals.hh"
#include "G3VolTable.hh"
#include "G4VSolid.hh"
#include "G3toG4.hh"
#include <cmath>
Go to the source code of this file.
Functions | |
G4bool | G3CalcParamsFn (G4double *rpar, G4int npar, G4double *rparm, G4String shape, G4String shapem) |
G4bool | G3NegVolPars (G4double pars[], G4int *nparpt, G3VolTableEntry *vte, G3VolTableEntry *mvte, const char routine[]) |
G4bool G3CalcParamsFn | ( | G4double * | rpar, | |
G4int | npar, | |||
G4double * | rparm, | |||
G4String | shape, | |||
G4String | shapem | |||
) |
Definition at line 37 of file G3NegVolPars.cc.
Referenced by G3NegVolPars().
00041 { 00042 G4bool NegPresent = FALSE; 00043 // for normal single volume positioning, just substitute for the 00044 // negative parameters 00045 // treat only the legal cases 00046 if (shapem == shape) { 00047 if (shape == "BOX" || shape == "TRD1" || shape == "TRD2" || 00048 shape == "ELTU") { 00049 for (G4int i=0;i<npar;i++) { 00050 if (rpar[i] < 0) { 00051 if (rparm != 0) rpar[i] = rparm[i]; 00052 if (rpar[i] < 0) NegPresent = TRUE; 00053 } 00054 } 00055 } 00056 if (shape == "TRAP") { 00057 for (G4int i=0;i<11;i++) { 00058 if (i != 1 && i != 2 && i != 6 && i != 10) { 00059 if (rpar[i]<0) { 00060 if (rparm != 0) rpar[i] = rparm[i]; 00061 if (rpar[i] < 0) NegPresent = TRUE; 00062 } 00063 } 00064 } 00065 } 00066 if (shape == "TUBE" || shape == "TUBS" || shape == "PARA") { 00067 for (G4int i=0;i<3;i++) { 00068 if (rpar[i] < 0) { 00069 if (rparm != 0) rpar[i] = rparm[i]; 00070 if (rpar[i] < 0) NegPresent = TRUE; 00071 } 00072 } 00073 } 00074 if (shape == "CONE" || shape == "CONS") { 00075 for (G4int i=0;i<5;i++) { 00076 if (rpar[i] < 0) { 00077 if (rparm != 0) rpar[i] = rparm[i]; 00078 if (rpar[i] < 0) NegPresent = TRUE; 00079 } 00080 } 00081 } 00082 if (shape == "SPHE") { 00083 for (G4int i=0;i<2;i++) { 00084 if (rpar[i] < 0) { 00085 if (rparm != 0) rpar[i] = rparm[i]; 00086 if (rpar[i] < 0) NegPresent = TRUE; 00087 } 00088 } 00089 } 00090 if (shape == "PGON") { 00091 G4int nz = G4int(rpar[3]); 00092 G4int ipl; 00093 for (G4int i=0;i<nz;i++) { 00094 ipl = 5 + i*3; 00095 if (rpar[ipl] < 0) { 00096 if (rparm != 0) rpar[ipl] = rparm[ipl]; 00097 if (rpar[ipl] < 0) NegPresent = TRUE; 00098 } 00099 if (rpar[ipl+1] < 0) { 00100 if (rparm != 0) rpar[ipl] = rparm[ipl]; 00101 if (rpar[ipl] < 0) NegPresent = TRUE; 00102 } 00103 } 00104 } 00105 if (shape == "PCON") { 00106 G4int nz = G4int(rpar[2]); 00107 G4int ipl; 00108 for (G4int i=0;i<nz;i++) { 00109 ipl = 4 + i*3; 00110 if (rpar[ipl] < 0) { 00111 if (rparm != 0) rpar[ipl] = rparm[ipl]; 00112 if (rpar[ipl] < 0) NegPresent = TRUE; 00113 } 00114 if (rpar[ipl+1] < 0) { 00115 // TO DO 00116 // check - folowing argument might be ipl+1 00117 if (rparm != 0) rpar[ipl] = rparm[ipl]; 00118 if (rpar[ipl] < 0) NegPresent = TRUE; 00119 } 00120 } 00121 } 00122 } 00123 00124 if (shape == "BOX") { 00125 if (shapem == "TRD1") { 00126 if (rpar[1] < 0) { 00127 if (rparm != 0) rpar[1] = rparm[2]; 00128 if (rpar[1] < 0) NegPresent = TRUE; 00129 } 00130 if (rpar[2] < 0) { 00131 if (rparm != 0) rpar[2] = rparm[3]; 00132 if (rpar[2] < 0) NegPresent = TRUE; 00133 } 00134 if (rpar[0] < 0) { 00135 if (rparm != 0) rpar[0] = std::min(rparm[0],rparm[1]) + 00136 std::abs(rparm[0]-rparm[1])*.5*rpar[2]/rparm[3]; 00137 if (rpar[0] < 0) NegPresent = TRUE; 00138 } 00139 } 00140 if (shapem == "TRD2") { 00141 if (rpar[2] < 0) { 00142 if (rparm != 0) rpar[2] = rparm[4]; 00143 if (rpar[2]<0) NegPresent = TRUE; 00144 } 00145 if (rpar[0] < 0) { 00146 if (rparm != 0) rpar[0] = std::min(rparm[0],rparm[1]) + 00147 std::abs(rparm[0]-rparm[1])*.5*rpar[2]/rparm[4]; 00148 if (rpar[0]<0) NegPresent = TRUE; 00149 } 00150 if (rpar[1] < 0) { 00151 if (rparm != 0) rpar[1] = std::min(rparm[2],rparm[3]) + 00152 std::abs(rparm[2]-rparm[3])*.5*rpar[2]/rparm[4]; 00153 if (rpar[1]<0) NegPresent = TRUE; 00154 } 00155 } 00156 if (shapem == "TRAP") { 00157 if (rpar[2] < 0) { 00158 if (rparm != 0) rpar[2] = rparm[0]; 00159 if (rpar[2] < 0) NegPresent = TRUE; 00160 } 00161 if (rpar[0] < 0) { 00162 if (rparm != 0) { 00163 G4double xlo = std::min(rparm[4],rparm[8]) + 00164 std::abs(rparm[4]-rparm[8])*.5*rpar[2]/rparm[0]; 00165 G4double xhi = std::min(rparm[5],rparm[9]) + 00166 std::abs(rparm[5]-rparm[9])*.5*rpar[2]/rparm[0]; 00167 rpar[0] = std::min(xlo,xhi); 00168 } 00169 if (rpar[0] < 0) NegPresent = TRUE; 00170 } 00171 if (rpar[1] < 0) { 00172 if (rparm != 0) rpar[1] = std::min(rparm[3],rparm[7]) + 00173 std::abs(rparm[3]-rparm[7])*.5*rpar[2]/rparm[0]; 00174 if (rpar[1] < 0) NegPresent = TRUE; 00175 } 00176 } 00177 } 00178 return NegPresent; 00179 }
G4bool G3NegVolPars | ( | G4double | pars[], | |
G4int * | nparpt, | |||
G3VolTableEntry * | vte, | |||
G3VolTableEntry * | mvte, | |||
const char | routine[] | |||
) |
Definition at line 181 of file G3NegVolPars.cc.
References FALSE, G3CalcParamsFn(), G3VolTableEntry::GetNpar(), G3VolTableEntry::GetRpar(), G3VolTableEntry::GetShape(), and TRUE.
Referenced by G4CreateCloneVTE(), and G4ProcessDaughters().
00184 { 00185 G4bool NegPresent = FALSE; 00186 00187 // retrieve parameters 00188 00189 // the volume 00190 G4String shape = vte->GetShape(); 00191 G4double* rpar = vte->GetRpar(); 00192 G4int npar = vte->GetNpar(); 00193 if (npar ==0) { 00194 // no solid parameters are defined in vte 00195 npar = *nparpt; 00196 rpar = pars; 00197 } 00198 else { 00199 // solid parameters are already defined in vte 00200 // pars[], nparpt are ignored 00201 // TO DO: check if g3 ignores them too or resets 00202 // vte parameters according to this new ones !! 00203 } 00204 00205 // mother 00206 G4String shapem = mvte->GetShape(); 00207 G4double* rparm = mvte->GetRpar(); 00208 00209 if (strcmp(routine,"GSPOS") == 0 || strcmp(routine,"GSVOLU") == 0) { 00210 NegPresent = G3CalcParamsFn(rpar,npar,rparm,shape,shapem); 00211 } 00212 if (strcmp(routine,"GSDVN") == 0) { 00213 // just set the flag. The parametrization function figures out 00214 // what to do. 00215 for (G4int i=0;i<npar;i++) { 00216 if (rpar[i] < 0) { 00217 NegPresent = TRUE; 00218 } 00219 } 00220 } 00221 return NegPresent; 00222 }