BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcPlotHits.cxx
Go to the documentation of this file.
1// MdcPlotHits.cc
2//
3#ifdef MDCDISPLAY
4
5// #include "BaBar/BaBar.h"
6# include "MdcTrkRecon/MdcPlotHits.h"
7# include "MdcData/MdcHitOnTrack.h"
8# include <stdlib.h>
9# ifdef MDCDISPLAY
10# include "MdcOldGraphics/MdcDisplay.h"
11# endif
12# include "CLHEP/Alist/AIterator.h"
13# include "MdcData/MdcHit.h"
14# include "MdcData/MdcHitOnTrack.h"
15# include "MdcTrkRecon/dchGlobal.h"
16using std::cerr;
17using std::endl;
18
19int MdcPlotHits::axialColor = 1;
20int MdcPlotHits::posStereoColor = 1;
21int MdcPlotHits::negStereoColor = 1;
22
23MdcPlotHits::MdcPlotHits() {}
24
25//**********************************************************************
26void MdcPlotHits::plotHits( const HepAList<TrkHitOnTrk>& hits, double tbunch,
27 int incolor ) const {
28 //**********************************************************************
29
30 int mycolor = 0;
31 for ( int ihit = 0; ihit < (int)hits.length(); ihit++ )
32 {
33 const MdcHitOnTrack* dclink = hits[ihit]->dchHitOnTrack();
34 if ( dclink == 0 ) continue;
35 MdcHit* ahit = dclink->dchHit();
36 if ( ahit == 0 ) continue;
37 int generAmbig = 0;
38 int foundAmbig = dclink->ambig();
39 // if (ahit->mcDrift() > 0.) generAmbig = 1;
40 // else if (ahit->mcDrift() < 0.) generAmbig = -1;
41 if ( dclink->isActive() == 0 )
42 { // Switch to lighter colors for inactive hits
43 mycolor = 7;
44 }
45 // else if ( foundAmbig!= generAmbig &&
46 // generAmbig != 0) mycolor = 12;
47
48 else mycolor = incolor;
49 this->plotAHit( ahit, tbunch, 1, mycolor, dclink->timeIndex() );
50 }
51
52 return;
53}
54
55//**********************************************************************
56void MdcPlotHits::plotAHit( const MdcHit* hit, double tbunch, int mode, int incolor,
57 int tIndex ) const {
58 //**********************************************************************
59 // incolor = +int -- use that color
60 // incolor = -1 -- use default colors
61 // mode = -1 -- use natural mode
62 // mode = +int -- use that mode
63 // tIndex -- which time to use in the hit
64
65 // Declare variables.
66 float radius;
67 int color;
68 double driftmin = 0.002;
69 // driftmin = floor for drift values -- prevents mode 1 from losing hits
70
71 // Set the color for the hit.
72 if ( incolor >= 0 ) { color = incolor; }
73 else
74 {
75 if ( hit->layer()->view() > 0 ) { color = posStereoColor; }
76 else
77 {
78 if ( hit->layer()->view() < 0.0 ) { color = negStereoColor; }
79 else { color = axialColor; }
80 }
81 }
82 display->setlcolor( color );
83
84 if ( mode < 0 ) { mode = display->hitMode( windowXY ); }
85 switch ( mode )
86 {
87 case 1:
88 // Decide drift distance.
89 radius = ( hit->driftDist( tbunch, tIndex ) > driftmin ) ? hit->driftDist( tbunch, tIndex )
90 : driftmin;
91 display->arc( radius, hit->x(), hit->y(), 1., 1. ); // Draw the circle.
92 break;
93 case 2: display->arc( 0.75, hit->x(), hit->y(), 1., 1. ); break;
94 default: cerr << "Unknown mode." << endl; break;
95 }
96}
97//**********************************************************************
98void MdcPlotHits::plotinfo( const MdcHit* hit, double scale, double tbunch ) const {
99 //**********************************************************************
100 char* string[5];
101 int i;
102 for ( i = 0; i < 5; i++ ) { string[i] = new char[20]; }
103
104 sprintf( string[4], "%d", hit->layernumber() );
105 sprintf( string[3], "%d", hit->wire() );
106 sprintf( string[2], "%d", hit->mcTrack() );
107 sprintf( string[1], "%6.2f", 10. * hit->driftDist( tbunch, 0 ) );
108 sprintf( string[0], "%6.2f", 0. ); // dummy
109
110 display->info( windowXY, hit->x(), hit->y(), string, scale, 0 );
111
112 for ( i = 0; i < 5; i++ ) { delete string[i]; }
113}
114#endif
sprintf(cut, "kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_" "pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
double driftDist(double, int, double, double, double) const
Definition MdcHit.cxx:157