UgliSteelPlnNode Class Reference

#include <UgliSteelPlnNode.h>

Inheritance diagram for UgliSteelPlnNode:
UgliSteelPlnABC UgliPlnNode UgliPlnABC UgliRefCnt TNodeX

List of all members.

Public Member Functions

virtual ~UgliSteelPlnNode ()
virtual PlexPlaneId GetPlexPlaneId () const
virtual Float_t GetHalfThickness () const
virtual TVector3 GetCenter () const
virtual Float_t GetX0 () const
virtual Float_t GetY0 () const
virtual Float_t GetZ0 () const
virtual TVector3 GlobalToLocal (const TVector3 &global) const
virtual TVector3 LocalToGlobal (const TVector3 &local) const
virtual TVector3 GlobalToLocalVect (const TVector3 &global) const
virtual TVector3 LocalToGlobalVect (const TVector3 &local) const
virtual UgliGeometryGetUgliGeometry () const
 UgliSteelPlnNode ()

Protected Member Functions

virtual void IncrementRef ()
virtual void DecrementRef ()
 UgliSteelPlnNode (UgliGeometry *ugligeom, const PlexPlaneId planeid)
 UgliSteelPlnNode (const PlexPlaneId planeid, UgliGeometry *ugligeom, const UgliDbiTables &ugliTables)
void TransformLocal2Global (Double_t *lxyz, Double_t *gxyz) const

Private Member Functions

 UgliSteelPlnNode (const UgliSteelPlnNode &that)
UgliSteelPlnNodeoperator= (const UgliSteelPlnNode &ugh)

Friends

class UgliGeometry
class UgliGeometryReroot
class UgliSteelPlnHandle

Detailed Description

Definition at line 21 of file UgliSteelPlnNode.h.


Constructor & Destructor Documentation

UgliSteelPlnNode::~UgliSteelPlnNode (  )  [virtual]

Definition at line 43 of file UgliSteelPlnNode.cxx.

References UgliRefCnt::CountRef(), GetPlexPlaneId(), Msg::kWarning, and MSG.

00044 {
00045    // destructor should delete any owned objects
00046 #ifdef DUPLICATE_WARNING
00047    // this check is done in the base ~UgliPlnNode()
00048    if (CountRef()) {
00049       MSG("Ugli",Msg::kWarning)
00050         << "~UgliSteelPlnNode " << GetPlexPlaneId()
00051         << " still had " << CountRef()
00052         << " outstanding references " << endl;
00053    }
00054 #endif
00055 }

UgliSteelPlnNode::UgliSteelPlnNode (  ) 

Definition at line 36 of file UgliSteelPlnNode.cxx.

00037   : UgliPlnNode()
00038 {
00039    // Default constructor (for i/o)
00040 }

UgliSteelPlnNode::UgliSteelPlnNode ( UgliGeometry ugligeom,
const PlexPlaneId  planeid 
) [protected]

Definition at line 58 of file UgliSteelPlnNode.cxx.

References PlexPlaneId::AsString(), Munits::cm, UgliPlnNode::fUgliGeometry, PlexPlaneId::GetDetector(), MinosOutline::GetGlobalXOffset(), VldRange::GetSimMask(), UgliGeometry::GetTGeometryX(), UgliGeometry::GetVldRange(), PlexPlaneId::IsSteel(), Detector::kCalib, Msg::kDebug, Detector::kFar, Msg::kInfo, Detector::kNear, SimFlag::kReroot, Msg::kWarning, MSG, RerootExodus::RerootPlaneXYZ0(), and TNodeX::SetParent().

00060    : UgliPlnNode(ugliGeometry,planeid)
00061 {
00062    // ctor that old REROOT-basaed UgliGeometry uses in constructing
00063 
00064    static Int_t nwarn = 2;
00065 
00066    if (nwarn > 0 ) {
00067       MSG("Ugli",Msg::kInfo) 
00068          << "UgliSteelPlnNode::ctor " 
00069          << "    " << planeid.AsString("p") 
00070          << "... needs DBI interface" << endl;
00071       nwarn--;
00072    }
00073 
00074    TGeometryX* fRootGeom = fUgliGeometry->GetTGeometryX();
00075 
00076    // assign the correct shape to this node
00077    // build an appropriate shape if necessary
00078    const char *shapename = "nshape";
00079    bool hasEars = true;
00080    if (!planeid.IsSteel()) {
00081       // this shouldn't be ...
00082       MSG("Ugli",Msg::kWarning) 
00083          << "UgliSteelPlnNode::ctor saw Scint PlaneId "
00084          << planeid.AsString() << endl;
00085    }
00086    switch (planeid.GetDetector()) {
00087    case Detector::kFar:
00088       shapename = "FarSteel";
00089       break;
00090    case Detector::kNear:
00091       shapename = "NearSteel";
00092       break;
00093    case Detector::kCalib:
00094       shapename = "CalDetSteel";
00095       break;
00096    default:
00097       shapename = "noshape";
00098       break;
00099    }
00100 
00101    MinosOutline* the_shape =
00102       dynamic_cast<MinosOutline*>(fRootGeom->GetShape(shapename));
00103    if ( ! the_shape ) {
00104       MSG("Ugli",Msg::kInfo)
00105          << "UgliSteelPlnNode ctor creating shape " << shapename << endl;
00106       Float_t halfthick  = 0.5 * 2.54 * Munits::cm;
00107 
00108       if (nwarn > 0 ) {
00109          MSG("Ugli",Msg::kDebug) 
00110             << "UgliSteelPlnNode::ctor kludge plane thickness" << endl;
00111          nwarn--;
00112       }
00113 
00114       the_shape = new MinosOutline(shapename,shapename,"void",
00115                                    planeid,hasEars,halfthick,1.);
00116    }
00117    fShape = the_shape;  // assign TNode member the correct shape
00118 
00119    // position and orient the shape correctly
00120    TNode* hallnode = fRootGeom->GetNode("hall");
00121    hallnode->cd();
00122    hallnode->UpdateMatrix();
00123 
00124    SetParent(hallnode);
00125 
00126    Float_t global[3], local[3];
00127    if (fUgliGeometry->GetVldRange().GetSimMask() & SimFlag::kReroot) {
00128 #ifdef UGLI_USE_EXODUS
00129       RerootExodus::RerootPlaneXYZ0(planeid,global);
00130       global[0] *= Munits::cm;
00131       global[1] *= Munits::cm;
00132       global[2] *= Munits::cm;
00133 #else
00134       static int nmsg = 5;
00135       if (nmsg-- > 0) {
00136          MSG("Ugli",Msg::kWarning) 
00137             << " steelpln positioning code must go here" << endl;
00138       }
00139       assert(0);
00140 #endif
00141    }
00142 
00143    Float_t x0shift = the_shape->GetGlobalXOffset() * Munits::cm;
00144 
00145    hallnode->Master2Local(global,local);
00146    
00147    SetPosition(local[0]+x0shift,local[1],local[2]);
00148 
00149    SetVisibility(0);
00150 }

UgliSteelPlnNode::UgliSteelPlnNode ( const PlexPlaneId  planeid,
UgliGeometry ugligeom,
const UgliDbiTables ugliTables 
) [protected]

Definition at line 153 of file UgliSteelPlnNode.cxx.

References PlexPlaneId::AsString(), UgliPlnNode::fUgliGeometry, UgliDbiTables::GetDbiSteelPlnByIndex(), UgliDbiSteelPln::GetPhiDeg(), PlexPlaneId::GetPlane(), UgliGeometry::GetTGeometryX(), UgliDbiSteelPln::GetThetaDeg(), UgliDbiSteelPln::GetThickness(), UgliGeometry::GetTNodeX(), UgliDbiSteelPln::GetTotalZ(), UgliDbiSteelPln::GetX0(), UgliDbiSteelPln::GetY0(), UgliDbiSteelPln::GetZBack(), PlexPlaneId::IsVetoShield(), Msg::kError, Msg::kVerbose, Msg::kWarning, LocalToGlobal(), MSG, TNodeX::SetParent(), and TNodeX::TNodeX().

00156    : UgliPlnNode(ugliGeometry,planeid)
00157 {
00158    // ctor for DBI driven UgliGeometry
00159 
00160    // expand the x-y size of the enclosing box 
00161    // just so we can see which is which
00162    // changing scale mucks up the global x shift
00163    Float_t xyscale_box = 1.0;
00164    Float_t xyscale_stl = 1.0;
00165    // set this ~100 to expand z coordinate
00166    Float_t bombz = 1.; // 100.;
00167    
00168    bool hasEars = true;
00169 
00170    //
00171    // build the enclosing box of steel (+ scint)
00172    //
00173    char boxname[16], stlname[16];
00174    sprintf(boxname,"%s",planeid.AsString("b"));  // dNNNBvc
00175    sprintf(stlname,"%s",planeid.AsString("p"));  // dNNNPvc
00176    if (planeid.IsVetoShield()) stlname[4] = 'P'; // force 'P'-ness
00177 
00178    UInt_t ipln = planeid.GetPlane();
00179    const UgliDbiSteelPln* steelRow = ugliTables.GetDbiSteelPlnByIndex(ipln);
00180    if (!steelRow) {
00181      MSG("Ugli",Msg::kError) 
00182        << " no UgliDbiSteelPln entry for " << planeid << endl;
00183      return;
00184    }
00185 
00186    Float_t dzbox = 0.5 * steelRow->GetTotalZ() *bombz; // box z half size
00187    MinosOutline *box_outline = 
00188       new MinosOutline(boxname,boxname,"void",planeid,hasEars,dzbox,xyscale_box);
00189 
00190    // additional shift due to near detector weirdness
00191 //no!   Float_t x0shift = xyscale_box * box_outline->GetGlobalXOffset();
00192 
00193    Float_t x0pln = steelRow->GetX0(); // no! +x0shift;
00194    Float_t y0pln = steelRow->GetY0();
00195    Float_t zback = steelRow->GetZBack();
00196    Float_t z0box = zback*bombz - dzbox;
00197          
00198    TRotMatrix *box_rotm =
00199       new TRotMatrix(boxname,boxname,
00200                   steelRow->GetThetaDeg(0),steelRow->GetPhiDeg(0),
00201                   steelRow->GetThetaDeg(1),steelRow->GetPhiDeg(1),
00202                   steelRow->GetThetaDeg(2),steelRow->GetPhiDeg(2));
00203 
00204    // the current working node should already be the hall
00205    TNode* hall_node = fUgliGeometry->GetTGeometryX()->GetCurrentNode();
00206    if ( !hall_node || strcmp("hall",hall_node->GetName()) ) {
00207       MSG("Ugli",Msg::kWarning) 
00208          << "UgliSteelPlnNode " << planeid
00209          << " ctor didn't start in the \"hall\" node: " 
00210          << hall_node->GetName()
00211          << endl;
00212       hall_node = fUgliGeometry->GetTNodeX("hall");
00213       if (!hall_node) {
00214          MSG("Ugli",Msg::kError) 
00215             << "UgliSteelPlnNode ctor found the \"hall\" node wasn't a TNodeX"
00216             << endl;
00217          return;
00218       }
00219       hall_node->cd();
00220    }
00221 
00222    // go inside the hall and place the containing box
00223    Float_t x0hall = hall_node->GetX();
00224    Float_t y0hall = hall_node->GetY();
00225    Float_t z0hall = hall_node->GetZ();
00226    TNodeX* box_node =
00227       new TNodeX(boxname,boxname,box_outline,
00228                  x0pln-x0hall,y0pln-y0hall,z0box-z0hall,box_rotm);
00229 
00230    box_node->SetLineColor(41); // a ghostly beige
00231 
00232    MSG("Ugli",Msg::kVerbose) << " create specific steel outline" << endl;
00233 
00234    // the actual steel plane gets put in the box
00235    // with no additional shifts or rotations
00236    // except that it gets shoved to the back (+z) of the box
00237    Float_t hthick = 0.5 * steelRow->GetThickness() *bombz;
00238    Float_t zshift_stl = dzbox - hthick;
00239    // build and attach the appropriate shape
00240    fShape = new MinosOutline(stlname,stlname,"steel",planeid,
00241                              hasEars,hthick,xyscale_stl);
00242 
00243    // parent was initialized by ctor ... we need to set it into the box
00244    SetParent(box_node);    // modified version in TNodeX needed
00245    SetPosition(0,0,zshift_stl);
00246    // by default,if no name supplied, it's built with the Identity matrix 
00247    // SetMatrix(fUgliGeometry->GetRotMatrix("Identity"))
00248    SetLineColor(50);   // kind of rusty color
00249 
00250    int box_vis = 1; // ?? 0 ??
00251    int stl_vis = 1; // ?? 0 ??
00252    box_node->SetVisibility(box_vis); 
00253    this->SetVisibility(stl_vis);
00254 
00255    // map "local" (steel) [0,0,zback] to global position
00256    TVector3 current = LocalToGlobal(TVector3(0,0,hthick)); 
00257    // adjust box position to make (x0,y0,zback) where it should be
00258    // this was easy when there were only U,V planes
00259    box_node->SetPosition(box_node->GetX()+x0pln-current.X(),
00260                          box_node->GetY()+y0pln-current.Y(),
00261                          box_node->GetZ()+zback-current.Z());
00262 
00263 }

UgliSteelPlnNode::UgliSteelPlnNode ( const UgliSteelPlnNode that  )  [private]

Member Function Documentation

void UgliSteelPlnNode::DecrementRef (  )  [protected, virtual]

Reimplemented from UgliPlnNode.

Definition at line 274 of file UgliSteelPlnNode.cxx.

References UgliRefCnt::DecrementRef(), UgliRefCnt::fRef, and UgliPlnNode::fUgliGeometry.

00275 { 
00276    fRef--; 
00277    fUgliGeometry->DecrementRef();
00278    if (!fRef) SetVisibility(0);
00279 }

TVector3 UgliSteelPlnNode::GetCenter (  )  const [virtual]

Reimplemented from UgliPlnNode.

Definition at line 312 of file UgliSteelPlnNode.cxx.

References TransformLocal2Global().

Referenced by UgliSteelPlnHandle::GetCenter().

00313 {
00314    Double_t lxyz[3] = {0., 0., 0.};
00315    Double_t gxyz[3];
00316 
00317    TransformLocal2Global(lxyz,gxyz);
00318    return TVector3(gxyz[0],gxyz[1],gxyz[2]);
00319 }

Float_t UgliSteelPlnNode::GetHalfThickness (  )  const [virtual]

Reimplemented from UgliPlnNode.

Definition at line 292 of file UgliSteelPlnNode.cxx.

References Msg::kError, and MSG.

Referenced by UgliSteelPlnHandle::GetHalfThickness(), and UgliGeometry::GetNearestSteelPlnNode().

00293 {
00294 
00295    TBRIK *brik = dynamic_cast<TBRIK*>(fShape);
00296    if (brik) return brik->GetDz();
00297 
00298    TXTRU *xtru = dynamic_cast<TXTRU*>(fShape);
00299    if (xtru) {
00300       Int_t    nz = xtru->GetNz();
00301       Float_t* fz = xtru->GetZ();
00302       return 0.5*TMath::Abs(fz[0]-fz[nz-1]);
00303    }
00304 
00305    MSG("Ugli",Msg::kError) <<
00306       "UgliSteelPlnNode::GetHalfThickness: not a BRIK or TXTRU" << endl;
00307 
00308    return 0;
00309 }

virtual PlexPlaneId UgliSteelPlnNode::GetPlexPlaneId (  )  const [inline, virtual]

Reimplemented from UgliPlnNode.

Definition at line 32 of file UgliSteelPlnNode.h.

References UgliPlnNode::fPlaneId.

Referenced by UgliGeometry::GetSteelPlnNodePtrVector(), and ~UgliSteelPlnNode().

00033       {return fPlaneId;}

virtual UgliGeometry* UgliSteelPlnNode::GetUgliGeometry (  )  const [inline, virtual]

Reimplemented from UgliPlnNode.

Definition at line 47 of file UgliSteelPlnNode.h.

References UgliPlnNode::fUgliGeometry.

Referenced by UgliSteelPlnHandle::IsFrozen().

00047 { return fUgliGeometry; }

Float_t UgliSteelPlnNode::GetX0 (  )  const [virtual]

Reimplemented from UgliPlnNode.

Definition at line 322 of file UgliSteelPlnNode.cxx.

References TransformLocal2Global().

Referenced by UgliSteelPlnHandle::GetX0().

00323 {
00324    Double_t lxyz[3] = {0., 0., 0.};
00325    Double_t gxyz[3];
00326 
00327    TransformLocal2Global(lxyz,gxyz);
00328    return gxyz[0];
00329 }

Float_t UgliSteelPlnNode::GetY0 (  )  const [virtual]

Reimplemented from UgliPlnNode.

Definition at line 332 of file UgliSteelPlnNode.cxx.

References TransformLocal2Global().

Referenced by UgliSteelPlnHandle::GetY0().

00333 {
00334    Double_t lxyz[3] = {0., 0., 0.};
00335    Double_t gxyz[3];
00336 
00337    TransformLocal2Global(lxyz,gxyz);
00338    return gxyz[1];
00339 }

Float_t UgliSteelPlnNode::GetZ0 (  )  const [virtual]

Reimplemented from UgliPlnNode.

Definition at line 342 of file UgliSteelPlnNode.cxx.

References TransformLocal2Global().

Referenced by UgliGeometry::GetNearestSteelPlnNode(), and UgliSteelPlnHandle::GetZ0().

00343 {
00344    Double_t lxyz[3] = {0., 0., 0.};
00345    Double_t gxyz[3];
00346 
00347    TransformLocal2Global(lxyz,gxyz);
00348    return gxyz[2];
00349 }

TVector3 UgliSteelPlnNode::GlobalToLocal ( const TVector3 &  global  )  const [virtual]

Definition at line 352 of file UgliSteelPlnNode.cxx.

Referenced by UgliSteelPlnHandle::GlobalToLocal().

00353 { 
00354    // get the local position based on global position
00355 
00356    Double_t gxyz[3], lxyz[3];
00357 
00358    gxyz[0] = global.X();
00359    gxyz[1] = global.Y();
00360    gxyz[2] = global.Z();
00361 
00362    // deal with fact that TNode::Master2Local isn't declared const
00363    UgliSteelPlnNode* self = const_cast<UgliSteelPlnNode*>(this);
00364    self->cd();
00365    self->UpdateMatrix();
00366    self->Master2Local(gxyz,lxyz);
00367 
00368    return TVector3(lxyz[0],lxyz[1],lxyz[2]);
00369 }

TVector3 UgliSteelPlnNode::GlobalToLocalVect ( const TVector3 &  global  )  const [virtual]

Definition at line 392 of file UgliSteelPlnNode.cxx.

Referenced by UgliSteelPlnHandle::GlobalToLocalVect().

00393 { 
00394    // get the local direction based on global direction
00395 
00396    Double_t gxyz[3], lxyz[3];
00397 
00398    gxyz[0] = global.X();
00399    gxyz[1] = global.Y();
00400    gxyz[2] = global.Z();
00401 
00402    // deal with fact that TNode::Master2Local isn't declared const
00403    UgliSteelPlnNode* self = const_cast<UgliSteelPlnNode*>(this);
00404    self->cd();
00405    self->UpdateMatrixVect();
00406    self->Master2LocalVect(gxyz,lxyz);
00407 
00408    return TVector3(lxyz[0],lxyz[1],lxyz[2]);
00409 }

void UgliSteelPlnNode::IncrementRef (  )  [protected, virtual]

Reimplemented from UgliPlnNode.

Definition at line 267 of file UgliSteelPlnNode.cxx.

References UgliRefCnt::fRef, UgliPlnNode::fUgliGeometry, and UgliRefCnt::IncrementRef().

00268 {
00269    fRef++; 
00270    fUgliGeometry->IncrementRef();
00271    SetVisibility(1);
00272 }

TVector3 UgliSteelPlnNode::LocalToGlobal ( const TVector3 &  local  )  const [virtual]

Definition at line 372 of file UgliSteelPlnNode.cxx.

Referenced by UgliSteelPlnHandle::LocalToGlobal(), and UgliSteelPlnNode().

00373 { 
00374    // get the global position based on local position
00375 
00376    Double_t gxyz[3], lxyz[3];
00377 
00378    lxyz[0] = local.X();
00379    lxyz[1] = local.Y();
00380    lxyz[2] = local.Z();
00381 
00382    // deal with fact that TNode::Local2Master isn't declared const
00383    UgliSteelPlnNode* self = const_cast<UgliSteelPlnNode*>(this);
00384    self->cd();
00385    self->UpdateMatrix();
00386    self->Local2Master(lxyz,gxyz);
00387 
00388    return TVector3(gxyz[0],gxyz[1],gxyz[2]);
00389 }

TVector3 UgliSteelPlnNode::LocalToGlobalVect ( const TVector3 &  local  )  const [virtual]

Definition at line 412 of file UgliSteelPlnNode.cxx.

Referenced by UgliSteelPlnHandle::LocalToGlobalVect().

00413 { 
00414    // get the global direction based on local direction
00415 
00416    Double_t gxyz[3], lxyz[3];
00417 
00418    lxyz[0] = local.X();
00419    lxyz[1] = local.Y();
00420    lxyz[2] = local.Z();
00421 
00422    // deal with fact that TNode::Local2Master isn't declared const
00423    UgliSteelPlnNode* self = const_cast<UgliSteelPlnNode*>(this);
00424    self->cd();
00425    self->UpdateMatrixVect();
00426    self->Local2MasterVect(lxyz,gxyz);
00427 
00428    return TVector3(gxyz[0],gxyz[1],gxyz[2]);
00429 }

UgliSteelPlnNode& UgliSteelPlnNode::operator= ( const UgliSteelPlnNode ugh  )  [private]

Reimplemented from UgliPlnNode.

void UgliSteelPlnNode::TransformLocal2Global ( Double_t *  lxyz,
Double_t *  gxyz 
) const [protected]

Reimplemented from UgliPlnNode.

Definition at line 282 of file UgliSteelPlnNode.cxx.

Referenced by GetCenter(), GetX0(), GetY0(), and GetZ0().

00283 {
00284    // deal with fact that TNode::Master2Local isn't declared const
00285    UgliSteelPlnNode* self = const_cast<UgliSteelPlnNode*>(this);
00286    self->cd();
00287    self->UpdateMatrix();
00288    self->Local2Master(lxyz,gxyz);
00289 }


Friends And Related Function Documentation

friend class UgliGeometry [friend]

Reimplemented from UgliPlnNode.

Definition at line 23 of file UgliSteelPlnNode.h.

friend class UgliGeometryReroot [friend]

Reimplemented from UgliPlnNode.

Definition at line 24 of file UgliSteelPlnNode.h.

friend class UgliSteelPlnHandle [friend]

Definition at line 25 of file UgliSteelPlnNode.h.


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1