00001
00002
00003
00004
00005
00006
00007
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
00027
00028
00029 }
00030
00031 GeoScintPlnNode::~GeoScintPlnNode() {
00032
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
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
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
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
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
00109
00110 UpdateGlobalManager();
00111
00112
00113 return (GetScintPlnVolume() -> NumberOfStrips());
00114
00115 }
00116
00117
00118 Int_t GeoScintPlnNode::NumberOfModules() const {
00119
00120
00121 UpdateGlobalManager();
00122
00123
00124 return (GetScintPlnVolume() -> NumberOfModules());
00125
00126 }
00127
00128
00129 vector<GeoStripNode*> GeoScintPlnNode::GetStripNodePtrVector() const {
00130
00131
00132 UpdateGlobalManager();
00133
00134 return (GetScintPlnVolume()->GetStripNodePtrVector());
00135
00136 }
00137
00138
00139 vector<GeoScintMdlNode*> GeoScintPlnNode::GetScintMdlNodePtrVector() const {
00140
00141
00142 UpdateGlobalManager();
00143
00144 return (GetScintPlnVolume()->GetScintMdlNodePtrVector());
00145
00146 }
00147
00148
00149 void GeoScintPlnNode::SetZRotRelSteelRad(Float_t ) {
00150
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 , Float_t ) {
00162
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
00177
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
00194 return closestNode;
00195 }
00196 }
00197
00198 return closestNode;
00199
00200 }
00201
00202
00203
00204