Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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

Constructor & Destructor Documentation

UgliScintPlnNode::~UgliScintPlnNode  )  [virtual]
 

Definition at line 43 of file UgliScintPlnNode.cxx.

References UgliRefCnt::CountRef(), UgliPlnNode::GetPlexPlaneId(), 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         << "~UgliScintPlnNode " << GetPlexPlaneId() 
00051         << " still had " << CountRef()
00052         << " outstanding references " << endl;
00053    }
00054 #endif
00055 }

UgliScintPlnNode::UgliScintPlnNode  ) 
 

Definition at line 36 of file UgliScintPlnNode.cxx.

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

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

Definition at line 58 of file UgliScintPlnNode.cxx.

References PlexPlaneId::AsString(), BuildStrips(), UgliDbiTables::GetDbiScintPlnByIndex(), PlexPlaneId::GetPlane(), UgliGeometry::GetTGeometryX(), UgliDbiScintPln::GetThickness(), UgliGeometry::GetTNodeX(), UgliDbiScintPln::GetX0RelSteel(), UgliDbiScintPln::GetY0RelSteel(), UgliDbiScintPln::GetZRotRelSteelDeg(), MSG, and TNodeX::SetParent().

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

UgliScintPlnNode::UgliScintPlnNode const UgliScintPlnNode that  )  [private]
 


Member Function Documentation

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

Definition at line 141 of file UgliScintPlnNode.cxx.

References PlaneCoverage::AsString(), PlaneView::AsString(), Detector::AsString(), PlexPlaneId::AsString(), 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(), and MSG.

Referenced by UgliScintPlnNode().

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

void UgliScintPlnNode::DecrementRef  )  [protected, virtual]
 

Reimplemented from UgliPlnNode.

Definition at line 208 of file UgliScintPlnNode.cxx.

References UgliRefCnt::DecrementRef().

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

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

Definition at line 342 of file UgliScintPlnNode.cxx.

Referenced by UgliScintPlnHandle::GetScintMdlHandleVector().

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

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

Definition at line 216 of file UgliScintPlnNode.cxx.

References PlexStripEndId::AsString(), PlexVetoShieldHack::ConvertRangeToContext(), fStripTable, PlexPlaneId::GetDetector(), TNodeX::GetNodeToDepth(), UgliGeometry::GetScintPlnNode(), UgliGeometry::GetTGeometryX(), GetUgliGeometry(), PlexPlaneId::IsVetoShield(), MSG, PlexVetoShieldHack::RenumberMuxToMdl(), PlexStripEndId::SetEnd(), and PlexStripEndId::SetSubPart().

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

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

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

Definition at line 322 of file UgliScintPlnNode.cxx.

References fStripTable, and nodeItr_t.

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

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

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

Reimplemented from UgliPlnNode.

Definition at line 58 of file UgliScintPlnNode.h.

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.

Referenced by UgliScintPlnHandle::GetZRotRelSteelRad().

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

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

Definition at line 362 of file UgliScintPlnNode.cxx.

Referenced by UgliScintPlnHandle::GlobalToLocal().

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

void UgliScintPlnNode::IncrementRef  )  [protected, virtual]
 

Reimplemented from UgliPlnNode.

Definition at line 201 of file UgliScintPlnNode.cxx.

References UgliRefCnt::IncrementRef().

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

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

Definition at line 382 of file UgliScintPlnNode.cxx.

Referenced by UgliScintPlnHandle::LocalToGlobal().

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

Int_t UgliScintPlnNode::NumberOfStrips  )  const [virtual]
 

Implements UgliScintPlnABC.

Definition at line 281 of file UgliScintPlnNode.cxx.

References PlexPlaneId::AsString(), fStripTable, PlexPlaneId::GetDetector(), PlexPlaneId::GetPlaneCoverage(), and MSG.

Referenced by UgliScintPlnHandle::NumberOfStrips().

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

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

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 402 of file UgliScintPlnNode.cxx.

Referenced by UgliScintPlnHandle::SetZRotRelSteelRad().

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

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

std::map<PlexStripEndId,UgliStripNode*> UgliScintPlnNode::fStripTable [protected]
 

Definition at line 93 of file UgliScintPlnNode.h.

Referenced by BuildStrips(), GetStripNode(), GetStripNodePtrVector(), and NumberOfStrips().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:28 2010 for loon by  doxygen 1.3.9.1