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

GeoScintPlnNode.cxx

Go to the documentation of this file.
00001 
00002 //
00003 // GeoScintPlnNode
00004 //
00005 // GeoScintPlnNode is a plane node for a scint plane
00006 //
00007 // Author:  S. Kasahara 07/04
00009 
00010 #include "MessageService/MsgService.h"
00011 #include "GeoGeometry/GeoScintPlnNode.h"
00012 #include "GeoGeometry/GeoScintMdlNode.h"
00013 #include "GeoGeometry/GeoStripNode.h"
00014 #include <TMath.h>
00015 #include <TGeoMatrix.h>
00016 
00017 ClassImp(GeoScintPlnNode)
00018 CVSID("$Id: GeoScintPlnNode.cxx,v 1.15 2007/12/11 06:04:16 rhatcher Exp $");
00019 
00020 //_____________________________________________________________________________
00021 GeoScintPlnNode::GeoScintPlnNode(GeoGeometry* geo, TGeoVolume* plnvol,
00022                            TGeoMatrix* plnmatrix, TGeoVolume* parVol,
00023                            std::string globalpath, std::string nodename, 
00024                            const PlexPlaneId& planeid)
00025   : GeoPlnNode(geo,plnvol,plnmatrix,parVol,globalpath,nodename,planeid) {
00026   // Normal constructor
00027   // Protected
00028 
00029 }
00030 //_____________________________________________________________________________
00031 GeoScintPlnNode::~GeoScintPlnNode() {
00032   // Destructor should delete any owned objects
00033   if ( CountRef() ) {
00034     MSG("Geo",Msg::kWarning)
00035       << "GeoScintPlnNode destructor " << GetPlexPlaneId()
00036       << " still had " << CountRef()
00037       << " outstanding references " << endl;
00038   }
00039 }
00040 
00041 //_____________________________________________________________________________
00042 GeoStripNode* GeoScintPlnNode::GetStripNode(const PlexStripEndId& seid) const {
00043   // Returns strip node corresponding to specified seid
00044 
00045   MSG("Geo",Msg::kDebug) << " PlaneId " << GetPlexPlaneId().AsString() 
00046                          << " GetStripNode " << seid.AsString() << endl;
00047 
00048   UpdateGlobalManager();
00049   
00050   TGeoVolume* vol = this -> GetVolume();
00051   Int_t nmodule = vol -> GetNdaughters();
00052   for ( int imdl = 0; imdl < nmodule; imdl++ ) {
00053     GeoScintMdlNode* mdlNode = dynamic_cast<GeoScintMdlNode*>
00054                                (vol -> GetNode(imdl));
00055     if ( mdlNode ) {
00056       GeoStripNode* stpNode = mdlNode -> GetStripNode(seid);
00057       if ( stpNode ) return stpNode;
00058     }
00059   }
00060 
00061   MSG("Geo",Msg::kWarning) << "GetStripNode for plane " 
00062        << GetPlexPlaneId().AsString() << " failed to find strip " 
00063        << seid.AsString() << "." << endl;
00064   
00065   return 0;
00066   
00067 }
00068 
00069 //_____________________________________________________________________________
00070 Float_t GeoScintPlnNode::GetZRotRelSteelRad() const {
00071   // Return zrot relative to steel
00072 
00073   UpdateGlobalManager();
00074   
00075   const Double_t* rotmatrix = GetMatrix() -> GetRotationMatrix();
00076   Float_t zrotrelsteelrad = TMath::ATan2(rotmatrix[3],rotmatrix[0]);
00077   
00078   return zrotrelsteelrad;
00079   
00080 }
00081 
00082 //_____________________________________________________________________________
00083 Float_t GeoScintPlnNode::GetX0RelSteel() const {
00084   // Return the x pos relative to steel (x-coord from translation matrix)
00085 
00086   UpdateGlobalManager();
00087   
00088   const Double_t* trans = GetMatrix() -> GetTranslation();
00089   
00090   return trans[0];
00091   
00092 }
00093 
00094 //_____________________________________________________________________________
00095 Float_t GeoScintPlnNode::GetY0RelSteel() const {
00096   // Return the y pos relative to steel (y-coord from translation matrix)
00097 
00098   UpdateGlobalManager();
00099 
00100   const Double_t* trans = GetMatrix() -> GetTranslation();
00101   
00102   return trans[1];
00103   
00104 }
00105 
00106 //_____________________________________________________________________________
00107 Int_t GeoScintPlnNode::NumberOfStrips() const {
00108   // Return total number of strips in plane
00109 
00110   UpdateGlobalManager();
00111   
00112   // Should cache this data once calculated
00113   return (GetScintPlnVolume() -> NumberOfStrips());
00114   
00115 }
00116 
00117 //_____________________________________________________________________________
00118 Int_t GeoScintPlnNode::NumberOfModules() const {
00119   // Return total number of strips in plane
00120 
00121   UpdateGlobalManager();
00122   
00123   // Should cache this data once calculated
00124   return (GetScintPlnVolume() -> NumberOfModules());
00125   
00126 }
00127 
00128 //_____________________________________________________________________________
00129 vector<GeoStripNode*> GeoScintPlnNode::GetStripNodePtrVector() const {
00130   // Return vector of GeoStripNode's in this plane
00131 
00132   UpdateGlobalManager();
00133   
00134   return (GetScintPlnVolume()->GetStripNodePtrVector());
00135   
00136 }
00137 
00138 //_____________________________________________________________________________
00139 vector<GeoScintMdlNode*> GeoScintPlnNode::GetScintMdlNodePtrVector() const {
00140   // Return vector of GeoScintMdlNode's in this plane
00141 
00142   UpdateGlobalManager();
00143   
00144   return (GetScintPlnVolume()->GetScintMdlNodePtrVector());
00145   
00146 }
00147 
00148 //_____________________________________________________________________________
00149 void GeoScintPlnNode::SetZRotRelSteelRad(Float_t /* radians */) {
00150   // Dummy
00151 
00152   UpdateGlobalManager();
00153   
00154   MSG("Geo",Msg::kWarning) 
00155    << "GeoScintPlnNode::SetZRotRelSteelRad not implemented yet." << endl;
00156   return;
00157   
00158 }
00159 
00160 //_____________________________________________________________________________
00161 void GeoScintPlnNode::SetXY0RelSteel(Float_t /* x0 */, Float_t /* y0 */) {
00162   // Dummy
00163 
00164   UpdateGlobalManager();
00165   
00166   MSG("Geo",Msg::kWarning) 
00167     << "GeoScintPlnNode::SetXY0RelSteel not implemented yet." << endl;
00168   return;
00169   
00170 }
00171 
00172 
00173 //_____________________________________________________________________________
00174 GeoStripNode* GeoScintPlnNode::GetClosestStrip(Float_t tpos,
00175                                                Float_t orthCoord) const {
00176   // Return the node of the strip in the plane with a position
00177   // closest to "tpos", orthCoord is position in orthogonal coordinate
00178 
00179   UpdateGlobalManager();
00180 
00181   vector<GeoStripNode*> stripNodes = this -> GetStripNodePtrVector();
00182   GeoStripNode* closestNode = 0;
00183   Float_t closestDtpos = 999999.;
00184   
00185   for ( unsigned int i = 0; i < stripNodes.size(); ++i ) {
00186     Float_t strip_tpos = stripNodes[i] -> GetTPos(orthCoord);
00187     Float_t dtpos = TMath::Abs(strip_tpos-tpos);
00188     if ( dtpos < closestDtpos ) {
00189       closestNode = stripNodes[i];
00190       closestDtpos = dtpos;
00191     }
00192     else if ( closestNode != 0 ) {
00193       // Moving away from closet node
00194       return closestNode;
00195     }
00196   }
00197   
00198   return closestNode;
00199   
00200 }
00201 
00202 
00203 
00204 

Generated on Mon Feb 15 11:06:45 2010 for loon by  doxygen 1.3.9.1