BOSS 7.1.1
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 <stdlib.h>
9#ifdef MDCDISPLAY
10#include "MdcOldGraphics/MdcDisplay.h"
11#endif
12#include "MdcTrkRecon/dchGlobal.h"
13#include "MdcData/MdcHit.h"
15#include "CLHEP/Alist/AIterator.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
26//**********************************************************************
27void MdcPlotHits::plotHits(const HepAList<TrkHitOnTrk> &hits, double tbunch,
28 int incolor) const {
29//**********************************************************************
30
31 int mycolor = 0;
32 for (int ihit = 0; ihit < (int) hits.length(); ihit++) {
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) { // Switch to lighter colors for inactive hits
42 mycolor = 7;
43 }
44 // else if ( foundAmbig!= generAmbig &&
45 // generAmbig != 0) mycolor = 12;
46
47 else mycolor = incolor;
48 this->plotAHit(ahit, tbunch, 1, mycolor, dclink->timeIndex());
49 }
50
51 return;
52}
53
54//**********************************************************************
55void MdcPlotHits::plotAHit(const MdcHit *hit, double tbunch, int mode,
56 int incolor, int tIndex) const {
57//**********************************************************************
58 // incolor = +int -- use that color
59 // incolor = -1 -- use default colors
60 // mode = -1 -- use natural mode
61 // mode = +int -- use that mode
62 // tIndex -- which time to use in the hit
63
64 // Declare variables.
65 float radius;
66 int color;
67 double driftmin = 0.002;
68 //driftmin = floor for drift values -- prevents mode 1 from losing hits
69
70 // Set the color for the hit.
71 if (incolor >= 0)
72 {color = incolor;}
73 else
74 {
75 if (hit->layer()->view() > 0)
76 {color = posStereoColor;}
77 else
78 {
79 if (hit->layer()->view() < 0.0)
80 {color = negStereoColor;}
81 else
82 {color = axialColor;}
83 }
84 }
85 display->setlcolor(color);
86
87
88 if (mode<0) {mode = display->hitMode(windowXY);}
89 switch(mode)
90 {
91 case 1:
92 // Decide drift distance.
93 radius = (hit->driftDist(tbunch, tIndex) > driftmin) ?
94 hit->driftDist(tbunch, tIndex) :
95 driftmin;
96 display->arc(radius, hit->x() , hit->y() , 1., 1.); // Draw the circle.
97 break;
98 case 2:
99 display->arc(0.75, hit->x() , hit->y() , 1., 1.);
100 break;
101 default:
102 cerr<<"Unknown mode."<<endl;
103 break;
104 }
105
106}
107//**********************************************************************
108void MdcPlotHits::plotinfo(const MdcHit *hit, double scale, double tbunch)
109 const {
110//**********************************************************************
111 char *string[5];
112 int i;
113 for (i = 0; i < 5; i++) {
114 string[i] = new char[20];
115 }
116
117 sprintf(string[4],"%d",hit->layernumber() );
118 sprintf(string[3],"%d",hit->wire() );
119 sprintf(string[2],"%d",hit->mcTrack() );
120 sprintf(string[1],"%6.2f",10.*hit->driftDist(tbunch, 0) );
121 sprintf(string[0],"%6.2f",0.); // dummy
122
123 display->info(windowXY, hit->x(), hit->y(), string, scale, 0);
124
125 for (i = 0; i < 5; i++) {
126 delete string[i];
127 }
128
129}
130#endif
131
132
133
134
135
136
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)
int ambig() const
unsigned layernumber() const
Definition MdcHit.h:61
double x() const
Definition MdcHit.h:76
double y() const
Definition MdcHit.h:77
double driftDist(double, int, double, double, double) const
Definition MdcHit.cxx:156
const MdcLayer * layer() const
Definition MdcHit.h:56
const MdcSWire * wire() const
Definition MdcHit.h:57
int view(void) const
Definition MdcLayer.h:28
bool isActive() const