/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/MdcTrkRecon/MdcTrkRecon-00-03-45/src/MdcPlotHits.cxx

Go to the documentation of this file.
00001 // MdcPlotHits.cc
00002 // 
00003 #ifdef MDCDISPLAY
00004 
00005 //#include "BaBar/BaBar.h"
00006 #include <stdlib.h>
00007 #include "MdcTrkRecon/MdcPlotHits.h"
00008 #include "MdcData/MdcHitOnTrack.h"
00009 #ifdef MDCDISPLAY
00010 #include "MdcOldGraphics/MdcDisplay.h"
00011 #endif
00012 #include "MdcTrkRecon/dchGlobal.h"
00013 #include "MdcData/MdcHit.h"
00014 #include "MdcData/MdcHitOnTrack.h"
00015 #include "CLHEP/Alist/AIterator.h"
00016 using std::cerr;
00017 using std::endl;
00018 
00019 int MdcPlotHits::axialColor = 1;
00020 int MdcPlotHits::posStereoColor = 1;
00021 int MdcPlotHits::negStereoColor = 1;
00022 
00023 MdcPlotHits::MdcPlotHits() {
00024 }
00025 
00026 //**********************************************************************
00027 void MdcPlotHits::plotHits(const HepAList<TrkHitOnTrk> &hits, double tbunch, 
00028                            int incolor) const {
00029 //**********************************************************************
00030 
00031   int mycolor = 0;
00032   for (int ihit = 0; ihit < (int) hits.length(); ihit++) {
00033     const MdcHitOnTrack *dclink = hits[ihit]->dchHitOnTrack();
00034     if (dclink == 0) continue;
00035     MdcHit *ahit = dclink->dchHit();
00036     if (ahit == 0) continue;
00037     int generAmbig = 0;
00038     int foundAmbig = dclink->ambig();
00039     //    if (ahit->mcDrift() > 0.) generAmbig = 1;
00040     //    else if (ahit->mcDrift() < 0.) generAmbig = -1;
00041     if (dclink->isActive() == 0) { // Switch to lighter colors for inactive hits
00042       mycolor = 7;
00043     }
00044     //    else if ( foundAmbig!= generAmbig && 
00045     //       generAmbig != 0) mycolor = 12;
00046 
00047     else mycolor = incolor;
00048     this->plotAHit(ahit, tbunch, 1, mycolor, dclink->timeIndex());
00049   }
00050   
00051   return;
00052 }
00053 
00054 //**********************************************************************
00055 void MdcPlotHits::plotAHit(const MdcHit *hit, double tbunch, int mode, 
00056                            int incolor, int tIndex) const {
00057 //**********************************************************************
00058   // incolor = +int -- use that color
00059   // incolor = -1   -- use default colors 
00060   // mode = -1 -- use natural mode
00061   // mode = +int -- use that mode
00062   // tIndex -- which time to use in the hit
00063 
00064   // Declare variables.
00065   float radius;
00066   int color;
00067   double driftmin = 0.002;
00068      //driftmin = floor for drift values -- prevents mode 1 from losing hits
00069 
00070   // Set the color for the hit.
00071   if (incolor >= 0) 
00072     {color = incolor;}
00073   else 
00074     {
00075       if (hit->layer()->view() > 0) 
00076         {color = posStereoColor;}
00077       else 
00078         {
00079           if (hit->layer()->view() < 0.0) 
00080             {color = negStereoColor;}
00081           else
00082             {color = axialColor;} 
00083         }
00084     }
00085   display->setlcolor(color);
00086 
00087 
00088   if (mode<0) {mode = display->hitMode(windowXY);}
00089   switch(mode) 
00090     {
00091     case 1:
00092       // Decide drift distance.      
00093       radius = (hit->driftDist(tbunch, tIndex) > driftmin) ? 
00094         hit->driftDist(tbunch, tIndex) : 
00095         driftmin; 
00096       display->arc(radius, hit->x() , hit->y() , 1., 1.);   // Draw the circle.
00097       break;
00098     case 2:
00099       display->arc(0.75, hit->x() , hit->y() , 1., 1.);
00100       break;
00101     default:
00102       cerr<<"Unknown mode."<<endl;
00103       break;
00104     }
00105 
00106 }
00107 //**********************************************************************
00108 void MdcPlotHits::plotinfo(const MdcHit *hit, double scale, double tbunch) 
00109   const {
00110 //**********************************************************************
00111   char *string[5];
00112   int i;
00113   for (i = 0; i < 5; i++) {
00114     string[i] = new char[20];
00115   }
00116 
00117   sprintf(string[4],"%d",hit->layernumber() ); 
00118   sprintf(string[3],"%d",hit->wire() ); 
00119   sprintf(string[2],"%d",hit->mcTrack() ); 
00120   sprintf(string[1],"%6.2f",10.*hit->driftDist(tbunch, 0) );
00121   sprintf(string[0],"%6.2f",0.); // dummy 
00122 
00123   display->info(windowXY, hit->x(), hit->y(), string, scale, 0);
00124 
00125   for (i = 0; i < 5; i++) {
00126     delete string[i];
00127   }
00128 
00129 }
00130 #endif
00131 
00132 
00133 
00134 
00135 
00136 

Generated on Tue Nov 29 23:13:34 2016 for BOSS_7.0.2 by  doxygen 1.4.7