Looping and Nodes and Shapes

From: Michael Katz-Hyman (michaelk@jlab.org)
Date: Wed Jul 07 1999 - 15:50:23 MEST


Everyone,

I am now in the process of taking our old detector geometry (4,000 lines
of code) and trying to convert that into loops.  The problem is twofold.
One, is it neccesary to have a unique name and title for everyshape? And
two, is there a way to easily create shapes in loops.

For example.

this is what I have now:


Basically, if each object must have a unique name, I am creating a char
*name[4] with a naming convention that was used in the old event display.
I then store all these abjects in an array, this is not very effecient and
you can probably tell that when i get to the wire chambers 114 wires per
plane, 4 planes per chamber, 2 chambers.  You can see that my arrays will
get quite large.  Then when I have to put these objects into nodes, it
gets even more confusing, is there an easier way?

Michael Katz-Hyman

// Start Code

for (int c = 1; c <= 2; ++c) {
  for (int p = 1; p <= 2; ++p) {
    for (int t = 1; t <= 4; ++t) {
      if (t == 1) { int ty = 88; };
      if (t == 2) { int ty = 89; };
      if (t == 3) { int ty = 85; };
      if (t == 4) { int ty = 86; };
      char *name[4] = strncat("W",
			      strncat(char(64 + c),
				      strncat(char(64 + p),
					      char(ty),
					      1),
				      2)
			      3);
      
      names[c][p][t] = new TBRIK(name,name,"mat15",57.01437,26.00655,0.8999996);
    }
  }
}

// End Code



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:35 MET