//////////////////////////////////////////////////////////////////////// /// /// \class /// /// \brief /// /// \author Aksel Hallin aksel.hallin@ualberta.ca /// /// REVISION HISTORY:\n /// Jul 9, 2014 : Aksel Hallin \n /// /// \detail //// //////////////////////////////////////////////////////////////////////// #include #include #include #include #include using namespace RAT; // A SNORopeLoop is the portion of the loop inside the rope groove of the belly plates- that is, a semicircular torus. SNORopeLoop::SNORopeLoop(DBLinkPtr geoDimensionsTable, G4double aPhi):fXaxis(sin(aPhi),-cos(aPhi),0),fYaxis(cos(aPhi),sin(aPhi),0),fZaxis(0,0,1){ G4double fInnerAVradius = geoDimensionsTable->GetD( "inner_av_radius" ); G4double fAVthickness = geoDimensionsTable->GetD( "av_thickness" ); G4double fUpRopeRadius = geoDimensionsTable->GetD( "up_rope_radius" ); //G4double fSNORopeRadius = geoDimensionsTable->GetD("sno_rope_radius"); //G4double fBellyPlateInnerRadius = geoDimensionsTable->GetD("bellyplate_inner_radius"); fGrooveInnerRadius = geoDimensionsTable->GetD("ropegroove_inner_radius"); fGrooveOuterRadius = geoDimensionsTable->GetD("ropegroove_outer_radius"); fOuterAVradius = fInnerAVradius + fAVthickness; //G4double fBPthickness = geoDimensionsTable->GetD( "bellyplate_additional_thickness")*2 + fAVthickness; fLoopRadius=fGrooveInnerRadius + fUpRopeRadius + 2*geoDimensionsTable->GetD("groove_tolerance"); // Rho distance to the axis of the rope. Same definition as for the groove. // This is the exact position, but a tweaked one is used // Tweaked position. If changed, make sure SNORope and SNOAVBellyPlate agree fMaxHalfThick=fUpRopeRadius;// Half thickness of rope going out from the center of the panel fMinHalfThick=fUpRopeRadius*3.1416/4.;// Thickness of flattened rope. Rectangular shape. One side is 2r, the other is redefined. fRadius = fInnerAVradius+2*geoDimensionsTable->GetD("groove_tolerance")+ geoDimensionsTable->GetD("ropegroove_depth")/2.; fOrigin=fRadius*fYaxis;// Actual vector corresponding to the center of the rope loop fThreshold = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance(); //Geant's tolerance to determine if one is on a surface or not. } EInside SNORopeLoop::Inside(const G4ThreeVector &p)const{ EInside in; // JP - Any point above 0 is outside, as it corresponds to the regular rope if(p.z()>0) return kOutside; // The rope is assumed to be shaped like a rectangular box against the groove. double x = p*fXaxis; double y = p*fYaxis; double z = p*fZaxis; double delta = fabs(sqrt(x*x + z*z)-fLoopRadius); double deltay = fabs(y - fRadius); // JP rewrote all of these conditions if(delta>fMinHalfThick+fThreshold || deltay>fMaxHalfThick+fThreshold) in=kOutside; else if (delta0&&d0&&d0&&d10&&d20&&d10&&d20)d=local.y()-fMaxHalfThick; else d=local.y()+fMaxHalfThick; if(d>0)d2=d*d; else d2=0; /// A SNORopeLoop is the portion of the loop inside the rope groove of the belly plates- that is, a semicircular torus. if(local.z()>0)d2+=local.z()*local.z(); else{ double del=sqrt(local.x()*local.x()+local.z()*local.z())-fLoopRadius; if(del>fMinHalfThick)d2+=pow(del-fMinHalfThick,2); else if(del<-fMinHalfThick)d2+=pow(del+fMinHalfThick,2); } return sqrt(d2); } G4double SNORopeLoop::DistanceToOut(const G4ThreeVector &p)const { G4ThreeVector relpos=p-fOrigin; G4ThreeVector local(relpos*fXaxis, relpos*fYaxis, relpos*fZaxis); double d; if(local.y()>0)d=fMaxHalfThick-local.y(); else d=local.y()+fMaxHalfThick; double del=sqrt(local.x()*local.x()+local.z()*local.z())-fLoopRadius; if(del>0)del=fMinHalfThick-del; else del+=fMinHalfThick; if(d1)t=acos(1); if(tdmax)dmax=t; } return (dminfGrooveInnerRadius/fOuterAVradius); // dmin/dmax are angles }