UgliScintPlnNode Class Reference

#include <UgliScintPlnNode.h>

Inheritance diagram for UgliScintPlnNode:
UgliScintPlnABC UgliPlnNode UgliPlnABC UgliRefCnt TNodeX

List of all members.

Public Member Functions

virtual ~UgliScintPlnNode ()
virtual Int_t NumberOfStrips () const
virtual std::vector
< UgliStripNode * > 
GetStripNodePtrVector () const
virtual std::vector
< UgliScintMdlNode * > 
GetScintMdlNodePtrVector () const
virtual TVector3 GlobalToLocal (const TVector3 &global) const
virtual TVector3 LocalToGlobal (const TVector3 &local) const
virtual UgliGeometryGetUgliGeometry () const
virtual UgliStripNodeGetStripNode (PlexStripEndId seid) const
Float_t GetZRotRelSteelRad () const
Float_t GetX0RelSteel () const
Float_t GetY0RelSteel () const
void SetZRotRelSteelRad (Float_t radians)
void SetXY0RelSteel (Float_t x0, Float_t y0)
 UgliScintPlnNode ()

Protected Member Functions

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

Protected Attributes

std::map< PlexStripEndId,
UgliStripNode * > 
fStripTable

Private Member Functions

 UgliScintPlnNode (const UgliScintPlnNode &that)
UgliScintPlnNodeoperator= (const UgliScintPlnNode &ugh)

Friends

class UgliGeometry
class UgliGeometryReroot
class UgliScintPlnHandle

Detailed Description

Definition at line 29 of file UgliScintPlnNode.h.


Constructor & Destructor Documentation

UgliScintPlnNode::~UgliScintPlnNode (  )  [virtual]

Definition at line 44 of file UgliScintPlnNode.cxx.

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

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

UgliScintPlnNode::UgliScintPlnNode (  ) 

Definition at line 37 of file UgliScintPlnNode.cxx.

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

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

Definition at line 59 of file UgliScintPlnNode.cxx.

References PlexPlaneId::AsString(), BuildStrips(), UgliPlnNode::fUgliGeometry, UgliDbiTables::GetDbiScintPlnByIndex(), PlexPlaneId::GetPlane(), UgliGeometry::GetTGeometryX(), UgliGeometry::GetTNodeX(), Msg::kError, Msg::kWarning, MSG, and TNodeX::SetParent().

00062    : UgliPlnNode(ugligeom,planeid)
00063 {
00064    // ctor for DBI driven UgliGeometry
00065 
00066    // box to enclose steel + scint has already been built
00067    char boxname[16], plnname[16];
00068    sprintf(boxname,"%s",planeid.AsString("b"));  // dNNNBvc
00069    sprintf(plnname,"%s",planeid.AsString("p"));  // dNNNPvc
00070 
00071 
00072    const UgliDbiScintPln* plnRow = 
00073       ugliTables.GetDbiScintPlnByIndex(planeid.GetPlane());
00074 
00075    if (!plnRow) {
00076       MSG("Ugli",Msg::kError) 
00077          << " no UgliDbiScintPln entry for " << planeid.AsString("C")
00078          << endl;
00079       return;
00080    }
00081 
00082    // build and attach the shape we should actually have
00083    Float_t hthick = 0.5 * plnRow->GetThickness();
00084    fShape = new MinosOutline(plnname,plnname,"scint",planeid,
00085                              false,hthick,1.0);
00086 
00087    // the current working node should already be the appropriate box
00088    TNode* box_node = fUgliGeometry->GetTGeometryX()->GetCurrentNode();
00089    if ( !box_node || strcmp(boxname,box_node->GetName()) ) {
00090       // parent was initialized by ctor ... we need to set it into the box
00091       MSG("Ugli",Msg::kWarning) 
00092          << "UgliScintPlnNode " << planeid
00093          << " ctor didn't start in the right box node: " 
00094          << box_node->GetName()
00095          << endl;
00096       box_node = fUgliGeometry->GetTNodeX(boxname);
00097       if (!box_node) {
00098          MSG("Ugli",Msg::kError) 
00099             << "UgliScintPlnNode ctor found " 
00100             << "the containing box node wasn't a TNodeX"
00101             << endl;
00102          return;
00103       }
00104    }
00105    if (GetParent() != box_node) {
00106       MSG("Ugli",Msg::kWarning) 
00107          << "UgliScintPlnNode " << planeid 
00108          << " ctor parent wasn't the right box node" 
00109          << endl;
00110       SetParent(box_node);    // modified version in TNodeX needed
00111    }
00112    MinosOutline *box_shape = dynamic_cast<MinosOutline*>(box_node->GetShape());
00113    if (!box_shape) { 
00114       MSG("Ugli",Msg::kError) 
00115          << "UgliScintPlnNode ctor found " 
00116          << "the containing box is not a MinosOutline"
00117          << endl;
00118       return;
00119    }
00120 
00121    // set the position relative to the steel
00122    Float_t x0 = plnRow->GetX0RelSteel();
00123    Float_t y0 = plnRow->GetY0RelSteel();
00124    Float_t zshift_pln = hthick + box_shape->GetZ()[0];
00125    SetPosition(x0,y0,zshift_pln);
00126 
00127    // needs to build and set the right rotation matrix
00128    // here we only have a single rotation around z
00129    const Double_t deg90 = 90;
00130    Double_t zrot = plnRow->GetZRotRelSteelDeg();
00131    fMatrix = new TRotMatrix(plnname,plnname,
00132                             deg90,zrot,deg90,zrot+deg90,0,0);
00133 
00134    SetLineColor(38);   // a nice soothing blue
00135 
00136    // now go ahead an install all the strips
00137    BuildStrips(ugliTables);
00138 
00139 }

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

Member Function Documentation

void UgliScintPlnNode::BuildStrips ( const UgliDbiTables ugliTables  )  [protected]

Definition at line 142 of file UgliScintPlnNode.cxx.

References bfld::AsString(), PlexPlaneId::AsString(), PlaneView::AsString(), PlaneCoverage::AsString(), cd(), UgliPlnNode::fPlaneId, UgliDbiTables::fScintMdlStructTbl, UgliDbiTables::fScintPlnStructTbl, fStripTable, UgliDbiScintPlnStruct::GetDetector(), UgliDbiScintMdlStruct::GetFirstStrip(), UgliDbiScintPlnStruct::GetIndex(), UgliDbiScintMdlStruct::GetLastStrip(), UgliDbiScintPlnStruct::GetNModules(), DbiResultPtr< T >::GetNumRows(), UgliDbiScintPlnStruct::GetPlaneCoverage(), UgliDbiScintPlnStruct::GetPlaneView(), DbiResultPtr< T >::GetRow(), DbiResultPtr< T >::GetRowByIndex(), Msg::kDebug, Msg::kError, and MSG.

Referenced by UgliScintPlnNode().

00143 {
00144    // build all the strips in this plane using DBI
00145 
00146    MSG("Ugli",Msg::kDebug)
00147       << " BuildStrips " << fPlaneId.AsString("c") << endl;
00148 
00149    unsigned int pln_indx = UgliDbiStructHash(fPlaneId).HashAsPlane();
00150    const UgliDbiScintPlnStruct* plnStructRow = 
00151       ugliTables.fScintPlnStructTbl.GetRowByIndex(pln_indx);
00152 
00153    if (!plnStructRow) {
00154      unsigned int nstructrows = ugliTables.fScintPlnStructTbl.GetNumRows();
00155      MSG("Ugli",Msg::kError) 
00156        << " no UgliDbiScintPlnStruct for " << fPlaneId 
00157        << " hash to indx " << pln_indx 
00158        << ", table has " << nstructrows << endl;
00159      for (unsigned int i=0; i<nstructrows; ++i) {
00160        const UgliDbiScintPlnStruct* aRow = 
00161          ugliTables.fScintPlnStructTbl.GetRow(i);
00162        cout << " row " << i << " hash " << aRow->GetIndex(9999)
00163             << " " << Detector::AsString(aRow->GetDetector())
00164             << " view " << PlaneView::AsString(aRow->GetPlaneView())
00165             << " cover " << PlaneCoverage::AsString(aRow->GetPlaneCoverage())
00166             << endl;
00167      }
00168      abort();
00169    }
00170 
00171 
00172    // loop over the modules in the plane
00173    for (int imdl=0; imdl<plnStructRow->GetNModules(); imdl++) {
00174 
00175       this->cd();
00176       
00177       PlexScintMdlId scintmdlid(fPlaneId,imdl);
00178       unsigned int mdl_indx =  UgliDbiStructHash(scintmdlid).HashAsScintMdl();
00179       const UgliDbiScintMdlStruct* mdlStructRow =
00180          ugliTables.fScintMdlStructTbl.GetRowByIndex(mdl_indx);
00181 
00182       int first = mdlStructRow->GetFirstStrip();
00183       int last  = mdlStructRow->GetLastStrip();
00184 
00185       UgliScintMdlNode* mdlNode = 
00186          new UgliScintMdlNode(scintmdlid,this,ugliTables);
00187       mdlNode->cd();
00188 
00189       // loop over the strips in the module, constructing each
00190       for (int istrip = first; istrip <= last; istrip++) {
00191 
00192          PlexStripEndId seid(fPlaneId,istrip);
00193          fStripTable[seid] = new UgliStripNode(seid,mdlNode,ugliTables);
00194 
00195       } // loop over strips in module
00196 
00197    } // loop over modules
00198 
00199 }

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

Reimplemented from UgliPlnNode.

Definition at line 209 of file UgliScintPlnNode.cxx.

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

00210 { 
00211    fRef--; 
00212    fUgliGeometry->DecrementRef();
00213    if (!fRef) SetVisibility(0);
00214 }

vector< UgliScintMdlNode * > UgliScintPlnNode::GetScintMdlNodePtrVector (  )  const [virtual]

Definition at line 343 of file UgliScintPlnNode.cxx.

Referenced by UgliScintPlnHandle::GetScintMdlHandleVector().

00344 {
00345    // return collection of ptrs for all scint module nodes in plane
00346 
00347    vector<UgliScintMdlNode*> allScintMdls;
00348    
00349    // walk the TList of nodes
00350    TObjLink *lnk = fNodes->FirstLink();
00351    while (lnk) {
00352       UgliScintMdlNode* mdlnode = 
00353         dynamic_cast<UgliScintMdlNode*>(lnk->GetObject());
00354       if (mdlnode) 
00355         allScintMdls.push_back(mdlnode);
00356       lnk = lnk->Next();
00357    }
00358 
00359    return allScintMdls;
00360 }

UgliStripNode * UgliScintPlnNode::GetStripNode ( PlexStripEndId  seid  )  const [virtual]

Definition at line 217 of file UgliScintPlnNode.cxx.

References PlexStripEndId::AsString(), PlexVetoShieldHack::ConvertRangeToContext(), fStripTable, UgliPlnNode::fUgliGeometry, PlexPlaneId::GetDetector(), TNodeX::GetNodeToDepth(), UgliGeometry::GetScintPlnNode(), UgliGeometry::GetTGeometryX(), GetUgliGeometry(), PlexPlaneId::IsVetoShield(), Msg::kError, Detector::kFar, Msg::kFatal, StripEnd::kUnknown, StripEnd::kWhole, MSG, PlexVetoShieldHack::RenumberMuxToMdl(), PlexStripEndId::SetEnd(), and PlexStripEndId::SetSubPart().

Referenced by UgliScintPlnHandle::GetStripHandle(), and UgliGeometry::GetStripNode().

00218 {
00219    // get a node for a particular strip
00220 
00221    TGeometryX* fRootGeom = fUgliGeometry->GetTGeometryX();
00222 
00223    fRootGeom->cd();
00224 
00225    PlexStripEndId geom_seid = seid;
00226    // convert FarDet veto shield id's into one-module-per-plane #'s
00227    if (geom_seid.GetDetector() == Detector::kFar && 
00228        geom_seid.IsVetoShield()) {
00229      VldContext vldc = 
00230        PlexVetoShieldHack::ConvertRangeToContext(GetUgliGeometry()->GetVldRange());
00231      geom_seid = PlexVetoShieldHack::RenumberMuxToMdl(vldc,geom_seid);
00232    }
00233 
00234    UgliScintPlnNode* the_plane = fUgliGeometry->GetScintPlnNode(geom_seid);
00235    if (the_plane != this) {
00236       string alt = " ";
00237       if (seid.IsVetoShield()) {
00238         alt = " [";
00239         alt += geom_seid.AsString("p");
00240         alt += "]";
00241       }
00242       MSG("Ugli",Msg::kFatal)
00243          << "UgliScintPlnNode::GetStripNode called on plane "
00244          << seid.AsString("p") 
00245          << " other than itself "
00246          << seid.AsString("p") << alt << endl;
00247    }
00248    the_plane->cd();
00249 
00250    PlexStripEndId seid_clean(geom_seid);
00251    // strip off any End or SubPart info when doing search
00252    seid_clean.SetEnd(StripEnd::kUnknown);
00253    seid_clean.SetSubPart(StripEnd::kWhole);
00254 #ifdef USENODETODEPTH
00255    UgliStripNode* the_node = 
00256       dynamic_cast<UgliStripNode*>(the_plane->GetNodeToDepth(seid_clean.AsString("c"),1));
00257 #else
00258    //rwh: UgliStripNode* the_node = fStripTable[seid_clean];
00259    UgliStripNode* the_node = 0;
00260    typedef std::map<PlexStripEndId,UgliStripNode*>::const_iterator stripTableItr_t;
00261    stripTableItr_t st_itr = fStripTable.find(seid_clean);
00262    if (st_itr != fStripTable.end()) the_node = st_itr->second;
00263 #endif
00264    if ( ! the_node ) {
00265       MSG("Ugli",Msg::kError)
00266         << "UgliScintPlnNode::GetStripNode not possible for "
00267         << seid_clean.AsString() << " " << seid << endl;
00268       std::map<PlexStripEndId,UgliStripNode*>::const_iterator mapitr = 
00269         fStripTable.begin();
00270       while (mapitr != fStripTable.end()) {
00271         std::cerr << "  " << mapitr->first 
00272                   << " StripNode* " << mapitr->second
00273                   << std::endl;
00274         mapitr++;
00275       }
00276       assert(0);
00277    }
00278    return the_node;
00279 }

vector< UgliStripNode * > UgliScintPlnNode::GetStripNodePtrVector (  )  const [virtual]

Definition at line 323 of file UgliScintPlnNode.cxx.

References fStripTable.

Referenced by UgliScintPlnHandle::GetClosestStrip(), and UgliScintPlnHandle::GetStripHandleVector().

00324 {
00325    // return collection of ptrs for all strip nodes in plane
00326 
00327    vector<UgliStripNode*> allStrips;
00328    
00329    typedef map<PlexStripEndId,UgliStripNode*>::const_iterator nodeItr_t;
00330    nodeItr_t node_itr = fStripTable.begin();
00331    nodeItr_t node_end = fStripTable.end();
00332    
00333    while (node_itr != node_end) {
00334       pair<PlexStripEndId,UgliStripNode*> map_pair = *node_itr;
00335       allStrips.push_back(map_pair.second);
00336       node_itr++;
00337    }
00338 
00339    return allStrips;
00340 }

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

Reimplemented from UgliPlnNode.

Definition at line 58 of file UgliScintPlnNode.h.

References UgliPlnNode::fUgliGeometry.

Referenced by GetStripNode(), and UgliScintPlnHandle::IsFrozen().

00059       { return fUgliGeometry; }

Float_t UgliScintPlnNode::GetX0RelSteel (  )  const [inline]

Definition at line 115 of file UgliScintPlnNode.h.

Referenced by UgliScintPlnHandle::GetX0RelSteel().

00115 { return fX; }

Float_t UgliScintPlnNode::GetY0RelSteel (  )  const [inline]

Definition at line 116 of file UgliScintPlnNode.h.

Referenced by UgliScintPlnHandle::GetY0RelSteel().

00116 { return fY; }

Float_t UgliScintPlnNode::GetZRotRelSteelRad (  )  const [inline]

Definition at line 112 of file UgliScintPlnNode.h.

References Ugli::deg2rad.

Referenced by UgliScintPlnHandle::GetZRotRelSteelRad().

00113 { return fMatrix->GetPhi()*Ugli::deg2rad; }

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

Definition at line 363 of file UgliScintPlnNode.cxx.

Referenced by UgliScintPlnHandle::GlobalToLocal().

00364 { 
00365    // get the local position based on global position
00366 
00367    Double_t gxyz[3], lxyz[3];
00368 
00369    gxyz[0] = global.X();
00370    gxyz[1] = global.Y();
00371    gxyz[2] = global.Z();
00372 
00373    // deal with fact that TNode::Master2Local isn't declared const
00374    UgliScintPlnNode* self = const_cast<UgliScintPlnNode*>(this);
00375    self->cd();
00376    self->UpdateMatrix();
00377    self->Master2Local(gxyz,lxyz);
00378 
00379    return TVector3(lxyz[0],lxyz[1],lxyz[2]);
00380 }

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

Reimplemented from UgliPlnNode.

Definition at line 202 of file UgliScintPlnNode.cxx.

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

00203 {
00204    fRef++; 
00205    fUgliGeometry->IncrementRef();
00206    SetVisibility(1);
00207 }

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

Definition at line 383 of file UgliScintPlnNode.cxx.

Referenced by UgliScintPlnHandle::LocalToGlobal().

00384 { 
00385    // get the global position based on local position
00386 
00387    Double_t gxyz[3], lxyz[3];
00388 
00389    lxyz[0] = local.X();
00390    lxyz[1] = local.Y();
00391    lxyz[2] = local.Z();
00392 
00393    // deal with fact that TNode::Local2Master isn't declared const
00394    UgliScintPlnNode* self = const_cast<UgliScintPlnNode*>(this);
00395    self->cd();
00396    self->UpdateMatrix();
00397    self->Local2Master(lxyz,gxyz);
00398 
00399    return TVector3(gxyz[0],gxyz[1],gxyz[2]);
00400 }

Int_t UgliScintPlnNode::NumberOfStrips (  )  const [virtual]

Implements UgliScintPlnABC.

Definition at line 282 of file UgliScintPlnNode.cxx.

References PlexPlaneId::AsString(), UgliPlnNode::fPlaneId, fStripTable, PlexPlaneId::GetDetector(), PlexPlaneId::GetPlaneCoverage(), Detector::kCalib, PlaneCoverage::kComplete, Msg::kError, Detector::kFar, PlaneCoverage::kNearFull, PlaneCoverage::kNearPartial, and MSG.

Referenced by UgliScintPlnHandle::NumberOfStrips().

00283 {
00284    // return the number of strips in the plane
00285 
00286    return fStripTable.size();
00287 
00288 #ifdef HARDCODED
00289    // *** bad form *** hard coded value based on PlaneCoverage (and detector)
00290 
00291    switch (fPlaneId.GetPlaneCoverage()) {
00292    case PlaneCoverage::kComplete:
00293       switch (fPlaneId.GetDetector()) {
00294       case Detector::kFar:
00295          return 192; // 28 + 28 + 20 + 20 + 20 + 20 + 28 + 28
00296          break;
00297       case Detector::kCalib:
00298          return 24;  // 24
00299          break;
00300       default:
00301          break; // handle errors below
00302       }
00303       break;
00304    case PlaneCoverage::kNearFull:
00305       return  96;    // 28 + 20 + 16 + 16 + 16
00306       break;
00307    case PlaneCoverage::kNearPartial:
00308       return  68;    // 28 + 20 + 20 
00309       break;
00310    default:
00311       break; // handle errors below
00312    }
00313 
00314    MSG("Ugli",Msg::kError) 
00315       << "UgliScintPlnNode::NumberOfStrips: unknown case " 
00316       << fPlaneId.AsString() << endl;
00317    return 0;
00318 #endif
00319 
00320 }

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

Reimplemented from UgliPlnNode.

void UgliScintPlnNode::SetXY0RelSteel ( Float_t  x0,
Float_t  y0 
) [inline]

Definition at line 109 of file UgliScintPlnNode.h.

00110 { SetPosition(x0,y0,0.0); }

void UgliScintPlnNode::SetZRotRelSteelRad ( Float_t  radians  ) 

Definition at line 403 of file UgliScintPlnNode.cxx.

References Ugli::rad2deg.

Referenced by UgliScintPlnHandle::SetZRotRelSteelRad().

00404 {
00405   // set the rotation around z 
00406   // this matrix is specific to this scint plane so we can modify it
00407   Float_t zrotdeg = radians * Ugli::rad2deg;
00408   fMatrix->SetAngles(90,zrotdeg,90,zrotdeg+90,0,0);
00409 }

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

Reimplemented from UgliPlnNode.


Friends And Related Function Documentation

friend class UgliGeometry [friend]

Reimplemented from UgliPlnNode.

Definition at line 31 of file UgliScintPlnNode.h.

friend class UgliGeometryReroot [friend]

Reimplemented from UgliPlnNode.

Definition at line 32 of file UgliScintPlnNode.h.

friend class UgliScintPlnHandle [friend]

Definition at line 33 of file UgliScintPlnNode.h.


Member Data Documentation


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1