|
// $Id: BrBaseDetector.cxx,v 1.2 2002/02/26 08:58:06 cholm Exp $ // // $Log: BrBaseDetector.cxx,v $ // Revision 1.2 2002/02/26 08:58:06 cholm // Added const'ness to many methods - needed by ISO C++ // // Revision 1.1.1.1 2001/06/21 14:55:07 hagel // Initial revision of brat2 // // Revision 1.8 2000/09/18 21:27:19 videbaek // Changed neede for Internal modifications to // BrDetectorVolume. removed GetAngle from BaseDetector. // // Revision 1.7 2000/03/21 21:21:40 cholm // Several changes: A few hacks where needed to compile on Digital Unix, noticably in my - Christian Holm - classes for the DB and Exceptions. Proberly still need to do something to some of Konstantins stuff. Also, I removed a lot of warnings fromt the compiler, by teddying up the code. Several places, old C-style indecies in for loops were assumed. Corrected. Unused variables have been commented out. // // Revision 1.6 1999/04/01 22:44:13 videbaek // change include guards to conform to standard // // Revision 1.5 1999/02/25 15:01:39 videbaek // Add a memeber function Warning at the BrModule level. This has a buildin limit counter // such that Warning will not go on for all events. // The code is copied for the TObject::Warning. // // Revision 1.4 1999/01/15 15:32:31 videbaek // Updates to volume files. // Added member histon to BrModule, and member function HistOn(). // Added BrMath as standard math library. // // #include "BrBaseDetector.h" #if !defined BRAT_BrDetectorVolume #include "BrDetectorVolume.h" #endif #if !defined ROOT_TGeometry #include "TGeometry.h" #endif #if !defined ROOT_TBRIK #include "TBRIK.h" #endif #include <BrVector3D.h> #include <iostream.h> #include <iomanip.h> /////////////////////////////////////////////////////////// // // BrBaseDetector // // BRAHMS Base Detector Class // // This is a base detector class envisioned to be used for event // displays and the like. It might also be expanded for other uses. // // Author : K. Hagel // Created: 4-Nov-1998 // Version: 1.0 // /////////////////////////////////////////////////////////// ClassImp(BrBaseDetector) //____________________________________________________________________ BrBaseDetector::BrBaseDetector() { // Vanilla constructor; Should not be called within the ROOT environment. // } BrBaseDetector::BrBaseDetector(Text_t *name, Text_t *title,Text_t *shape,Float_t xx,Float_t yy,Float_t zz,Text_t *matrix,Option_t *opt) :TNode(name,title,shape,xx,yy,zz,matrix,opt) { fDebugLevel = 0; } BrBaseDetector::BrBaseDetector(Text_t *name, Text_t *title,TShape *shape,Float_t xx,Float_t yy,Float_t zz,TRotMatrix *matrix,Option_t *opt) :TNode(name,title,shape,xx,yy,zz,matrix,opt) { fDebugLevel = 0; } BrBaseDetector::BrBaseDetector(Text_t *name, Text_t *title,BrDetectorVolume *vol) { // // Constructor. This is the default constructor to use. // fDebugLevel = 0; CreateDefaultDetector(name,title,vol); BrVector3D pos = vol->GetPosition(); //this->TNode::TNode(name,title,fShape,pos[0],pos[1],pos[2],fMatrix,""); ExecuteTNodeConstructor(name,title,fShape,pos[0],pos[1],pos[2],fMatrix,""); fGHitColor = 4; } BrBaseDetector::~BrBaseDetector() { // // default destructor if(fMixture) delete fMixture; } void BrBaseDetector::CreateDefaultDetector(Text_t *name, Text_t *title, BrDetectorVolume *vol) { // Not used at the moment. // Float_t *pos; //This is essentially a placeholder for future use. Is it useful??? fMixture = new TMixture("mix31","Ne-CH4-CO2",4); fMixture->DefineElement(0,20.18,10,.8581148); fMixture->DefineElement(1,12.01,6,.0567446); fMixture->DefineElement(2,1.01,1,.0095441); fMixture->DefineElement(3,16,8,.0755965); // This would be a good place to use BrRotMatrix. But TNode is // expecting a TRotMatrix!!! // If one makes a BrNode to use BrRotMatrix without inheriting from // TNode, one loses all of the ROOT infrastructure having to do with // geometries. More thought needed!! const BrRotMatrix* bMatrix = vol->GetRotMatrix(); // Cheat code - just use theta, though we may have the other // Euler angles in place. Root TRotMatrix does not have the // Euler angle constructor. This is a problem. fv 9/16/00 // fMatrix = new TRotMatrix(name,title,0,0,0,0,bMatrix->GetTheta(),0); Float_t *size; size = vol->GetSize(); fShape = new TBRIK(name,title,title,size[0]/2.,size[1]/2.,size[2]/2.); } void BrBaseDetector::ExecuteTNodeConstructor(const Text_t *name, const Text_t *title, const Text_t *shapename, Double_t x, Double_t y, Double_t z, const Text_t *matrixname, Option_t *option) // :TNamed(name,title),TAttLine(), TAttFill() { //*-*-*-*-*-*-*-*-*-*-*Node normal constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-* //*-* ====================== //*-* //*-* name is the name of the node //*-* title is title //*-* shapename is the name of the referenced shape //*-* x,y,z are the offsets of the volume with respect to his mother //*-* matrixname is the name of the rotation matrix //*-* //*-* This new node is added into the list of sons of the current node //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* /* I had to put in these next two methods to execute the TNode constructor code at the end of my constructor that inherits from TNode. I have not figured out how to execute a constructor at the end of my constructor without causing other adverse effects. One possibility was to do this->TNode::TNode(.....) at the point where I am now executing ExecuteTNodeConstructor(....), but that appears to have messed other things up. If any C++ gurus reading this know how to do what I want to do, please contract me because I do not like how I am doing this */ #ifdef WIN32 //*-* The color "1" - default produces a very bad 3D image with OpenGL Color_t lcolor = 16; SetLineColor(lcolor); #endif static Int_t counter = 0; counter++; if(!(counter%1000))cout<<"TNode count="<<counter<<" name="<<name<<endl; fX = x; fY = y; fZ = z; fNodes = 0; fShape = gGeometry->GetShape(shapename); fParent = gGeometry->GetCurrentNode(); fOption = option; fVisibility = 1; if (strlen(matrixname)) fMatrix = gGeometry->GetRotMatrix(matrixname); else { fMatrix = gGeometry->GetRotMatrix("Identity"); if (!fMatrix) { new TRotMatrix("Identity","Identity matrix",90,0,90,90,0,0); fMatrix = gGeometry->GetRotMatrix("Identity"); } } if (!fShape) { Printf("Error Referenced shape does not exist: %s",shapename); return; } if (fParent) { fParent->BuildListOfNodes(); fParent->GetListOfNodes()->Add(this); ImportShapeAttributes(); } else { gGeometry->GetListOfNodes()->Add(this); cd(); } } //______________________________________________________________________________ void BrBaseDetector::ExecuteTNodeConstructor(const Text_t *name, const Text_t *title, TShape *shape, Double_t x, Double_t y, Double_t z, TRotMatrix *matrix, Option_t *option) // :TNamed(name,title),TAttLine(),TAttFill() { //*-*-*-*-*-*-*-*-*-*-*Node normal constructor*-*-*-*-*-*-*-*-*-*-* //*-* ================================ //*-* //*-* name is the name of the node //*-* title is title //*-* shape is the pointer to the shape definition //*-* x,y,z are the offsets of the volume with respect to his mother //*-* matrix is the pointer to the rotation matrix //*-* //*-* This new node is added into the list of sons of the current node //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* /* I had to put in these next two methods to execute the TNode constructor code at the end of my constructor that inherits from TNode. I have not figured out how to execute a constructor at the end of my constructor without causing other adverse effects. One possibility was to do this->TNode::TNode(.....) at the point where I am now executing ExecuteTNodeConstructor(....), but that appears to have messed other things up. If any C++ gurus reading this know how to do what I want to do, please contract me because I do not like how I am doing this */ #ifdef WIN32 //*-* The color "1" - default produces a very bad 3D image with OpenGL Color_t lcolor = 16; SetLineColor(lcolor); #endif SetName(name); SetTitle(title); fX = x; fY = y; fZ = z; fNodes = 0; fShape = shape; fMatrix = matrix; fOption = option; fVisibility = 1; fParent = gGeometry->GetCurrentNode(); if(!fMatrix) { fMatrix =gGeometry->GetRotMatrix("Identity"); if (!fMatrix) { new TRotMatrix("Identity","Identity matrix",90,0,90,90,0,0); fMatrix = gGeometry->GetRotMatrix("Identity"); } } if(!shape) {Printf("Illegal referenced shape"); return;} if (fParent) { fParent->BuildListOfNodes(); fParent->GetListOfNodes()->Add(this); ImportShapeAttributes(); } else { gGeometry->GetListOfNodes()->Add(this); cd(); } } |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|