Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

TkrClustersRep.cxx

Go to the documentation of this file.
00001 #include "TkrRecon/TkrClustersRep.h"
00002 
00003 
00004 //------------------------------------------------------------------------------
00005 //  Code to implement the TkrClustersRep class. 
00006 //  This class does the display of clusters in the Silicon
00007 //  Tracker. 
00008 //
00009 //#############################################################################
00010 //  Constructor for the class
00011 TkrClustersRep::TkrClustersRep(SiClusters** ppClus)
00012 //#############################################################################
00013 {
00014         //Store pointer to the pointer to the SiClusters data
00015         ppClusters = ppClus;
00016 }
00017 
00018 //##############################################
00019 //  Display routine for the class
00020 void TkrClustersRep::update()
00021 //##############################################
00022 {
00023         //Recover pointer to the data
00024     SiClusters* pClusters = *ppClusters;
00025 
00026     //Zero out the pointer so we don't accidentally try to redraw the event
00027     *ppClusters = 0;
00028 
00029         //Make sure pointer is valid before trying to draw anything
00030         if (pClusters)
00031         {
00032                 int    nHits      = pClusters->nHits();
00033                 double stripPitch = pClusters->stripPitch();
00034                 double towerPitch  = pClusters->towerPitch();
00035                 
00036                 setColor("green");
00037 
00038                 //Loop over all cluster hits in the SiClusters vector
00039                 while(nHits--)
00040                 {
00041                         SiCluster* pCluster = pClusters->getHit(nHits);
00042                         Point      clusPos  = pCluster->position();
00043         
00044                         double     x        = clusPos.x();
00045                         double     y        = clusPos.y();
00046                         double     z        = clusPos.z();
00047         
00048                         double     delta    =  0.6;
00049                         double     Offset   = -0.5 * towerPitch;
00050 
00051                         //Draw a cross at the position of the cluster center
00052                         if (pCluster->v() == SiCluster::X)
00053                         {
00054                 Offset += y;
00055                 moveTo(Point(x - delta, Offset, z - delta));
00056                                 lineTo(Point(x + delta, Offset, z + delta));
00057                                 moveTo(Point(x - delta, Offset, z + delta));
00058                                 lineTo(Point(x + delta, Offset, z - delta));
00059                         }
00060                         else
00061                         {
00062                 Offset += x;
00063                                 moveTo(Point(Offset, y - delta, z - delta));
00064                                 lineTo(Point(Offset, y + delta, z + delta));
00065                                 moveTo(Point(Offset, y - delta, z + delta));
00066                                 lineTo(Point(Offset, y + delta, z - delta));
00067                         }
00068 
00069                         //Now draw the width of the cluster (if more than one)
00070                         if (pCluster->size() > 1)
00071                         {
00072                                 double stripWid = 0.5 * pCluster->size() * stripPitch;
00073 
00074                                 if (pCluster->v() == SiCluster::X)
00075                                 {
00076                                         moveTo(Point(x - stripWid, Offset, z));
00077                                         lineTo(Point(x + stripWid, Offset, z));
00078                                 }
00079                                 else
00080                                 {
00081                                         moveTo(Point(Offset, y - stripWid, z));
00082                                         lineTo(Point(Offset, y + stripWid, z));
00083                                 }
00084                         }
00085                 }
00086         }
00087 
00088     return;
00089 }
00090 

Generated at Wed Nov 21 12:21:21 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000