int phcset(char *clf,int col = 1) { // Macro phcset.C: This macro operates upon the TGeometry class // phobos (which must have been loaded) to set visible and of // color number col all nodes beginning with the two characters // clf; for example "SN", 6 will show one spectrometer arm sensitive // silicon in purple. There are also two special cases, U* and E*. // DMcL 1/Sep/97 // Declarations (PhNode, phobos are in scope from calling routines) TList *phList; TIterator *phIter; Text_t *phName; Bool_t phFlag; // Set up to iterate over all the phobos geometry nodes phNode = phobos->GetNode("OUTS1"); //Top node, reference frame phFlag = 0; // Need list at lower "tree" level... top level gives OUTS1 only phList = phNode->GetListOfNodes(); phIter = phList->MakeIterator(); // get the first node under OUTS1 phNode = (TNode *) phIter->Next(); // Cycle through nodes, which all depend on OUTS1 while (phNode) // generally, set attributes according to node name { phName = phNode->GetName(); // Carry out all operations on all individual nodes: // This is the usual match of the first two characters if (strncmp(phName,clf,2) == 0) { phNode->SetVisibility(1); phNode->SetLineColor(col); } // But we have two special cases, U* and E*: // U* denotes all starting with U except UP, UN if (strncmp(clf,"U*",2) == 0) { if((strncmp(phName,"U",1) == 0) && (strncmp(phName,"UP",2) != 0) && (strncmp(phName,"UN",2) != 0)) { phNode->SetVisibility(1); phNode->SetLineColor(col); } } // E* is for electronics boxes if (strncmp(clf,"E*",2) == 0) { if(strncmp(phName,"E",1) == 0) { phNode->SetVisibility(1); phNode->SetLineColor(col); } } // End of operations on nodes; handle looping with subtrees. // Here we had to add some complication, hard-coded to the PMC // phobos geometry i.e. it is organized in a three level tree // according to convenience in defining rotations, unrelated to // the component's (node's) function. if(phNode->IsFolder()) //Contains nodes also (only one more level) { phFlag = 1; // set condition and initialize subtree loop TList *phsList; TIterator *phsIter; phsList = phNode->GetListOfNodes(); phsIter = phsList->MakeIterator(); } // Alternative if we are in a subtree if(phFlag == 1) { phNode = (TNode *) phsIter->Next(); if (!phNode) { phFlag = 0; delete phsIter; } } if (phFlag == 0) {phNode = (TNode *) phIter->Next();} } delete phIter; c1->cd(); }