#include <G3Node.h>
Public Member Functions | |
| G3Node () | |
| G3Node (const char *name, const char *title, const char *shapename, Double_t x=0, Double_t y=0, Double_t z=0, const char *matrixname="", Option_t *option="") | |
| G3Node (const char *name, const char *title, TShape *shape, Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0, Option_t *option="") | |
| G3Node (const G3Node &node, G3Node *parent) | |
| virtual | ~G3Node () |
| virtual void | SetDivision (Int_t ndiv, Int_t axis, Float_t start, Float_t step) |
| virtual void | ExpandDivisions () |
| virtual Int_t | Axis () const |
| virtual Int_t | Ndiv () const |
| virtual Float_t | Step () const |
| virtual Float_t | StartC () const |
| virtual void | AddSons (TList *list) |
| virtual void | AddSon (G3Node *node) |
Private Member Functions | |
| G3Node & | operator= (const G3Node &) |
Private Attributes | |
| Int_t | fAxis |
| Int_t | fNDivision |
| Float_t | fStep |
| Float_t | fStartC |
|
|
Definition at line 13 of file G3Node.h. Referenced by AddSons(), and ExpandDivisions(). 00013 {}
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 54 of file G3Node.cxx. 00056 :
00057 TNode(name, title, shapename, x, y, z, matrixname, option)
00058 {
00059 fNDivision = -1;
00060 fAxis = 0;
00061 fStartC = 0.;
00062 fStep = 0.;
00063 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 65 of file G3Node.cxx. References fAxis, fNDivision, fStartC, fStep, and option. 00067 :
00068 TNode(name, title, shape, x, y, z, matrix, option)
00069 {
00070 fNDivision = -1;
00071 fAxis = 0;
00072 fStartC = 0.;
00073 fStep = 0.;
00074 }
|
|
||||||||||||
|
Definition at line 400 of file G3Node.cxx. References Axis(), fAxis, fNDivision, fStartC, fStep, Ndiv(), StartC(), and Step(). 00401 {
00402 fNDivision = node.Ndiv();
00403 fAxis = node.Axis();
00404 fStartC = node.StartC();
00405 fStep = node.Step();
00406 fName = node.GetName();
00407 fTitle = node.GetTitle();
00408 fX = node.GetX();
00409 fY = node.GetY();
00410 fZ = node.GetZ();
00411 fMatrix = node.GetMatrix();
00412 fNodes = 0;
00413 fParent = parent;
00414
00415
00416 if (fNDivision > 0) {
00417 fShape = new TShape(*node.GetShape());
00418 } else {
00419 fShape = (TShape*) node.GetShape()->Clone();
00420 }
00421
00422
00423 // fShape = (TShape*) shape->Clone();
00424 /*
00425 char tmp[4];
00426 strcpy(tmp, shape->ClassName());
00427
00428 if (strcmp(tmp, "TTUBE")==0)
00429 fShape = (TTUBE*)shape->Clone();
00430 else if (strcmp(tmp, "TBRIK")==0)
00431 fShape = (TBRIK*)shape->Clone();
00432 else if (strcmp(tmp, "TCONE")==0)
00433 fShape = (TCONE*)shape->Clone();
00434 else if (strcmp(tmp, "TCONS")==0)
00435 fShape = (TCONS*)shape->Clone();
00436 else if (strcmp(tmp, "TTUBS")==0)
00437 fShape = (TTUBS*)shape->Clone();
00438 else if (strcmp(tmp, "TTRAP")==0)
00439 fShape = (TTRAP*)shape->Clone();
00440 else if (strcmp(tmp, "TTRD1")==0)
00441 fShape = (TTRD1*)shape->Clone();
00442 else if (strcmp(tmp, "TTRD2")==0)
00443 fShape = (TTRD2*)shape->Clone();
00444 else if (strcmp(tmp, "TSPHE")==0)
00445 fShape = (TSPHE*)shape->Clone();
00446 else if (strcmp(tmp, "TPGON")==0)
00447 fShape = (TPGON*)shape->Clone();
00448 else if (strcmp(tmp, "TPCON")==0)
00449 fShape = (TPCON*)shape->Clone();
00450 */
00451 }
|
|
|
Definition at line 23 of file G3Node.h. 00023 {}
|
|
|
Definition at line 453 of file G3Node.cxx. 00454 {
00455 fNodes->Add(node);
00456 }
|
|
|
Definition at line 383 of file G3Node.cxx. References G3Node(). Referenced by ExpandDivisions(). 00384 {
00385 if (!list) return;
00386 if (!fNodes) fNodes = new TList();
00387
00388 TIter next(list);
00389 G3Node* node;
00390
00391 while((node = (G3Node*)next())) {
00392 G3Node* newNode = new G3Node(*node, this);
00393 fNodes->Add(newNode);
00394 newNode->SetParent(this);
00395 newNode->AddSons(node->GetListOfNodes());
00396 }
00397 }
|
|
|
Definition at line 27 of file G3Node.h. Referenced by G3Node(). 00027 {return fAxis;}
|
|
|
Definition at line 84 of file G3Node.cxx. References AddSons(), fAxis, fNDivision, G3Node(), and Nav::GetName(). 00085 {
00086 Int_t i;
00087 char vName[20];
00088 char nName[20];
00089
00090 char tmp[4];
00091 G3Node* node;
00092 TShape* parent = fParent->GetShape();
00093 TShape* newsh;
00094
00095 strcpy(tmp, parent->GetTitle());
00096 Int_t ndiv = fNDivision;
00097
00098 // TUBE
00099
00100 if (strcmp(tmp, "TUBE")==0) {
00101 TTUBE * shape = (TTUBE*) parent;
00102
00103 Float_t dZ = shape->GetDz();
00104 Float_t rMin = shape->GetRmin();
00105 Float_t rMax = shape->GetRmax();
00106
00107 if (fAxis == 1) {
00108 // radial-division
00109 Float_t dr = (rMax-rMin)/Float_t(fNDivision);
00110 Float_t r1, r2;
00111 for (i=0; i<ndiv; i++) {
00112 r1 = rMin+Float_t(i)*dr;
00113 r2 = r1+dr;
00114 sprintf(vName, "%sD%d", fShape->GetName(), i);
00115 sprintf(nName, "%sD%d", GetName(), i);
00116 newsh = new TTUBE(vName, "TUBE", "void", r1, r2, dZ);
00117 fParent->cd();
00118 node = new G3Node(nName,"", newsh, 0., 0., 0.);
00119 node->AddSons(fNodes);
00120 cd();
00121 }
00122
00123 } else if (fAxis == 2) {
00124 // phi-division
00125 Float_t dPhi = 360./Float_t(fNDivision);
00126 Float_t phi1, phi2;
00127 for (i=0; i<ndiv; i++) {
00128 phi1 = Float_t(i)*dPhi;
00129 phi2 = phi1+dPhi;
00130 sprintf(vName, "%sD%d", fShape->GetName(), i);
00131 sprintf(nName, "%sD%d", GetName(), i);
00132 newsh = new TTUBS(vName, "TUBS", "void", rMin, rMax, dZ, phi1, phi2);
00133 fParent->cd();
00134 node = new G3Node(nName, "", newsh, 0., 0., 0.);
00135 node->AddSons(fNodes);
00136 cd();
00137 }
00138 } else {
00139 // z-division
00140 Float_t delZ = dZ/Float_t(fNDivision);
00141 for (i=0; i<ndiv; i++) {
00142 sprintf(vName, "%sD%d", fShape->GetName(), i);
00143 sprintf(nName, "%sD%d", GetName(), i);
00144 newsh = new TTUBE(vName, "TUBE", "void", rMin, rMax, delZ);
00145 fParent->cd();
00146 Float_t zpos = -dZ+delZ*(2.*Float_t(i)+1.);
00147 node = new G3Node(nName, "",newsh, 0., 0., zpos);
00148 node->AddSons(fNodes);
00149 cd();
00150 }
00151 }
00152 //
00153 // TUBS
00154 //
00155 } else if (strcmp(tmp, "TUBS")==0) {
00156 TTUBS * shape = (TTUBS*) parent;
00157 Float_t dZ = shape->GetDz();
00158 Float_t rMin = shape->GetRmin();
00159 Float_t rMax = shape->GetRmax();
00160 Float_t phi1 = shape->GetPhi1();
00161 Float_t phi2 = shape->GetPhi2();
00162
00163 if (fAxis == 1) {
00164 // radial-division
00165 Float_t dr = (rMax-rMin)/Float_t(fNDivision);
00166 Float_t r1, r2;
00167 Int_t ndiv = fNDivision;
00168 for (i=0; i<ndiv; i++) {
00169 r1 = rMin+Float_t(i)*dr;
00170 r2 = r1+dr;
00171 sprintf(vName, "%sD%d", fShape->GetName(), i);
00172 sprintf(nName, "%sD%d", GetName(), i);
00173 newsh = new TTUBS(vName, "TUBS", "void", r1, r2, dZ, phi1, phi2);
00174 fParent->cd();
00175 node = new G3Node(nName,"", newsh, 0., 0., 0.);
00176 node->AddSons(fNodes);
00177 cd();
00178 }
00179
00180 } else if (fAxis == 2) {
00181 // phi-division
00182 Float_t dPhi = (phi2-phi1)/Float_t(fNDivision);
00183 Float_t nphi1, nphi2;
00184
00185 for (i=0; i<fNDivision; i++) {
00186 nphi1 = phi1+Float_t(i)*dPhi;
00187 nphi2 = nphi1+dPhi;
00188 sprintf(vName, "%sD%d", fShape->GetName(), i);
00189 sprintf(nName, "%sD%d", GetName(), i);
00190
00191 newsh = new TTUBS(vName, "TUBS", "void", rMin, rMax, dZ, nphi1, nphi2);
00192 fParent->cd();
00193 node = new G3Node(nName, "", newsh, 0., 0., 0.);
00194 node->AddSons(fNodes);
00195 cd();
00196 }
00197 } else {
00198 // z-division
00199 Float_t delZ = dZ/Float_t(fNDivision);
00200 for (i=0; i<ndiv; i++) {
00201 sprintf(vName, "%sD%d", fShape->GetName(), i);
00202 sprintf(nName, "%sD%d", GetName(), i);
00203 newsh = new TTUBS(vName, "TUBS", "void", rMin, rMax, delZ, phi1, phi2);
00204 fParent->cd();
00205 Float_t zpos = -dZ+delZ*(2.*Float_t(i)+1.);
00206 node = new G3Node(nName, "",newsh, 0., 0., zpos);
00207 node->AddSons(fNodes);
00208 cd();
00209 }
00210 }
00211
00212 } else if (strcmp(tmp, "CONE")==0) {
00213 TCONE * shape = (TCONE*) parent;
00214
00215 Float_t dZ = shape->GetDz();
00216 Float_t rMin1 = shape->GetRmin();
00217 Float_t rMax1 = shape->GetRmax();
00218 Float_t rMin2 = shape->GetRmin2();
00219 Float_t rMax2 = shape->GetRmax2();
00220
00221 if (fAxis == 1) {
00222 // radial-division
00223 Float_t dr1 = (rMax1-rMin1)/Float_t(fNDivision);
00224 Float_t dr2 = (rMax2-rMin2)/Float_t(fNDivision);
00225 Float_t r11, r12, r21, r22;
00226 for (i=0; i<ndiv; i++) {
00227 r11 = rMin1+Float_t(i)*dr1;
00228 r12 = r11+dr1;
00229 r21 = rMin2+Float_t(i)*dr2;
00230 r22 = r21+dr2;
00231
00232 sprintf(vName, "%sD%d", fShape->GetName(), i);
00233 sprintf(nName, "%sD%d", GetName(), i);
00234 newsh = new TCONE(vName, "CONE", "void", dZ, r11, r12, r21, r22);
00235 fParent->cd();
00236 node = new G3Node(nName,"", newsh, 0., 0., 0.);
00237 node->AddSons(fNodes);
00238 cd();
00239 }
00240 } else if (fAxis == 2) {
00241 // phi-division
00242 Float_t dPhi = 360./Float_t(fNDivision);
00243 Float_t phi1, phi2;
00244 for (i=0; i<ndiv; i++) {
00245 phi1 = Float_t(i)*dPhi;
00246 phi2 = phi1+dPhi;
00247 sprintf(vName, "%sD%d", fShape->GetName(), i);
00248 sprintf(nName, "%sD%d", GetName(), i);
00249 newsh = new TCONS(vName, "CONS", "void", dZ, rMin1, rMax1,
00250 rMin2, rMax2, phi1, phi2);
00251 fParent->cd();
00252 node = new G3Node(nName, "",newsh, 0., 0., 0.);
00253 node->AddSons(fNodes);
00254 cd();
00255 }
00256 } else {
00257 // z-division
00258 Float_t delZ = dZ/Float_t(fNDivision);
00259 for (i=0; i<ndiv; i++) {
00260 sprintf(vName, "%sD%d", fShape->GetName(), i);
00261 sprintf(nName, "%sD%d", GetName(), i);
00262 newsh = new TCONE(vName, "CONE", "void", delZ, rMin1, rMax1, rMin2, rMax2);
00263 fParent->cd();
00264 Float_t zpos = -dZ+delZ*(2.*Float_t(i)+1.);
00265 node = new G3Node(nName, "",newsh, 0., 0., zpos);
00266 node->AddSons(fNodes);
00267 cd();
00268 }
00269 }
00270
00271 } else if (strcmp(tmp, "CONS")==0) {
00272 TCONS * shape = (TCONS*) parent;
00273 Float_t dZ = shape->GetDz();
00274 Float_t rMin1 = shape->GetRmin();
00275 Float_t rMax1 = shape->GetRmax();
00276 Float_t rMin2 = shape->GetRmin2();
00277 Float_t rMax2 = shape->GetRmax2();
00278 Float_t phi1 = shape->GetPhi1();
00279 Float_t phi2 = shape->GetPhi2();
00280 if (fAxis == 1) {
00281 // radial-division
00282 Float_t dr1 = (rMax1-rMin1)/Float_t(fNDivision);
00283 Float_t dr2 = (rMax2-rMin2)/Float_t(fNDivision);
00284 Float_t r11, r12, r21, r22;
00285 for (i=0; i<ndiv; i++) {
00286 r11 = rMin1+Float_t(i)*dr1;
00287 r12 = r11+dr1;
00288 r21 = rMin2+Float_t(i)*dr2;
00289 r22 = r21+dr2;
00290
00291 sprintf(vName, "%sD%d", fShape->GetName(), i);
00292 sprintf(nName, "%sD%d", GetName(), i);
00293 newsh = new TCONS(vName, "CONS", "void", dZ, r11, r12, r21, r22, phi1, phi2);
00294 fParent->cd();
00295 node = new G3Node(nName,"", newsh, 0., 0., 0.);
00296 node->AddSons(fNodes);
00297 cd();
00298 }
00299
00300 } else if (fAxis == 2) {
00301 // phi-division
00302 Float_t dPhi = (phi2-phi1)/Float_t(fNDivision);
00303 Float_t nphi1, nphi2;
00304
00305 for (i=0; i<fNDivision; i++) {
00306 nphi1 = phi1+Float_t(i)*dPhi;
00307 nphi2 = nphi1+dPhi;
00308 sprintf(vName, "%sD%d", fShape->GetName(), i);
00309 sprintf(nName, "%sD%d", GetName(), i);
00310
00311 newsh = new TCONS(vName, "CONS", "void", dZ, rMin1, rMax1, rMin2, rMax2, nphi1, nphi2);
00312 fParent->cd();
00313 node = new G3Node(nName, "", newsh, 0., 0., 0.);
00314 node->AddSons(fNodes);
00315 cd();
00316 }
00317 } else {
00318 // z-division
00319 Float_t delZ = dZ/Float_t(fNDivision);
00320 for (i=0; i<ndiv; i++) {
00321 sprintf(vName, "%sD%d", fShape->GetName(), i);
00322 sprintf(nName, "%sD%d", GetName(), i);
00323 newsh = new TCONS(vName, "CONS", "void", delZ, rMin1, rMax1, rMin2, rMax2, phi1, phi2);
00324 fParent->cd();
00325 Float_t zpos = -dZ+delZ*(2.*Float_t(i)+1.);
00326 node = new G3Node(nName,"",newsh, 0., 0., zpos);
00327 node->AddSons(fNodes);
00328 cd();
00329 }
00330 }
00331 } else if (strcmp(tmp, "BRIK")==0) {
00332 //
00333 // BRIK
00334 //
00335 TBRIK * shape = (TBRIK*) parent;
00336 Float_t dX = shape->GetDx();
00337 Float_t dY = shape->GetDy();
00338 Float_t dZ = shape->GetDz();
00339
00340 if (fAxis == 1) {
00341 // division in x
00342 Float_t delX = dX/Float_t(fNDivision);
00343 for (i=0; i<ndiv; i++) {
00344 sprintf(vName, "%sD%d", fShape->GetName(), i);
00345 sprintf(nName, "%sD%d", GetName(), i);
00346 newsh = new TBRIK(vName, "BRIK", "void", delX, dY, dZ);
00347 fParent->cd();
00348 Float_t xpos = -dX+delX*(2.*Float_t(i)+1.);
00349 node = new G3Node(nName,"",newsh, xpos, 0., 0.);
00350 node->AddSons(fNodes);
00351 cd();
00352 }
00353 } else if (fAxis == 2) {
00354 // division in y
00355 Float_t delY = dY/Float_t(fNDivision);
00356 for (i=0; i<ndiv; i++) {
00357 sprintf(vName, "%sD%d", fShape->GetName(), i);
00358 sprintf(nName, "%sD%d", GetName(), i);
00359 newsh = new TBRIK(vName, "BRIK", "void", dX, delY, dZ);
00360 fParent->cd();
00361 Float_t ypos = -dY+delY*(2.*Float_t(i)+1.);
00362 node = new G3Node(nName,"",newsh, 0., ypos, 0.);
00363 node->AddSons(fNodes);
00364 cd();
00365 }
00366 } else {
00367 // division in z
00368 Float_t delZ = dZ/Float_t(fNDivision);
00369 for (i=0; i<ndiv; i++) {
00370 sprintf(vName, "%sD%d", fShape->GetName(), i);
00371 sprintf(nName, "%sD%d", GetName(), i);
00372 newsh = new TBRIK(vName, "BRIK", "void", dX, dY, delZ);
00373 fParent->cd();
00374 Float_t zpos = -dZ+delZ*(2.*Float_t(i)+1.);
00375 node = new G3Node(nName,"",newsh, 0., 0., zpos);
00376 node->AddSons(fNodes);
00377 cd();
00378 }
00379 }
00380 }
00381 }
|
|
|
Definition at line 28 of file G3Node.h. Referenced by G3Node(). 00028 {return fNDivision;}
|
|
|
Definition at line 42 of file G3Node.h. 00042 {return *this;}
|
|
||||||||||||||||||||
|
Definition at line 76 of file G3Node.cxx. References fAxis, fNDivision, fStartC, and fStep. 00077 {
00078 fNDivision = ndiv;
00079 fAxis = axis;
00080 fStartC = start;
00081 fStep = step;
00082 }
|
|
|
Definition at line 30 of file G3Node.h. Referenced by G3Node(). 00030 {return fStartC;}
|
|
|
Definition at line 29 of file G3Node.h. Referenced by G3Node(). 00029 {return fStep;}
|
|
|
Definition at line 37 of file G3Node.h. Referenced by ExpandDivisions(), G3Node(), and SetDivision(). |
|
|
Definition at line 38 of file G3Node.h. Referenced by ExpandDivisions(), G3Node(), and SetDivision(). |
|
|
Definition at line 40 of file G3Node.h. Referenced by G3Node(), and SetDivision(). |
|
|
Definition at line 39 of file G3Node.h. Referenced by G3Node(), and SetDivision(). |
1.3.9.1