#include <UgliStripNode.h>
Public Member Functions | |
virtual | ~UgliStripNode () |
virtual PlexStripEndId | GetSEId () const |
virtual Float_t | GetHalfLength () const |
virtual Float_t | GetHalfThickness () const |
virtual Float_t | GetHalfWidth () const |
virtual Float_t | GetTPos (Float_t orthCoord=9999.) const |
virtual Float_t | PartialLength (const StripEnd::StripEnd_t end) const |
virtual Bool_t | IsMirrored (const StripEnd::StripEnd_t end) const |
virtual Float_t | WlsPigtail (const StripEnd::StripEnd_t end) const |
virtual Float_t | WlsBypass () const |
virtual Float_t | ClearFiber (const StripEnd::StripEnd_t end) const |
virtual Float_t | TotalAttenuation (const StripEnd::StripEnd_t end, const Float_t alongLength) const |
virtual TVector3 | GlobalPos (const Float_t alongLength, const Bool_t onWLS=false) const |
virtual TVector3 | GlobalToLocal (const TVector3 &global) const |
virtual TVector3 | LocalToGlobal (const TVector3 &local) const |
virtual Float_t | DistanceAlong (const PlexStripEndId &orthogonalStrip) const |
virtual TVector3 | Intersection (const PlexStripEndId &orthogonalStrip) const |
virtual UgliGeometry * | GetUgliGeometry () const |
UgliScintMdlNode * | GetScintMdlNode (void) const |
Float_t | GetZRotRelMdlRad () const |
Float_t | GetLPosRelMdl () const |
Float_t | GetTPosRelMdl () const |
void | SetZRotRelMdlRad (Float_t radians) |
void | SetLTPosRelMdl (Float_t lpos, Float_t tpos) |
UgliStripNode () | |
Protected Member Functions | |
virtual void | IncrementRef () |
virtual void | DecrementRef () |
UgliStripNode (const PlexStripEndId seid, UgliScintMdlNode *mdl_node, const UgliDbiTables &ugliTables) | |
UgliStripShape * | GetUgliStripShape () const |
Protected Attributes | |
UgliGeometry * | fUgliGeometry |
PlexStripEndId | fSEId |
UInt_t | fMirrorMask |
Private Member Functions | |
VldContext | BackConstructVldContext () const |
UgliStripNode (const UgliStripNode &that) | |
UgliStripNode & | operator= (const UgliStripNode &ugh) |
Friends | |
class | UgliGeometry |
class | UgliScintPlnNode |
class | UgliStripHandle |
Definition at line 27 of file UgliStripNode.h.
UgliStripNode::~UgliStripNode | ( | ) | [virtual] |
Definition at line 98 of file UgliStripNode.cxx.
References UgliRefCnt::CountRef(), Msg::kWarning, and MSG.
00099 { 00100 // destructor should delete any owned objects 00101 if (CountRef()) { 00102 MSG("Ugli",Msg::kWarning) 00103 << "~UgliStripNode still had " << CountRef() 00104 << " outstanding references " << endl; 00105 } 00106 }
UgliStripNode::UgliStripNode | ( | ) |
Definition at line 91 of file UgliStripNode.cxx.
00092 : fUgliGeometry(0) 00093 { 00094 // Default constructor (for i/o) 00095 }
UgliStripNode::UgliStripNode | ( | const PlexStripEndId | seid, | |
UgliScintMdlNode * | mdl_node, | |||
const UgliDbiTables & | ugliTables | |||
) | [protected] |
Definition at line 109 of file UgliStripNode.cxx.
References PlexStripEndId::AsString(), fMirrorMask, UgliDbiTables::fStripStructTbl, fUgliGeometry, UgliDbiTables::GetDbiScintMdlById(), UgliDbiTables::GetDbiStripById(), PlexPlaneId::GetDetector(), UgliDbiStripStruct::GetInModule(), UgliDbiStrip::GetLPosRelMdl(), UgliDbiScintMdl::GetModule(), Nav::GetName(), DbiResultPtr< T >::GetRowByIndex(), UgliDbiScintMdl::GetScintMdlId(), UgliGeometry::GetShape(), UgliDbiStrip::GetTPosRelMdl(), UgliDbiScintMdl::GetTPosRelPln(), UgliDbiStrip::GetZRotRelMdlRad(), UgliDbiScintMdl::GetZRotRelPlnDeg(), PlexStripEndId::IsValid(), StripEnd::kEast, Msg::kError, Msg::kInfo, Detector::kNear, Msg::kWarning, MSG, SetLTPosRelMdl(), TNodeX::SetParent(), and SetZRotRelMdlRad().
00112 : TNodeX(seid.AsString("c"),seid.AsString("c"),noshapeName), //note below 00113 fUgliGeometry(mdlnode->GetUgliGeometry()), fSEId(seid) 00114 { 00115 // DBI driven ctor under UgliScintMdlNodes 00116 00117 SetParent(mdlnode); 00118 00119 fMirrorMask = 0; 00120 if (seid.GetDetector() == Detector::kNear) 00121 fMirrorMask = StripEnd::kEast; 00122 00123 // NOTE: we set the shape name here because seid.AsString 00124 // uses a static space such that having both "s" and "c" 00125 // options on the initialization line means we only see one 00126 // of the two possibilities 00127 fShape = fUgliGeometry->GetShape(seid.AsString("s")); 00128 00129 UgliStripShape* sshape = dynamic_cast<UgliStripShape*>(fShape); 00130 if (!sshape) { 00131 gGeometry->ls("s"); 00132 const char* name = "(nil)"; 00133 if (fShape) name = fShape->GetName(); 00134 MSG("Ugli",Msg::kWarning) 00135 << "ctor for " << seid.AsString("c") 00136 << "(" << GetName() << "," << GetTitle() << ")" 00137 << endl 00138 << " found shape wasn't the UgliStripShape " 00139 << seid.AsString("s") 00140 << " instead was named " << name << endl; 00141 } 00142 00143 unsigned int stripstruct_indx = UgliDbiStructHash(seid).HashAsStrip(); 00144 const UgliDbiStripStruct *stripStructRow = 00145 ugliTables.fStripStructTbl.GetRowByIndex(stripstruct_indx); 00146 int inmdl = stripStructRow->GetInModule(); 00147 00148 // for now some module level info lives at this level 00149 // since we don't have modules to ask 00150 const UgliDbiScintMdl *mdlRow = 00151 ugliTables.GetDbiScintMdlById(PlexScintMdlId(seid,inmdl)); 00152 if (!mdlRow) { 00153 MSG("Ugli",Msg::kError) 00154 << "UgliStripNode ctor failed to get UgliDbiScintMdl" 00155 << PlexScintMdlId(seid,inmdl) 00156 << endl; 00157 return; 00158 } 00159 00160 const UgliDbiStrip *stripRow = ugliTables.GetDbiStripById(seid); 00161 if (!stripRow) { 00162 MSG("Ugli",Msg::kError) 00163 << "UgliStripNode ctor failed to get UgliDbiStrip" 00164 << seid 00165 << endl; 00166 return; 00167 } 00168 // for now we're positioning ourselves in the plane 00169 // as there are no modules 00170 if (mdlRow->GetZRotRelPlnDeg() != 0) { 00171 MSG("Ugli",Msg::kWarning) 00172 << " module " << mdlRow->GetScintMdlId() 00173 << ", " << mdlRow->GetModule() 00174 << " has rotation of " << mdlRow->GetZRotRelPlnDeg() 00175 << " degrees, but we're not placing strip in module" << endl 00176 << " rotation is effectively ignored" << endl; 00177 } 00178 Float_t tpos = stripRow->GetTPosRelMdl(); 00179 Float_t lpos = stripRow->GetLPosRelMdl(); 00180 00181 SetLTPosRelMdl(lpos,tpos); 00182 00183 if (!seid.IsValid()) { 00184 static int nmsg = 20; 00185 if (nmsg) { 00186 MSG("Ugli",Msg::kInfo) 00187 << "UgliStripNode::ctor: " 00188 << seid.AsString("c") << " @ " 00189 << " tpos " << tpos << " = " 00190 << mdlRow->GetTPosRelPln() << " + " << stripRow->GetTPosRelMdl() 00191 << endl 00192 << " not a valid strip: " 00193 << " seid.IsValid() " << (int)seid.IsValid() 00194 // << ", encoded 0x" << hex << seid.GetEncoded() << dec 00195 // << ", masked out plane 0x" << hex << (seid.GetEncoded()&maskPlexIdPlane) << dec 00196 // << ", !=mask is " << hex << (int)((seid.GetEncoded()&maskPlexIdPlane)!=maskPlexIdPlane) << dec 00197 << endl; 00198 nmsg--; 00199 if (nmsg==0) { 00200 MSG("Ugli",Msg::kInfo) << " ... last message of this type." << endl; 00201 } 00202 } 00203 } 00204 00205 Float_t zrot = stripRow->GetZRotRelMdlRad(); 00206 SetZRotRelMdlRad(zrot); 00207 00208 SetLineColor(18); // a nice light gray 00209 SetVisibility(0); // visible 00210 // if (seid.GetStrip()%8 != 0) SetVisibility(0); 00211 00212 }
UgliStripNode::UgliStripNode | ( | const UgliStripNode & | that | ) | [private] |
VldContext UgliStripNode::BackConstructVldContext | ( | ) | const [private] |
Definition at line 806 of file UgliStripNode.cxx.
References det, fUgliGeometry, VldRange::GetDetectorMask(), VldRange::GetSimMask(), VldRange::GetTimeStart(), and UgliGeometry::GetVldRange().
Referenced by ClearFiber(), PartialLength(), WlsBypass(), and WlsPigtail().
00807 { 00808 // build a fake VldContext from the VldRange 00809 // so we can access the DBI 00810 00811 VldRange vrng = fUgliGeometry->GetVldRange(); 00812 int det = vrng.GetDetectorMask(); 00813 int sim = vrng.GetSimMask(); 00814 // trim "det" and "sim" down to single bit 00815 for (int i=0; i<32; ++i) { 00816 int bit = 1<<i; 00817 if (det&bit) det=bit; 00818 if (sim&bit) sim=bit; 00819 } 00820 00821 return VldContext((Detector::Detector_t)det, 00822 (SimFlag::SimFlag_t)sim, 00823 vrng.GetTimeStart()); 00824 00825 }
Float_t UgliStripNode::ClearFiber | ( | const StripEnd::StripEnd_t | end | ) | const [virtual] |
Implements UgliStripABC.
Definition at line 749 of file UgliStripNode.cxx.
References PlexStripEndId::AsString(), BackConstructVldContext(), REROOT_CellPos::ClearFiberA(), REROOT_CellPos::ClearFiberB(), Munits::cm, fSEId, fUgliGeometry, RerootExodus::GetCellPos(), UgliScintMdlNode::GetClearFiber(), UgliDbiScintMdl::GetClearLenEast(), UgliDbiScintMdl::GetClearLenWest(), UgliDbiStripStruct::GetInModule(), PlexPlaneId::GetPlaneView(), DbiResultPtr< T >::GetRowByIndex(), VldRange::GetSimMask(), UgliGeometry::GetVldRange(), UgliDbiScintMdl::HashToIndex(), StripEnd::kEast, SimFlag::kReroot, Msg::kWarning, StripEnd::kWest, and MSG.
Referenced by UgliStripHandle::ClearFiber().
00750 { 00751 00752 UgliScintMdlNode* mdl = dynamic_cast<UgliScintMdlNode*>(fParent); 00753 00754 if (mdl) return mdl->GetClearFiber(end); 00755 00756 MSG("Ugli",Msg::kWarning) << "ClearFiber() " << endl 00757 << " parent isn't a UgliScintMdlNode" << endl; 00758 00759 // fake up a context from the range 00760 VldContext vldc = BackConstructVldContext(); 00761 00762 DbiResultPtr<UgliDbiStripStruct> stripStructTbl(vldc); 00763 unsigned int stripstruct_indx = UgliDbiStructHash(fSEId).HashAsStrip(); 00764 const UgliDbiStripStruct *stripStructRow = 00765 stripStructTbl.GetRowByIndex(stripstruct_indx); 00766 int inmdl = stripStructRow->GetInModule(); 00767 00768 DbiResultPtr<UgliDbiScintMdl> mdlTbl(vldc); 00769 int mdl_indx = UgliDbiScintMdl::HashToIndex(PlexScintMdlId(fSEId,inmdl)); 00770 const UgliDbiScintMdl *mdlRow = mdlTbl.GetRowByIndex(mdl_indx); 00771 00772 if (mdlRow) { 00773 switch (end) { 00774 case StripEnd::kEast: return mdlRow->GetClearLenEast(); break; 00775 case StripEnd::kWest: return mdlRow->GetClearLenWest(); break; 00776 default: return huge_length; 00777 } 00778 } 00779 #ifdef UGLI_USE_EXODUS 00780 else if (fUgliGeometry->GetVldRange().GetSimMask() & SimFlag::kReroot) { 00781 00782 REROOT_CellPos *cellpos = RerootExodus::GetCellPos(fSEId); 00783 if (!cellpos) { 00784 MSG("Ugli",Msg::kWarning) 00785 << "No CellPos for " << fSEId.AsString() << endl; 00786 return huge_length; 00787 } 00788 00789 Float_t fClearFiber[3]; 00790 fClearFiber[0] = cellpos->ClearFiberA() * Munits::cm; 00791 fClearFiber[1] = cellpos->ClearFiberB() * Munits::cm; 00792 fClearFiber[2] = huge_length; 00793 PlaneView::PlaneView_t view = fSEId.GetPlaneView(); 00794 00795 return fClearFiber[isABside(view,end)]; 00796 00797 } 00798 #endif 00799 MSG("Ugli",Msg::kWarning) 00800 << " ClearFiber() missing info: MdlRow " << mdlRow << endl; 00801 return huge_length; 00802 00803 }
void UgliStripNode::DecrementRef | ( | ) | [protected, virtual] |
Reimplemented from UgliRefCnt.
Definition at line 260 of file UgliStripNode.cxx.
References UgliRefCnt::DecrementRef(), UgliRefCnt::fRef, and fUgliGeometry.
Referenced by UgliStripHandle::operator=(), and UgliStripHandle::~UgliStripHandle().
00261 { 00262 fRef--; 00263 fUgliGeometry->DecrementRef(); 00264 // cout << fSEId.AsString("c") << " -- ref to " << fRef 00265 // << ( (!fRef) ? " make invisible" : " " ) << endl; 00266 if (!fRef) SetVisibility(0); 00267 }
Float_t UgliStripNode::DistanceAlong | ( | const PlexStripEndId & | orthogonalStrip | ) | const [virtual] |
Implements UgliStripABC.
Definition at line 479 of file UgliStripNode.cxx.
References UgliGeometry::GetStripNode(), GetUgliGeometry(), GlobalPos(), Msg::kError, and MSG.
Referenced by UgliStripHandle::DistanceAlong().
00480 { 00481 // Get the distance along a strip represented by orthogonal strip. 00482 // Note this is relative to the strip's local co-ordinate system 00483 // origin (which for NearDet is not along the U or V axis), so 00484 // one can use it for attenuation corrections but not directly 00485 // for TPos position information. 00486 00487 // The closest approach ponts on the "s" and "t" lines are: 00488 // xyz_t(i) = base_t(i) + t*dir_t(i) for i=0..2 {x,y,z} 00489 // xyz_o(i) = base_o(i) + o*dir_o(i) for i=0..2 {x,y,z} 00490 // where base_x is LocalToGlobal(TVector3(0,0,0)) 00491 // and dir_x is (LocalToGlobal(TVector3(1,0,0))-base_x) 00492 // 00493 // Finding the intersection or closest appraoch of two skew lines 00494 // algorithm was adapted from: 00495 // Graphic Gems, ed. Andrew S. Glassner, pg 304 00496 // ISBN 0-12-286165-5 T385.G697(1990) 00497 // 00498 const Double_t farAway = 1.0e25; 00499 00500 UgliStripNode* otherNode = GetUgliGeometry()->GetStripNode(orthogonalStrip); 00501 00502 if ( ! otherNode ) { 00503 MSG("Ugli",Msg::kError) 00504 << "UgliStripNode::DistanceAlong(), other strip " 00505 << orthogonalStrip << " does not exist" << endl; 00506 return farAway; 00507 } 00508 00509 // s=this, t=other 00510 TVector3 baseThis = this->GlobalPos(0.,false); 00511 TVector3 dirThis = this->GlobalPos(1.,false) - baseThis; 00512 00513 TVector3 baseOther = otherNode->GlobalPos(0.,false); 00514 TVector3 dirOther = otherNode->GlobalPos(1.,false) - baseOther; 00515 00516 TVector3 dirCross = dirThis.Cross(dirOther); 00517 Double_t vxvm2 = dirCross.Mag2(); 00518 if (0.0 == vxvm2) { 00519 // exactly parallel strips! 00520 return farAway; 00521 } 00522 00523 TVector3 dp = baseOther - baseThis; 00524 TVector3 dpxv = dp.Cross(dirOther); 00525 Double_t s = dpxv.Dot(dirCross) / vxvm2; 00526 00527 return s; 00528 }
Float_t UgliStripNode::GetHalfLength | ( | ) | const [virtual] |
Implements UgliStripABC.
Definition at line 270 of file UgliStripNode.cxx.
Referenced by UgliStripHandle::GetHalfLength().
Float_t UgliStripNode::GetHalfThickness | ( | ) | const [virtual] |
Implements UgliStripABC.
Definition at line 278 of file UgliStripNode.cxx.
Referenced by UgliStripHandle::GetHalfThickness().
Float_t UgliStripNode::GetHalfWidth | ( | ) | const [virtual] |
Implements UgliStripABC.
Definition at line 286 of file UgliStripNode.cxx.
Referenced by UgliStripHandle::GetHalfWidth().
Float_t UgliStripNode::GetLPosRelMdl | ( | ) | const [inline] |
Definition at line 131 of file UgliStripNode.h.
Referenced by UgliStripHandle::GetLPosRelMdl().
UgliScintMdlNode * UgliStripNode::GetScintMdlNode | ( | void | ) | const |
Definition at line 831 of file UgliStripNode.cxx.
Referenced by UgliStripHandle::GetScintMdlHandle(), UgliStripHandle::GetScintPlnHandle(), and GetTPos().
00832 { return dynamic_cast<UgliScintMdlNode*>(fParent); }
PlexStripEndId UgliStripNode::GetSEId | ( | ) | const [inline, virtual] |
Implements UgliStripABC.
Definition at line 120 of file UgliStripNode.h.
References fSEId.
Referenced by UgliStripHandle::GetSEId().
00120 { return fSEId; }
Float_t UgliStripNode::GetTPos | ( | Float_t | orthCoord = 9999. |
) | const [virtual] |
Implements UgliStripABC.
Definition at line 293 of file UgliStripNode.cxx.
References bfld::AsString(), fSEId, PlexPlaneId::GetDetector(), PlexPlaneId::GetPlaneView(), GetScintMdlNode(), UgliScintMdlNode::GetScintPlnNode(), UgliPlnNode::GetZ0(), GlobalPos(), PlaneView::kA, PlaneView::kB, Detector::kCalib, Msg::kError, PlaneView::kU, PlaneView::kV, PlaneView::kVSTopEastSlant, PlaneView::kVSTopFlat, PlaneView::kVSTopWestSlant, PlaneView::kVSWallEastSlant, PlaneView::kVSWallOnEdge, PlaneView::kVSWallWestSlant, Msg::kWarning, PlaneView::kX, PlaneView::kY, and MSG.
Referenced by UgliStripHandle::GetTPos().
00294 { 00295 // get the strip's tpos offset 00296 // orthCoord is the position in the orthogonal view, this allows one to 00297 // include rotation corrections. 00298 // if orthCoord>1000 use the center of the strip 00299 00300 PlaneView::PlaneView_t view = fSEId.GetPlaneView(); 00301 bool viewIsUV = PlaneView::kU==view || PlaneView::kV==view; 00302 Detector::Detector_t detector = fSEId.GetDetector(); 00303 00304 const Double_t rsqrt2 = 1.0/TMath::Sqrt(2.); 00305 const TVector3 dir_x(1.,0.,0.); 00306 const TVector3 dir_y(0.,1.,0.); 00307 const TVector3 dir_u(rsqrt2,rsqrt2,0.); 00308 const TVector3 dir_v(-rsqrt2,rsqrt2,0.); 00309 const TVector3 dir_u_caldet(1.,0.,0.); 00310 const TVector3 dir_v_caldet(0.,1.,0.); 00311 const TVector3 dir_a(0.,0.,1.); 00312 const TVector3 dir_b(1.,0.,0.); 00313 00314 TVector3 dir_tpos, dir_orthCoord; 00315 00316 switch (view) { 00317 case PlaneView::kX: 00318 dir_tpos = dir_x; dir_orthCoord = dir_y; 00319 break; 00320 case PlaneView::kY: 00321 dir_tpos = dir_y; dir_orthCoord = dir_x; 00322 break; 00323 case PlaneView::kU: 00324 if (Detector::kCalib != detector) { 00325 dir_tpos = dir_u; dir_orthCoord = dir_v; 00326 } else { 00327 dir_tpos = dir_u_caldet; dir_orthCoord = dir_v_caldet; 00328 } 00329 break; 00330 case PlaneView::kV: 00331 if (Detector::kCalib != detector) { 00332 dir_tpos = dir_v; dir_orthCoord = dir_u; 00333 } else { 00334 dir_tpos = dir_v_caldet; dir_orthCoord = dir_u_caldet; 00335 } 00336 break; 00337 case PlaneView::kA: 00338 dir_tpos = dir_a; 00339 break; 00340 case PlaneView::kB: 00341 dir_tpos = dir_b; 00342 break; 00343 case PlaneView::kVSTopFlat: 00344 case PlaneView::kVSTopEastSlant: 00345 case PlaneView::kVSTopWestSlant: 00346 case PlaneView::kVSWallOnEdge: 00347 case PlaneView::kVSWallEastSlant: 00348 case PlaneView::kVSWallWestSlant: 00349 MSG("Ugli",Msg::kError) 00350 << "UgliStripNode::GetTPos() not meaningful for veto shield strips " 00351 << fSEId << endl; 00352 return huge_length; 00353 break; 00354 default: 00355 MSG("Ugli",Msg::kWarning) 00356 << "UgliStripNode::GetTPos unknown view " 00357 << PlaneView::AsString(fSEId.GetPlaneView()) 00358 << " in " << fSEId 00359 << endl; 00360 return huge_length; 00361 } 00362 00363 //cout << " " << fSEId.AsString("c"); 00364 00365 Float_t alongLength = 0.0; // for wild orthCoord choose *strip* center 00366 if (orthCoord < 1000. && viewIsUV) { 00367 // orthCoord is sensible and we're a U or V plane 00368 // so we need to translate that orthogonal position 00369 // into a position along the strip in order to do rotation corrections 00370 00371 TVector3 gstrip_center = GlobalPos(0.,kFALSE); 00372 TVector3 gstrip_plusend = GlobalPos(1.,kFALSE); 00373 TVector3 gstrip_dir = gstrip_plusend - gstrip_center; 00374 00375 TVector3 tpos_base = orthCoord * dir_orthCoord; 00376 Double_t z = this->GetScintMdlNode()->GetScintPlnNode()->GetZ0(); 00377 tpos_base.SetZ(z); 00378 00379 // aliases, just 'cause it's easier to translate the formula 00380 TVector3& base_s = gstrip_center; 00381 TVector3& dir_s = gstrip_dir; 00382 TVector3& base_t = tpos_base; 00383 TVector3& dir_t = dir_tpos; 00384 00385 TVector3 txs = dir_t.Cross(dir_s); 00386 TVector3 dpst = base_s - base_t; 00387 TVector3 dpxs = dpst.Cross(dir_s); 00388 Float_t t = dpxs.Dot(txs) / txs.Mag2(); 00389 00390 return t; 00391 00392 /* 00393 // the unnecessarily hard way ... 00394 TVector3 sxt = dir_s.Cross(dir_t); 00395 TVector3 dpts = base_t - base_s; 00396 TVector3 dpxt = dpts.Cross(dir_t); 00397 Float_t s = dpxt.Dot(sxt) / sxt.Mag2(); 00398 00399 alongLength = s; 00400 */ 00401 00402 } 00403 TVector3 globalpos = GlobalPos(alongLength,kFALSE); 00404 //return globalpos.Dot(dir_tpos); 00405 Float_t tpos = globalpos.Dot(dir_tpos); 00406 //cout << " return " << tpos << endl; 00407 return tpos; 00408 }
Float_t UgliStripNode::GetTPosRelMdl | ( | ) | const [inline] |
Definition at line 132 of file UgliStripNode.h.
Referenced by UgliStripHandle::GetTPosRelMdl().
virtual UgliGeometry* UgliStripNode::GetUgliGeometry | ( | ) | const [inline, virtual] |
Definition at line 65 of file UgliStripNode.h.
References fUgliGeometry.
Referenced by DistanceAlong(), Intersection(), and UgliStripHandle::IsFrozen().
00065 { return fUgliGeometry; }
UgliStripShape * UgliStripNode::GetUgliStripShape | ( | ) | const [inline, protected] |
Definition at line 117 of file UgliStripNode.h.
Referenced by PartialLength(), WlsBypass(), and WlsPigtail().
00118 { return dynamic_cast<UgliStripShape*>(fShape); }
Float_t UgliStripNode::GetZRotRelMdlRad | ( | ) | const [inline] |
Definition at line 128 of file UgliStripNode.h.
References Ugli::deg2rad.
Referenced by UgliStripHandle::GetZRotRelMdlRad().
00129 { return fMatrix->GetPhi()*Ugli::deg2rad; }
TVector3 UgliStripNode::GlobalPos | ( | const Float_t | alongLength, | |
const Bool_t | onWLS = false | |||
) | const [virtual] |
Definition at line 421 of file UgliStripNode.cxx.
References Msg::kFatal, LocalToGlobal(), and MSG.
Referenced by DistanceAlong(), GetTPos(), UgliStripHandle::GlobalPos(), and Intersection().
00423 { 00424 // get the position based on distance along centerline *or* WLS fiber 00425 // global position is assumed to be in XYZ (hall) coordinates 00426 00427 if (onWLS) { 00428 MSG("Ugli",Msg::kFatal) 00429 << "UgliStripNode::GlobalPos not yet implemented with onWLS=kTRUE" << endl; 00430 return LocalToGlobal(TVector3(alongLength,0.,0.)); 00431 } else { 00432 return LocalToGlobal(TVector3(alongLength,0.,0.)); 00433 } 00434 }
TVector3 UgliStripNode::GlobalToLocal | ( | const TVector3 & | global | ) | const [virtual] |
Definition at line 437 of file UgliStripNode.cxx.
Referenced by UgliStripHandle::GlobalToLocal().
00438 { 00439 // get the local position based on global position 00440 // global position is assumed to be in XYZ (hall) coordinates 00441 00442 Double_t gxyz[3], lxyz[3]; 00443 00444 gxyz[0] = global.X(); 00445 gxyz[1] = global.Y(); 00446 gxyz[2] = global.Z(); 00447 00448 // deal with fact that TNode::Master2Local isn't declared const 00449 UgliStripNode* self = const_cast<UgliStripNode*>(this); 00450 self->cd(); 00451 self->UpdateMatrix(); 00452 self->Master2Local(gxyz,lxyz); 00453 00454 return TVector3(lxyz[0],lxyz[1],lxyz[2]); 00455 }
void UgliStripNode::IncrementRef | ( | ) | [protected, virtual] |
Reimplemented from UgliRefCnt.
Definition at line 252 of file UgliStripNode.cxx.
References UgliRefCnt::fRef, fUgliGeometry, and UgliRefCnt::IncrementRef().
Referenced by UgliStripHandle::operator=(), and UgliStripHandle::UgliStripHandle().
00253 { 00254 fRef++; 00255 fUgliGeometry->IncrementRef(); 00256 // cout << fSEId.AsString("c") << " ++ ref to " << fRef << endl; 00257 SetVisibility(1); 00258 }
TVector3 UgliStripNode::Intersection | ( | const PlexStripEndId & | orthogonalStrip | ) | const [virtual] |
Implements UgliStripABC.
Definition at line 531 of file UgliStripNode.cxx.
References UgliGeometry::GetStripNode(), GetUgliGeometry(), GlobalPos(), Msg::kError, and MSG.
Referenced by UgliStripHandle::Intersection().
00532 { 00533 // get the 3-space "intersection" of two strips 00534 00535 // The closest approach ponts on the "s" and "t" lines are: 00536 // xyz_t(i) = base_t(i) + t*dir_t(i) for i=0..2 {x,y,z} 00537 // xyz_o(i) = base_o(i) + o*dir_o(i) for i=0..2 {x,y,z} 00538 // where base_x is LocalToGlobal(TVector3(0,0,0)) 00539 // and dir_x is (LocalToGlobal(TVector3(1,0,0))-base_x) 00540 // 00541 // Finding the intersection or closest appraoch of two skew lines 00542 // algorithm was adapted from: 00543 // Graphic Gems, ed. Andrew S. Glassner, pg 304 00544 // ISBN 0-12-286165-5 T385.G697(1990) 00545 // 00546 const Double_t farAway = 1.0e25; 00547 const TVector3 farAway3(farAway,farAway,farAway); 00548 00549 UgliStripNode* otherNode = GetUgliGeometry()->GetStripNode(orthogonalStrip); 00550 00551 if ( ! otherNode ) { 00552 MSG("Ugli",Msg::kError) 00553 << "UgliStripNode::Intersection() other strip " 00554 << orthogonalStrip << " does not exist" << endl; 00555 return farAway3; 00556 } 00557 00558 // s=this, t=other 00559 TVector3 baseThis = this->GlobalPos(0.,false); 00560 TVector3 dirThis = this->GlobalPos(1.,false) - baseThis; 00561 00562 TVector3 baseOther = otherNode->GlobalPos(0.,false); 00563 TVector3 dirOther = otherNode->GlobalPos(1.,false) - baseOther; 00564 00565 TVector3 dirCross = dirThis.Cross(dirOther); 00566 Double_t vxvm2 = dirCross.Mag2(); 00567 if (0.0 == vxvm2) { 00568 // Exactly parallel strips! 00569 return 0.5*(baseThis+baseOther) + farAway*dirThis; 00570 } 00571 00572 TVector3 dp = baseOther - baseThis; 00573 TVector3 dpxvThis = dp.Cross(dirOther); 00574 Double_t s = dpxvThis.Dot(dirCross) / vxvm2; 00575 00576 TVector3 thisPoint = baseThis + s*dirThis; 00577 00578 dirCross *= -1; 00579 dp *= -1; 00580 TVector3 dpxvOther = dp.Cross(dirThis); 00581 Double_t t = dpxvOther.Dot(dirCross) / vxvm2; 00582 00583 TVector3 otherPoint = baseOther + t*dirOther; 00584 00585 return 0.5*(thisPoint+otherPoint); 00586 }
Bool_t UgliStripNode::IsMirrored | ( | const StripEnd::StripEnd_t | end | ) | const [inline, virtual] |
Implements UgliStripABC.
Definition at line 122 of file UgliStripNode.h.
References fMirrorMask.
Referenced by UgliStripHandle::IsMirrored().
00123 { return ( fMirrorMask & end ); }
TVector3 UgliStripNode::LocalToGlobal | ( | const TVector3 & | local | ) | const [virtual] |
Definition at line 458 of file UgliStripNode.cxx.
Referenced by GlobalPos(), and UgliStripHandle::LocalToGlobal().
00459 { 00460 // get the global position based on local position 00461 // global position is assumed to be in XYZ (hall) coordinates 00462 00463 Double_t gxyz[3], lxyz[3]; 00464 00465 lxyz[0] = local.X(); 00466 lxyz[1] = local.Y(); 00467 lxyz[2] = local.Z(); 00468 00469 // deal with fact that TNode::Local2Master isn't declared const 00470 UgliStripNode* self = const_cast<UgliStripNode*>(this); 00471 self->cd(); 00472 self->UpdateMatrix(); 00473 self->Local2Master(lxyz,gxyz); 00474 00475 return TVector3(gxyz[0],gxyz[1],gxyz[2]); 00476 }
UgliStripNode& UgliStripNode::operator= | ( | const UgliStripNode & | ugh | ) | [private] |
Reimplemented from UgliStripABC.
Float_t UgliStripNode::PartialLength | ( | const StripEnd::StripEnd_t | end | ) | const [virtual] |
Definition at line 589 of file UgliStripNode.cxx.
References BackConstructVldContext(), fSEId, UgliDbiStripStruct::GetLenEastPart(), UgliStripShape::GetLenPart(), UgliDbiStripStruct::GetLenWestPart(), DbiResultPtr< T >::GetRowByIndex(), GetUgliStripShape(), StripEnd::kEast, StripEnd::kNegative, StripEnd::kPositive, Msg::kWarning, StripEnd::kWest, and MSG.
Referenced by UgliStripHandle::PartialLength().
00590 { 00591 // return the (total) length of one of the parts of a split strip 00592 // (if strip is not split return total length regardless of end) 00593 00594 // this is, to be proper, info of the strip shape 00595 UgliStripShape* strip_shape = GetUgliStripShape(); 00596 00597 if (strip_shape) { 00598 00599 switch (end) { 00600 case StripEnd::kNegative: 00601 case StripEnd::kPositive: 00602 return strip_shape->GetLenPart(end); 00603 break; 00604 default: return huge_length; 00605 } 00606 } 00607 00608 MSG("Ugli",Msg::kWarning) << "PartialLength() " << endl 00609 << " shape isn't a UgliStripShape" << endl; 00610 00611 // fake up a context from the range 00612 VldContext vldc = BackConstructVldContext(); 00613 00614 DbiResultPtr<UgliDbiStripStruct> stripStructTbl(vldc); 00615 unsigned int stripstruct_indx = UgliDbiStructHash(fSEId).HashAsStrip(); 00616 const UgliDbiStripStruct *stripStructRow = 00617 stripStructTbl.GetRowByIndex(stripstruct_indx); 00618 00619 if (stripStructRow) { 00620 switch (end) { 00621 case StripEnd::kEast: 00622 return stripStructRow->GetLenEastPart(); 00623 break; 00624 case StripEnd::kWest: 00625 return stripStructRow->GetLenWestPart(); 00626 break; 00627 default: return huge_length; 00628 } 00629 } 00630 00631 MSG("Ugli",Msg::kWarning) 00632 << " PartialLength() missing UgliDbiStripStruct" << endl; 00633 return huge_length; 00634 00635 }
void UgliStripNode::SetLTPosRelMdl | ( | Float_t | lpos, | |
Float_t | tpos | |||
) | [inline] |
Definition at line 125 of file UgliStripNode.h.
Referenced by UgliStripHandle::SetLTPosRelMdl(), and UgliStripNode().
void UgliStripNode::SetZRotRelMdlRad | ( | Float_t | radians | ) |
Definition at line 215 of file UgliStripNode.cxx.
References fUgliGeometry, UgliGeometry::GetRotMatrix(), Msg::kDebug, MSG, and Ugli::rad2deg.
Referenced by UgliStripHandle::SetZRotRelMdlRad(), and UgliStripNode().
00216 { 00217 // set the rotation matrix for this strip 00218 // limit ourselves to -xx.x mrad 00219 00220 // build the rotation matrices as we need them so we can share 00221 // if we expect a range of +/- 4cm at the furthest extreme of the far 00222 // theta = asin(4cm/400cm) ~ .01 rad = 10mrad 00223 // if we limit ourself to +/- 0.1 mrad then the smallest non-zero 00224 // deviation is .04cm which should be sufficient 00225 const float rad2mrad = 1000.; 00226 const float mrad2rad = 0.001; 00227 00228 const char* rname = "Identity"; 00229 char rname_mrad[16]; 00230 if (radians != 0) { 00231 sprintf(rname_mrad,"%+5.1fmrad",radians*rad2mrad); 00232 rname = rname_mrad; 00233 } 00234 TRotMatrix* rotm = fUgliGeometry->GetRotMatrix(rname); 00235 if (!rotm) { 00236 Double_t zrot_trunc; 00237 sscanf(rname,"%5lf",&zrot_trunc); 00238 zrot_trunc *= Ugli::rad2deg * mrad2rad; 00239 MSG("Ugli",Msg::kDebug) 00240 << "UgliStripNode::SetZRotRelMdlRad no rotm '" 00241 << rname << "' zrot = " 00242 << zrot_trunc << " deg" << endl; 00243 Double_t deg90 = 90; 00244 rotm = new TRotMatrix(rname,rname,deg90,zrot_trunc,deg90, 00245 zrot_trunc+deg90,0,0); 00246 } 00247 fMatrix = rotm; 00248 }
Float_t UgliStripNode::TotalAttenuation | ( | const StripEnd::StripEnd_t | end, | |
const Float_t | alongLength | |||
) | const [virtual] |
Implements UgliStripABC.
Definition at line 411 of file UgliStripNode.cxx.
References Msg::kFatal, and MSG.
Referenced by UgliStripHandle::TotalAttenuation().
00413 { 00414 // get the attenuation from some point towards pixel at one end 00415 MSG("Ugli",Msg::kFatal) 00416 << "UgliStripNode::GetTotalAttenuation not yet implemented" << endl; 00417 return 0; 00418 }
Float_t UgliStripNode::WlsBypass | ( | ) | const [virtual] |
Definition at line 719 of file UgliStripNode.cxx.
References BackConstructVldContext(), fSEId, DbiResultPtr< T >::GetRowByIndex(), GetUgliStripShape(), UgliDbiStripStruct::GetWlsLenBypass(), UgliStripShape::GetWlsLenBypass(), Msg::kWarning, and MSG.
Referenced by UgliStripHandle::WlsBypass().
00720 { 00721 // return the length of the WLS of the central bypass 00722 00723 // this is, to be proper, info of the strip shape 00724 UgliStripShape* strip_shape = GetUgliStripShape(); 00725 00726 if (strip_shape) return strip_shape->GetWlsLenBypass(); 00727 00728 MSG("Ugli",Msg::kWarning) << "WlsBypass() " << endl 00729 << " shape isn't a UgliStripShape" << endl; 00730 00731 // fake up a context from the range 00732 VldContext vldc = BackConstructVldContext(); 00733 00734 DbiResultPtr<UgliDbiStripStruct> stripStructTbl(vldc); 00735 unsigned int stripstruct_indx = UgliDbiStructHash(fSEId).HashAsStrip(); 00736 const UgliDbiStripStruct *stripStructRow = 00737 stripStructTbl.GetRowByIndex(stripstruct_indx); 00738 00739 if (stripStructRow) return stripStructRow->GetWlsLenBypass(); 00740 00741 MSG("Ugli",Msg::kWarning) 00742 << " WlsBypass() missing UgliDbiStripStruct " << endl; 00743 00744 return 0.0; 00745 00746 }
Float_t UgliStripNode::WlsPigtail | ( | const StripEnd::StripEnd_t | end | ) | const [virtual] |
Implements UgliStripABC.
Definition at line 638 of file UgliStripNode.cxx.
References PlexStripEndId::AsString(), BackConstructVldContext(), Munits::cm, REROOT_CellPos::FiberTailA(), REROOT_CellPos::FiberTailB(), fSEId, fUgliGeometry, RerootExodus::GetCellPos(), UgliScintMdlNode::GetExtraWlsFiber(), UgliDbiStripStruct::GetInModule(), PlexPlaneId::GetPlaneView(), DbiResultPtr< T >::GetRowByIndex(), VldRange::GetSimMask(), GetUgliStripShape(), UgliGeometry::GetVldRange(), UgliStripShape::GetWls(), UgliDbiScintMdl::GetWlsLenEast(), UgliDbiStripStruct::GetWlsLenEast(), UgliDbiScintMdl::GetWlsLenWest(), UgliDbiStripStruct::GetWlsLenWest(), UgliDbiScintMdl::HashToIndex(), StripEnd::kEast, StripEnd::kNegative, StripEnd::kPositive, SimFlag::kReroot, Msg::kWarning, StripEnd::kWest, and MSG.
Referenced by UgliStripHandle::WlsPigtail().
00639 { 00640 // return the length of the WLS pigtail 00641 00642 // this is, to be proper, info of the strip shape 00643 UgliStripShape* strip_shape = GetUgliStripShape(); 00644 UgliScintMdlNode* mdl = dynamic_cast<UgliScintMdlNode*>(fParent); 00645 00646 if (strip_shape && mdl) { 00647 00648 switch (end) { 00649 case StripEnd::kNegative: 00650 case StripEnd::kPositive: 00651 return 00652 strip_shape->GetWls(end) + 00653 mdl->GetExtraWlsFiber(end); 00654 break; 00655 default: return huge_length; 00656 } 00657 } 00658 00659 MSG("Ugli",Msg::kWarning) << "WlsPigtail() " << endl 00660 << " shape isn't a UgliStripShape or parent isn't a UgliScintMdlNode" << endl; 00661 00662 // fake up a context from the range 00663 VldContext vldc = BackConstructVldContext(); 00664 00665 DbiResultPtr<UgliDbiStripStruct> stripStructTbl(vldc); 00666 unsigned int stripstruct_indx = UgliDbiStructHash(fSEId).HashAsStrip(); 00667 const UgliDbiStripStruct *stripStructRow = 00668 stripStructTbl.GetRowByIndex(stripstruct_indx); 00669 int inmdl = stripStructRow->GetInModule(); 00670 00671 DbiResultPtr<UgliDbiScintMdl> mdlTbl(vldc); 00672 int mdl_indx = UgliDbiScintMdl::HashToIndex(PlexScintMdlId(fSEId,inmdl)); 00673 const UgliDbiScintMdl *mdlRow = mdlTbl.GetRowByIndex(mdl_indx); 00674 00675 if (stripStructRow && mdlRow) { 00676 switch (end) { 00677 case StripEnd::kEast: 00678 return 00679 stripStructRow->GetWlsLenEast() + 00680 mdlRow->GetWlsLenEast(); 00681 break; 00682 case StripEnd::kWest: 00683 return 00684 stripStructRow->GetWlsLenWest() + 00685 mdlRow->GetWlsLenWest(); 00686 break; 00687 default: return huge_length; 00688 } 00689 } 00690 #ifdef UGLI_USE_EXODUS 00691 else if (fUgliGeometry->GetVldRange().GetSimMask() & SimFlag::kReroot) { 00692 00693 REROOT_CellPos *cellpos = RerootExodus::GetCellPos(fSEId); 00694 if (!cellpos) { 00695 MSG("Ugli",Msg::kWarning) 00696 << "No CellPos for " << fSEId.AsString() << endl; 00697 return huge_length; 00698 } 00699 00700 Float_t fWlsPigtail[3]; 00701 fWlsPigtail[0] = cellpos->FiberTailA() * Munits::cm; 00702 fWlsPigtail[1] = cellpos->FiberTailB() * Munits::cm; 00703 fWlsPigtail[2] = huge_length; 00704 PlaneView::PlaneView_t view = fSEId.GetPlaneView(); 00705 00706 return fWlsPigtail[isABside(view,end)]; 00707 00708 } 00709 #endif 00710 MSG("Ugli",Msg::kWarning) 00711 << " WlsPigtail() missing info: " << endl 00712 << " stripStructRow " << stripStructRow 00713 << " MdlRow " << mdlRow << endl; 00714 return huge_length; 00715 00716 }
friend class UgliGeometry [friend] |
Definition at line 29 of file UgliStripNode.h.
friend class UgliScintPlnNode [friend] |
Definition at line 30 of file UgliStripNode.h.
friend class UgliStripHandle [friend] |
Definition at line 31 of file UgliStripNode.h.
UInt_t UgliStripNode::fMirrorMask [protected] |
Definition at line 98 of file UgliStripNode.h.
Referenced by IsMirrored(), and UgliStripNode().
PlexStripEndId UgliStripNode::fSEId [protected] |
Definition at line 97 of file UgliStripNode.h.
Referenced by ClearFiber(), GetSEId(), GetTPos(), PartialLength(), WlsBypass(), and WlsPigtail().
UgliGeometry* UgliStripNode::fUgliGeometry [protected] |
Definition at line 96 of file UgliStripNode.h.
Referenced by BackConstructVldContext(), ClearFiber(), DecrementRef(), GetUgliGeometry(), IncrementRef(), SetZRotRelMdlRad(), UgliStripNode(), and WlsPigtail().