50 #include "Riostream.h"
54 #include "TApplication.h"
71 double S()
const {
return fS; }
72 double Z()
const {
return fZ; }
80 return ( a.
fS < b.
fS );
85 return ( a.
fZ < b.
fZ );
103 return gPndFTSCADisplay;
107 fYX( 0 ), fZX( 0 ), fZR( 0 ), fAsk( 1 ), fGB( 0 ), fPerf( 0 ),
108 fZMin( -60 ), fZMax( 60 ), fYMin( -210 ), fYMax( 210 ),
112 fRInnerMin( 50. ), fRInnerMax( 133.3 ), fROuterMin( 50 ), fROuterMax( 50 ), fTPCZMin( -60. ), fTPCZMax( 60 ),
114 fArc(), fLine(), fPLine(), fMarker(),
fBox(), fCrown(), fLatex(), fDrawOnlyRef( 0 )
116 fPerf = &( PndFTSCAPerformance::Instance() );
131 static bool firstCall = 1;
133 if ( !gApplication )
new TApplication(
"myapp", 0, 0 );
136 gStyle->SetCanvasBorderMode( 0 );
137 gStyle->SetCanvasBorderSize( 1 );
138 gStyle->SetCanvasColor( 0 );
140 fCanvas =
new TCanvas(
"CA",
"CA Display", 2*400, 2*300 );
142 fZX =
static_cast<TPad *
>(
fCanvas->GetPrimitive(
"CA_1" ) );
143 fYX =
static_cast<TPad *
>(
fCanvas->GetPrimitive(
"CA_2" ) );
146 fCanvas =
new TCanvas(
"CA",
"CA Display", 400*1.5, 300 );
148 fZX =
static_cast<TPad *
>(
fCanvas->GetPrimitive(
"CA_2" ) );
149 fZR =
static_cast<TPad *
>(
fCanvas->GetPrimitive(
"CA_3" ) );
151 fCanvas =
new TCanvas(
"CA",
"CA Display", 400*2, 300*2 );
153 fZX =
static_cast<TPad *
>(
fCanvas->GetPrimitive(
"CA_2" ) );
155 fYX =
static_cast<TPad *
>(
fCanvas->GetPrimitive(
"CA_1" ) );
159 fYX->SetTitle(
"XY" );
161 fZX->SetTitle(
"ZX" );
164 fZR->SetTitle(
"ZR" );
168 fMarker = TMarker( 0.0, 0.0, 20 );
182 fZX->Print(
"ZX.pdf" );
202 std::cout <<
"ask> ";
204 std::cin.get( symbol );
207 }
while ( symbol !=
'\n' );
220 const int detColor = kGray+1;
221 #if defined(PANDA_STT)
228 fArc.SetLineColor( detColor );
229 fArc.SetFillStyle( 0 );
230 fArc.SetLineWidth(.1);
235 Tl.SetTextSize(0.03);
246 ZX.SetFillStyle( 0 );
249 ZX.SetLineColor(detColor);
254 Tl.SetTextSize(0.03);
258 #elif defined(PANDA_FTS)
266 XY.SetFillStyle( 0 );
269 XY.SetLineColor(detColor);
273 Tl.SetTextSize(0.03);
275 Tl.DrawLatex( fXMin + (fXMax-fXMin)*0.07,
fYMax - (
fYMax-
fYMin)*0.05,
"XY" );
284 ZX.SetFillStyle( 0 );
287 ZX.SetLineColor(detColor);
290 const int NStations = 6;
291 const float XLeft[NStations] = { -659.025, -659.025, -881.225, -1042.825, -1951.825, -1951.825 };
292 const float NTubes[NStations] = { 132, 132, 176, 208, 388, 388 };
293 const float MinZ[NStations] = { 2949.627, 3269.627, 3940.627, 4380.627, 6070.627, 6390.627 };
294 const float MaxZ[NStations] = { 3108.373, 3428.373, 4244.123, 4684.123, 6229.373, 6549.373 };
295 const float Offset = 2;
296 for (
int iS = 0; iS < NStations; iS++ )
297 ZX.DrawBox( MinZ[iS]/10 - Offset, XLeft[iS]/10 - Offset, MaxZ[iS]/10 + Offset, (XLeft[iS] + NTubes[iS]*10.1)/10 + Offset );
301 Tl.SetTextSize(0.03);
303 Tl.DrawLatex(
fZMin + (
fZMax-
fZMin)*0.07, fXMax - (fXMax-fXMin)*0.05,
"ZX" );
310 const int color = detColor;
311 const float width = .1;
314 const float RMax = 40.827;
318 l.SetLineColor( color );
319 l.SetLineWidth( width );
322 const float x0L = 16.1;
323 const float a = x0L/
sqrt(3.
f/4.
f);
325 x[7] = {0,x0L,x0L,0,-x0L,-x0L,0},
326 y[7] = {-
a,-a/2,a/2,
a,a/2,-a/2,-a};
328 for (
int i = 0;
i < 6;
i++ ) {
330 l.DrawLine( x[i],
y[i], c*x[i], c*
y[i] );
337 pl.SetLineColor( color );
338 pl.SetLineWidth( width );
341 const float x0L = 16.1;
342 const float a = x0L/
sqrt(3.
f/4.
f);
344 x[7] = {0,x0L,x0L,0,-x0L,-x0L},
345 y[7] = {-
a,-a/2,a/2,
a,a/2,-a/2,-a};
346 pl.DrawPolyLine( 7, x,
y );
349 pl.SetLineStyle( 9 );
352 const float x0L = 23.3;
353 const float a = x0L/
sqrt(3.
f/4.
f);
355 x[7] = {0,x0L,x0L,0,-x0L,-x0L},
356 y[7] = {-
a,-a/2,a/2,
a,a/2,-a/2,-a};
357 pl.DrawPolyLine( 7, x,
y );
362 const float x0L = 31.7;
363 const float a = x0L/
sqrt(3.
f/4.
f);
365 x[7] = {0,x0L,x0L,0,-x0L,-x0L},
366 y[7] = {-
a,-a/2,a/2,
a,a/2,-a/2,-a};
367 pl.DrawPolyLine( 7, x,
y );
382 fArc.SetLineColor( color );
383 fArc.SetFillStyle( 0 );
385 fArc.SetLineWidth(width);
398 fArc.DrawArc( 0, 0, 2.408 );
399 fArc.DrawArc( 0, 0, 4.969 );
400 fArc.DrawArc( 0, 0, 9.210 );
401 fArc.DrawArc( 0, 0, 12.529 );
402 fArc.DrawArc( 0, 0, RMax );
405 Tl.SetTextSize(0.03);
417 ZX.SetFillStyle( 0 );
419 ZX.SetLineWidth(width);
420 ZX.SetLineColor(color);
426 ZX.DrawBox(-39.8/10, -28.58/10, 9.8/10, 28.58/10);
427 ZX.DrawBox(-79.8/10, -52.82/10, 57.8/10, 52.82/10);
428 ZX.DrawBox(-133.8/10, -96.86/10, 139.0/10, 96.86/10);
429 ZX.DrawBox(-169.2/10, -129.24/10, 139.0/10, 129.24/10);
434 l.SetLineWidth(width);
435 l.SetLineColor(color);
437 l.DrawLine(22/10, -36.56/10, 22/10, 36.56/10);
438 l.DrawLine(42/10, -36.56/10, 42/10, 36.56/10);
439 l.DrawLine(72/10, -73.96/10, 72/10, 73.96/10);
440 l.DrawLine(102/10, -73.96/10, 102/10, 73.96/10);
441 l.DrawLine(150/10, -73.96/10, 150/10, 73.96/10);
442 l.DrawLine(162.5/10, -131.15/10, 162.5/10, 131.15/10);
443 l.DrawLine(220/10, -73.96/10, 220/10, 73.96/10);
444 l.DrawLine(207.5/10, -131.15/10, 207.5/10, 131.15/10);
447 Tl.SetTextSize(0.03);
460 l.SetLineWidth(width);
461 l.SetLineColor(color);
471 ZX.SetFillStyle( 0 );
473 ZX.SetLineWidth(width);
474 ZX.SetLineColor(color);
480 ZX.DrawBox(-39.8/10, 0, 9.8/10, 28.58/10);
481 ZX.DrawBox(-79.8/10, 0, 57.8/10, 52.82/10);
482 ZX.DrawBox(-133.8/10, 0, 139.0/10, 96.86/10);
483 ZX.DrawBox(-169.2/10, 0, 139.0/10, 129.24/10);
489 l.SetLineWidth(width);
490 l.SetLineColor(color);
492 l.DrawLine(22/10, 11.70/10, 22/10, 36.56/10);
493 l.DrawLine(42/10, 11.70/10, 42/10, 36.56/10);
494 l.DrawLine(72/10, 11.70/10, 72/10, 73.96/10);
495 l.DrawLine(102/10, 11.70/10, 102/10, 73.96/10);
496 l.DrawLine(150/10, 11.70/10, 150/10, 73.96/10);
497 l.DrawLine(162.5/10, 74.33/10, 162.5/10, 131.15/10);
498 l.DrawLine(220/10, 11.70/10, 220/10, 73.96/10);
499 l.DrawLine(207.5/10, 74.33/10, 207.5/10, 131.15/10);
503 Tl.SetTextSize(0.03);
508 #endif // PANDA // detailed view
514 fArc.SetLineWidth( width );
515 fArc.SetLineColor( 2 + Start);
518 fArc.DrawArc( x, y, r );
523 fMarker.SetMarkerSize( width );
524 fMarker.SetMarkerColor( 2 + Start);
535 fMarker.SetMarkerSize( width );
536 fMarker.SetMarkerColor( Start);
556 fMarker.SetMarkerSize( width );
557 fMarker.SetMarkerColor( Start);
560 fArrow.SetFillColor( Start );
561 fArrow.SetLineColor( Start );
562 fArrow.SetLineWidth( 1*width );
591 fLine.SetLineWidth( 2 );
592 fLine.SetLineColor( Start);
594 if ( projection == -1 || projection == 0 ) {
597 fLine.DrawLine( z, x, z2, x2 );
600 fLine.DrawLine( x, y, x2, y2 );
603 if ( projection == -1 || projection == 1 ) {
606 fLine.DrawLine( x, y, x2, y2 );
609 fLine.DrawLine( z, y, z2, y2 );
621 const Color_t kMyColor[9] = { kGreen, kBlue, kYellow, kCyan, kOrange,
622 kSpring, kTeal, kAzure, kViolet
625 if ( i == 0 )
return kBlack;
626 return kMyColor[( i-1 )%9];
632 const Color_t kMyColor[11] = { kGreen, kBlue, kYellow, kMagenta, kCyan,
633 kOrange, kSpring, kTeal, kAzure, kViolet, kPink
637 int iz = ( int ) ( zz * 11 );
638 if ( iz < 0 ) iz = 0;
639 if ( iz > 10 ) iz = 10;
646 const Color_t kMyColor[11] = { kGreen, kBlue, kYellow, kMagenta, kCyan,
647 kOrange, kSpring, kTeal, kAzure, kViolet, kPink
651 int iy = ( int ) ( yy * 11 );
652 if ( iy < 0 ) iy = 0;
653 if ( iy > 10 ) iy = 10;
660 const Color_t kMyColor[11] = { kRed, kBlue, kYellow, kMagenta, kCyan,
661 kOrange, kSpring, kTeal, kAzure, kViolet, kPink
663 const double kCLight = 0.000299792458;
664 const double kBz = 5;
666 if (
TMath::Abs( kBz ) > 1.e-4 ) k2QPt = 1. / ( kBz * kCLight );
667 double qPt = k * k2QPt;
671 double yy = ( pt - 0.1 ) / ( 1. - 0.1 );
672 int iy = ( int ) ( yy * 11 );
673 if ( iy < 0 ) iy = 0;
674 if ( iy > 10 ) iy = 10;
685 int lab =
fPerf->HitLabel( h.
ID() ).fLab[0];
689 if ( mc.
P() >= 1. ) color = kRed;
694 if ( width > 0 )
fMarker.SetMarkerSize( width );
695 else fMarker.SetMarkerSize( .3 );
696 fMarker.SetMarkerColor( color );
697 double vx = h.
X(), vy = h.
Y();
709 if ( !
fPerf )
return;
710 if ( width < 0 ) width = .6;
712 for (
int iHit = 0; iHit < tracker.
NHits(); iHit++ ) {
717 int imc =
fPerf->HitLabel( h.
ID() ).fLab[0];
723 if (h.
Z() >= 0) col = kBlue;
724 if (h.
Z() < 0) col = 8;
732 fMarker.SetMarkerSize( width );
734 double vx = h.
X(), vy = h.
Y();
753 #if defined(DRIFT_TUBES)
754 if ( h.
IRow() < PndFTSCAParameters::NMVDStations )
766 #if defined(DRIFT_TUBES)
768 el.SetLineWidth( width );
769 el.SetLineColor( col );
770 el.SetFillStyle( 0 );
771 if ( h.IsPileduped() ) {
772 el.SetLineColor( kBlack );
778 el.DrawEllipse( h.XW(), h.YW(), h.R(), h.R(), 0, 360, h.
Angle()*180/
TMath::Pi() );
779 fMarker.DrawMarker( h.XW(), h.YW() );
783 double r2Min = 10e10, xSaved = 0, ySaved = 0, zSaved = 0;
784 for (
int itr = 0; itr <
fGB->
NTracks(); itr++ ) {
793 if (!rotated || !transported)
continue;
795 float p1 = p.
Y(),
p2 = p.
Z();
801 const double beta =
b;
802 const double betaLast = M_PI_2 +
b;
803 const double zL =
p2, yL =
p1;
804 const double z = x2,
y = x1;
806 const double ctbL = tan( - betaLast);
807 const double ctb = tan( - beta);
809 double zM = ((zL*ctbL - yL) - (z*ctb - y))/(ctbL - ctb);
810 double yM = y + (zM -
z)*ctb;
812 double r2 = (yM - yL)*(yM - yL) + (zM - zL)*(zM - zL);
814 if (r2 > r2Min)
continue;
818 el.DrawEllipse( xSaved, ySaved, h.R(), h.R(), 0, 360, h.
Angle()*180/
TMath::Pi() );
819 fMarker.DrawMarker( xSaved, ySaved );
825 el.DrawEllipse( h.ZW(), h.XW(), h.R(), h.R(), 0, 360, h.
Angle()*180/
TMath::Pi() );
826 fMarker.DrawMarker( h.ZW(), h.XW() );
828 fMarker.DrawMarker( h.ZW(), h.XW() );
892 #endif // DRIFT_TUBES
906 #if defined(DRIFT_TUBES)
907 #define COUNT_SAME_HITS // count same wires positions
909 #ifdef COUNT_SAME_HITS
910 bool operator<(
const TVector3&
a,
const TVector3&
b) {
912 return a.X() < b.X();
915 return a.Y() < b.Y();
917 return a.Z() < b.Z();
924 for(
int iS = 0, iColor = 0; iS < all.
NStations(); ++iS, iColor++ ) {
925 if ( iColor == kYellow )
927 if ( iColor == kWhite )
930 #ifdef COUNT_SAME_HITS
931 map<TVector3,int> nSameHits;
934 for(
unsigned int i = 0;
i < s.size(); ++
i ) {
937 foreach_bit(
int iV, h.
IsValid() ) {
943 #ifdef COUNT_SAME_HITS
944 TVector3
v(gx, gy, gz);
945 if ( nSameHits.count(v) > 0 )
951 TLatex* Tl =
new TLatex();
952 Tl->SetTextSize(0.002);
953 Tl->SetTextAlign(22);
967 Tl->DrawLatex( gx, gy, ss);
971 #ifdef COUNT_SAME_HITS
972 for (std::map<TVector3,int>::iterator it=nSameHits.begin(); it!=nSameHits.end(); ++it) {
973 TLatex* Tl =
new TLatex();
974 Tl->SetTextSize(0.002);
975 Tl->SetTextAlign(22);
979 Tl->DrawLatex( it->first.X(), it->first.Y(), text );
989 for(
int iS = 0, iColor = 0; iS < all.
NStations(); ++iS, iColor++ ) {
990 if ( iColor == kYellow )
992 if ( iColor == kWhite )
995 #ifdef COUNT_SAME_HITS
996 map<TVector3,int> nSameHits;
999 for(
unsigned int i = 0;
i < s.size(); ++
i ) {
1009 #ifdef COUNT_SAME_HITS
1010 TVector3
v(gx, gy, gz);
1011 if ( nSameHits.count(v) > 0 )
1017 TLatex* Tl =
new TLatex();
1018 Tl->SetTextSize(0.002);
1019 Tl->SetTextAlign(22);
1033 Tl->DrawLatex( gx, gy, ss);
1037 #ifdef COUNT_SAME_HITS
1038 for (std::map<TVector3,int>::iterator it=nSameHits.begin(); it!=nSameHits.end(); ++it) {
1039 TLatex* Tl =
new TLatex();
1040 Tl->SetTextSize(0.002);
1041 Tl->SetTextAlign(22);
1045 Tl->DrawLatex( it->first.X(), it->first.Y(), text );
1055 const int NSta = 30;
1058 static double r[NSta];
1059 static double zRange[NSta][2];
1060 static double yRange[NSta][2];
1061 static double xRange[NSta][2][2];
1063 static double rMax[NSta];
1064 static double x0LRange[NSta][2];
1066 static bool first_call =
true;
1068 for(
int i = 0;
i < NSta;
i++ ) {
1071 zRange[
i][0] = 1e10;
1072 zRange[
i][1] = -1e10;
1073 yRange[
i][0] = 1e10;
1074 yRange[
i][1] = -1e10;
1075 xRange[
i][0][0] = 1e10;
1076 xRange[
i][0][1] = -1e10;
1077 xRange[
i][1][0] = 1e10;
1078 xRange[
i][1][1] = -1e10;
1080 x0LRange[
i][0] = 1e10;
1081 x0LRange[
i][1] = -1e10;
1088 for(
int i = 0;
i < mcPs.
Size(); ++
i ) {
1090 double mcX0 = mcPoint.
X();
1091 double mcY0 = mcPoint.
Y();
1092 double mcZ = mcPoint.
Z();
1104 const int iS = mcPoint.
IRow();
1105 if ( iS >= NSta || iS < 0 )
continue;
1107 const double rCurr =
sqrt(mcX0*mcX0 + mcY0*mcY0);
1108 r[iS] +=
sqrt(mcX0*mcX0 + mcY0*mcY0);
1109 zRange[iS][0] =
std::min( zRange[iS][0], mcZ );
1110 zRange[iS][1] =
std::max( zRange[iS][1], mcZ );
1111 yRange[iS][0] =
std::min( yRange[iS][0], mcY0 );
1112 yRange[iS][1] =
std::max( yRange[iS][1], mcY0 );
1114 xRange[iS][0][0] =
std::min( xRange[iS][0][0], mcX0 );
1115 xRange[iS][0][1] =
std::max( xRange[iS][0][1], mcX0 );
1117 xRange[iS][1][0] =
std::min( xRange[iS][1][0], mcX0 );
1118 xRange[iS][1][1] =
std::max( xRange[iS][1][1], mcX0 );
1120 rMax[iS] =
std::max( rMax[iS], rCurr );
1123 double A = atan( abs(mcY0/mcX0) );
1125 if ( mcY0 >= 0 && mcX0 >= 0 ) A = pi2 - A;
1126 if ( mcY0 < 0 && mcX0 >= 0 ) A = pi2 + A;
1127 if ( mcY0 < 0 && mcX0 < 0 ) A = 3*pi2 - A;
1128 if ( mcY0 >= 0 && mcX0 < 0 ) A = 3*pi2 + A;
1129 A = floor(A/pi2*6)*pi2*2/3.f;
1134 cout << iS <<
" " << mcX0 <<
" "<< x0 <<
" " << A <<
" " << mcPoint.
Angle() << endl;
1135 x0LRange[iS][0] =
std::min( x0LRange[iS][0], abs(x0) );
1136 x0LRange[iS][1] =
std::max( x0LRange[iS][1], abs(x0) );
1141 for(
int i = 0;
i < NSta;
i++ )
1142 cout <<
i <<
" station: "
1143 <<
" x- = [" << xRange[
i][0][0] <<
"," << xRange[
i][0][1] <<
"]"
1144 <<
" x+ = [" << xRange[
i][1][0] <<
"," << xRange[
i][1][1] <<
"]"
1145 <<
" y = [" << yRange[
i][0] <<
"," << yRange[
i][1] <<
"]"
1146 <<
" z = [" << zRange[
i][0] <<
"," << zRange[
i][1] <<
"]" << endl
1147 <<
" r = " << r[
i]/N[
i]
1148 <<
" rMax = " << rMax[
i]
1149 <<
" x0Local = [" << x0LRange[
i][0] <<
"," << x0LRange[
i][1] <<
"]" << endl;
1154 const unsigned int N = pvHist.size();
1155 const float maxZ = param.
MaxZ();
1157 for(
unsigned int i = 0;
i < N; ++
i ) {
1158 max = ( max < pvHist[
i] ) ? pvHist[
i] : max;
1161 for(
unsigned int i = 0;
i < N; ++
i ) {
1162 float z = (2.f*
i/N-1)*maxZ;
1163 float dr = pvHist[
i]/max*maxZ;
1166 fLine.SetLineColor( kBlue );
1167 fLine.SetLineWidth(0);
1168 fLine.DrawLine( z, 0, z, -dr );
1173 for(
int iS = 0; iS < all.
NStations(); ++iS )
1176 if ( s.size() <= 0 )
continue;
1177 const int N = s[0].N();
1198 for(
unsigned int i = 0;
i < s.size(); ++
i )
1200 foreach_bit(
int iV, s[
i].IsValid() )
1202 vector<float> gx(N), gy(N), gz(N);
1203 for (
int ih = 0; ih < N; ih++ )
1208 for (
int ih = 1; ih < N; ih++ )
1210 DrawGBLine( gx[ih-1], gy[ih-1], gz[ih-1], gx[ih], gy[ih], gz[ih], color, 0 );
1214 DrawGBLine( 0,0,0, gx[0], gy[0], gz[0], color, 0 );
1220 cout<<
"N "<<s[
i].N()<<
" QP "<<s[
i].Param().QP()[0]<<
" Tx "<<s[
i].Param().Tx()[0]<<
" Ty "<<s[
i].Param().Ty()[0]<<
" X "<<s[
i].Param().X()[0]<<
" Y "<<s[
i].Param().Y()[0]<<
" Chi2 "<<s[
i].Param().Chi2()[0]<<endl;
1231 if ( s.size() <= 0 )
return;
1232 const int N = s[0].N();
1237 case 1: color = kYellow;
break;
1238 case 2: color = kMagenta;
break;
1239 case 3: color = kBlue;
break;
1240 case 4: color = kOrange;
break;
1241 case 5: color = kGreen;
break;
1242 case 6: color = kRed;
break;
1245 for(
unsigned int i = 0;
i < s.size(); ++
i )
1249 foreach_bit(
int iV, s[
i].IsValid() )
1251 vector<float> gx(N), gy(N), gz(N);
1252 for (
int ih = 0; ih < N; ih++ )
1259 DrawGBLine( 0,0,0, gx[0], gy[0], gz[0], color, 0 );
1261 for (
int ih = 1; ih < N; ih++ )
1264 DrawGBLine( gx[ih-1], gy[ih-1], gz[ih-1], gx[ih], gy[ih], gz[ih], color+2*(ih==1), 0 );
1272 for(
unsigned int i = 0;
i < all.size(); ++
i ) {
1274 const unsigned int NTHits = t.
NHits();
1276 for(
unsigned int iH=1; iH < NTHits; iH++) {
1279 float gx0, gy0, gz0, gx1, gy1, gz1;
1282 DrawGBLine( gx0, gy0, gz0, gx1, gy1, gz1, kRed, 0.1 );
1297 int *lb =
new int[NHits*3];
1300 for (
int ihit = 0; ihit < NHits; ihit++ ) {
1302 const PndFTSCAPerformance::PndFTSCAHitLabel &l =
fPerf->HitLabel( h.
ID() );
1303 if ( l.fLab[0] >= 0 ) lb[nla++] = l.fLab[0];
1304 if ( l.fLab[1] >= 0 ) lb[nla++] = l.fLab[1];
1305 if ( l.fLab[2] >= 0 ) lb[nla++] = l.fLab[2];
1308 std::sort( lb, lb + nla );
1309 int labmax = -1, labcur = -1, lmax = 0, lcurr = 0, nh = 0;
1311 for (
int i = 0;
i < nla;
i++ ) {
1312 if ( lb[
i] != labcur ) {
1313 if ( 0 &&
i > 0 && lb[
i-1] >= 0 ) {
1315 std::cout << lb[
i-1] <<
": nhits=" << nh <<
", pdg=" << mc.
PDG() <<
", Pt=" << mc.
Pt() <<
", P=" << mc.
P()
1316 <<
", par=" << mc.
Par()[0] <<
" " << mc.
Par()[1] <<
" " << mc.
Par()[2]
1317 <<
" " << mc.
Par()[3] <<
" " << mc.
Par()[4] <<
" " << mc.
Par()[5] <<
" " << mc.
Par()[6] << std::endl;
1321 if ( labcur >= 0 && lmax < lcurr ) {
1331 if ( 0 && nla - 1 > 0 && lb[nla-1] >= 0 ) {
1333 std::cout << lb[nla-1] <<
": nhits=" << nh <<
", pdg=" << mc.
PDG() <<
", Pt=" << mc.
Pt() <<
", P=" << mc.
P()
1334 <<
", par=" << mc.
Par()[0] <<
" " << mc.
Par()[1] <<
" " << mc.
Par()[2]
1335 <<
" " << mc.
Par()[3] <<
" " << mc.
Par()[4] <<
" " << mc.
Par()[5] <<
" " << mc.
Par()[6] << std::endl;
1338 if ( labcur >= 0 && lmax < lcurr ) {
1343 for (
int ihit = 0; ihit < NHits; ihit++ ) {
1345 const PndFTSCAPerformance::PndFTSCAHitLabel &l =
fPerf->HitLabel( h.
ID() );
1346 if ( l.fLab[0] == labmax || l.fLab[1] == labmax || l.fLab[2] == labmax
1350 purity = ( ( NHits > 0 ) ?
double( lmax ) / double( NHits ) : 0 );
1351 if ( lb )
delete[] lb;
1352 if ( purity < .9 ) label = -1;
1358 int NHits,
int color, Size_t width,
bool pPoint )
1364 const bool drawEndPoints = 0;
1367 if ( NHits < 2 )
return 0;
1370 if ( width < 0 ) width = 2;
1374 if ( lab < 0 )
return 0;
1376 if ( mc.
P() < 1 )
return 0;
1390 #if !defined(PANDA_FTS)
1398 vector<double> vx(NHits), vy(NHits), vz(NHits);
1402 double alpha = Alpha;
1405 for (
int iHit = 0; iHit < NHits; iHit++ ) {
1411 double x0 = h.
X(),
y0 = h.
Y(), z1 = h.
Z();
1412 double x1 = x0 * hCos +
y0 * hSin;
1413 double y1 =
y0 * hCos - x0 * hSin;
1416 double dx = x1 - tt.
X();
1417 double dy = y1 - tt.
Y();
1418 if ( dx*dx + dy*dy > 1. ) {
1420 if ( tt.
Rotate( dalpha ) ) {
1424 x1 = x0 * hCos +
y0 * hSin;
1425 y1 =
y0 * hCos - x0 * hSin;
1436 double x1 = t.
X(), y1 = t.
Y(), z1 = t.
Z();
1438 double dx = x1 - vx[0];
1439 double dy = y1 - vy[0];
1441 double d0 = dx * dx + dy *
dy;
1442 dx = x1 - vx[mHits-1];
1443 dy = y1 - vy[mHits-1];
1445 double d1 = dx * dx + dy *
dy;
1453 for (
int i = mHits;
i > 0;
i-- ) {
1466 const float zoom = 0.6;
1467 const float z_zoom = 1.2;
1468 const float z0_zoom = 1000.;
1469 for (
int i = mHits - 1;
i >= 0;
i-- ) {
1470 TVector3
v(vx[
i], -vz[i], vy[i]);
1476 vz[
i] = -v.Y()*zoom;
1478 vx[
i] *= (z0_zoom-vz[
i])/z0_zoom * z_zoom;
1479 vy[
i] *= (z0_zoom-vz[
i])/z0_zoom * z_zoom;
1484 fLine.SetLineColor( color );
1485 fLine.SetLineWidth( width );
1486 fArc.SetFillStyle( 0 );
1487 fArc.SetLineColor( color );
1488 fArc.SetLineWidth( width );
1490 pl.SetLineColor( color );
1491 pl.SetLineWidth( width );
1493 plZ.SetLineColor( color );
1494 plZ.SetLineWidth( width );
1496 fMarker.SetMarkerSize( width / 2. );
1497 fMarker.SetMarkerColor( color );
1500 pl.DrawPolyLine( mHits, &vx[0], &vy[0] );
1501 if (drawEndPoints) {
1502 fMarker.DrawMarker( vx[0], vy[0] );
1503 fMarker.DrawMarker( vx[mHits-1], vy[mHits-1] );
1506 plZ.DrawPolyLine( mHits, &vz[0], &vy[0] );
1507 if (drawEndPoints) {
1508 fMarker.DrawMarker( vz[0], vy[0] );
1509 fMarker.DrawMarker( vz[mHits-1], vy[mHits-1] );
1512 fLine.SetLineWidth( 1 );
1516 void PndFTSCADisplay::DrawHelix(
float p0,
float c,
float z,
float zStart,
float z0,
float xc,
float yc,
float r,
float b,
int color, Size_t width)
1518 fLine.SetLineColor(color);
1519 fLine.SetLineWidth(width);
1522 p = p0 + c*(zStart-
z0)/b;
1524 x = xc + c*r*
cos(p);
1526 float zPrev = zStart;
1531 for(
int i=1;
i<100;
i++)
1533 z = zStart + (zEnd-zStart)/100*
i;
1534 p = p0 + c*(z-
z0)/b;
1536 x = xc + c*r*
cos(p);
1539 fLine.DrawLine( x, y, xPrev, yPrev);
1541 fLine.DrawLine( z, y, zPrev, yPrev);
1551 fLine.SetLineColor(color);
1552 fLine.SetLineWidth(width);
1553 fArrow.SetFillColor( color );
1554 fArrow.SetLineColor( color );
1555 fArrow.SetLineWidth( width );
1558 for(
int iP=0; iP<8; iP++)
1563 float xPrev=0, yPrev=0, zPrev=0;
1565 const float kCLight = 0.000299792458;
1568 for(
int i=0;
i<=100;
i++)
1575 const float kOvSqr6 = 1./
sqrt(6.);
1577 sB = (1.e-8 <
fabs(bs)) ? (s/b) : ((1-bs*kOvSqr6)*(1+bs*kOvSqr6)*
t) ;
1578 cB = (1.e-8 <
fabs(bs)) ? ((1-
c)/
b) : (.5*sB*bs) ;
1580 float px = param[3];
1581 float py = param[4];
1582 float pz = param[5];
1584 p[0] = param[0] + sB*px + cB*py;
1585 p[1] = param[1] - cB*px + sB*py;
1586 p[2] = param[2] + t*
pz;
1588 p[4] = -s*px +
c*py;
1596 fLine.DrawLine( p[0], p[1], xPrev, yPrev);
1598 fLine.DrawLine( p[2], p[1], zPrev, yPrev);
1609 fLine.SetLineColor(color);
1610 fLine.SetLineWidth(width);
1611 fArrow.SetFillColor( color );
1612 fArrow.SetLineColor( color );
1613 fArrow.SetLineWidth( width );
1616 for(
int iP=0; iP<8; iP++)
1621 float xPrev=p[0], yPrev=p[1], zPrev=p[2];
1623 const float kCLight = 0.000299792458;
1627 double dist = p[0]*n[0]+p[1]*n[1]+p[2]*n[2]+n[3];
1628 double dist_last = dist;
1629 bool step_changed =
false;
1630 for(
int i=1; dist > 0 &&
i < 10000; i++)
1638 const float kOvSqr6 = 1./
sqrt(6.);
1640 sB = (1.e-8 <
fabs(bs)) ? (s/b) : ((1-bs*kOvSqr6)*(1+bs*kOvSqr6)*
t) ;
1641 cB = (1.e-8 <
fabs(bs)) ? ((1-
c)/
b) : (.5*sB*bs) ;
1643 float px = param[3];
1644 float py = param[4];
1645 float pz = param[5];
1647 p[0] = param[0] + sB*px + cB*py;
1648 p[1] = param[1] - cB*px + sB*py;
1649 p[2] = param[2] + t*
pz;
1651 p[4] = -s*px +
c*py;
1656 dist = p[0]*n[0]+p[1]*n[1]+p[2]*n[2]+n[3];
1658 if(dist < dist_last)
1661 fLine.DrawLine( p[0], p[1], xPrev, yPrev);
1663 fLine.DrawLine( p[2], p[1], zPrev, yPrev);
1665 else if ( abs(dist - dist_last) < 1e-8 ) {
1670 else if (!step_changed) {
1672 step_changed =
true;
1697 if ( track.
NHits() < 2 )
return;
1699 vector<PndFTSCADisplayTmpHit> vHits( track.
NHits() );
1701 for (
int ih = 0; ih < track.
NHits(); ih++ ) {
1704 vHits[ih].
SetID( i );
1705 vHits[ih].SetS( 0 );
1706 vHits[ih].SetZ( h.
Z() );
1717 if ( track.
NHits() < 2 )
return;
1719 #if 1 // draw by hits or by parameters
1721 #if defined(DRIFT_TUBES)
1722 double hLx = hLast.
X(), hLy = hLast.
Y(), hLz = hLast.
Z();
1725 for (
int ih = 1; ih < track.
NHits(); ih++ ) {
1728 #if defined(DRIFT_TUBES)
1732 const double betaLast = M_PI_2 + hLast.Beta();
1733 const double beta = M_PI_2 + h.Beta();
1734 if (
fabs(betaLast - beta) > 5e-7 && h.
IRow() > PndFTSCAParameters::NMVDStations ) {
1736 const double ctbL = tan(M_PI_2 - betaLast);
1737 const double ctb = tan(M_PI_2 - beta);
1738 float xL, yL, zL,
x,
y,
z;
1742 double xM = (xL +
x)*0.5;
1743 double zM = ((zL*ctbL - yL) - (z*ctb - y))/(ctbL - ctb);
1744 double yM = y + (zM -
z)*ctb;
1745 double xMg, yMg, zMg;
1748 if ( ih - skipped != 1 || (
fabs(hLast.
ErrX12()) < 1e-7) ) {
1750 DrawGBLine( hLx, hLy, hLz, xMg, yMg, zMg, color, width, 0 );
1752 DrawGBLine( hLx, hLy, hLz, xMg, yMg, zMg, color, width );
1766 if ( h.
IRow() >= PndFTSCAParameters::NMVDStations )
1767 DrawGBLine( hLx, hLy, hLz, h.
X(), h.
Y(), h.
Z(), color, width, 0 );
1769 DrawGBLine( hLx, hLy, hLz, h.
X(), h.
Y(), h.
Z(), color, width );
1770 hLx = h.
X(), hLy = h.
Y(), hLz = h.
Z();
1776 DrawGBLine( hLast.
X(), hLast.
Y(), hLast.
Z(), h.
X(), h.
Y(), h.
Z(), color, width );
1780 #else // draw by hits or by parameters
1784 float x,
y,
z,px,py,
pz;
1788 const float pz0 = p.
DzDs()/p.
QPt();
1791 float param[8] = {
x,
y,
z,px,py,
pz, 0, 0 };
1794 #endif // draw by hits or by parameters
1799 PndFTSCAPerformance& perf = PndFTSCAPerformance::Instance();
1807 fLine.SetLineStyle( 3 );
1809 for (
int ih = 1; ih < track.
NMCPoints(); ih++ ) {
1811 DrawGBLine( mcPLast.
X(), mcPLast.
Y(), mcPLast.
Z(), mcP.
X(), mcP.
Y(), mcP.
Z(), color, width );
1815 fLine.SetLineStyle( 1 );
1818 #if !defined(PANDA_FTS)
1824 if ( track.
NHits() < 2 )
return;
1830 for (
int ih = 0; ih < track.
NHits(); ih++ ) {
1833 vHits[ih].
SetID( i );
1834 vHits[ih].
SetS( 0 );
1835 vHits[ih].
SetZ( h->
Z() );
1843 if ( color < 0 ) color =
GetColorZ( ( h1.
Z() + h2.
Z() ) / 2. );
1844 double gy1 = h1.
Y(), gy2 = h2.
Y();
1845 if ( colorY < 0 ) colorY =
GetColorY( ( gy1 + gy2 ) / 2. );
1849 fMarker.SetMarkerColor( color );
1851 fLine.SetLineColor( color );
1852 fLine.SetLineWidth( width );
1853 fArc.SetFillStyle( 0 );
1854 fArc.SetLineColor( color );
1855 fArc.SetLineWidth( width );
1857 pl.SetLineColor( colorY );
1858 pl.SetLineWidth( width );
1865 float x1, y1, z1, x2, y2, z2;
1866 double vx1, vy1, vx2, vy2;
1878 double sinPhi = t.
SinPhi();
1888 double xc = x0 - ey * ( 1 / k );
1889 double yc = y0 + ex * ( 1 / k );
1891 double vx = xc, vy = yc;
1895 if ( a1 < 0 ) a1 += 360;
1896 if ( a2 < 0 ) a2 += 360;
1897 if ( a2 < a1 ) a2 += 360;
1899 if ( da > 360 ) da -= 360;
1904 if ( a2 < a1 ) a2 += 360;
1906 fArc.DrawArc( vx, vy, r, a1, a2,
"only" );
1910 fLine.DrawLine( vx1, vy1, vx2, vy2 );
1917 for (
int iHit = 0; iHit < track.
NHits(); iHit++ ) {
1931 pl.DrawPolyLine( track.
NHits(),
pz.Data(), py.Data() );
1933 fLine.SetLineWidth( 1 );
1941 for (
int i = 0;
i < 100; ++
i ) {
1944 double sinPhi = t.
SinPhi();
1946 double dzds = t.
DzDs();
1947 double ex = t.CosPhi();
1950 fLine.SetLineWidth( 1 );
1951 fLine.SetLineColor( color );
1953 double vx =
x, vy =
y, vex = ex, vey = ey;
1959 fLine.DrawLine( vx, vy, vx + vex*4, vy + vey*4 );
1961 fLine.DrawLine( z, vy, z + dzds*4, vy + vey*4 );
1973 fXMin = tpcParam.MinX();
1974 fXMax = tpcParam.MaxX();
1975 fYMin = tpcParam.MinY();
1976 fYMax = tpcParam.MaxY();
1980 const double dx = fXMax - fXMin;
1983 fYX->Range( fXMin - dx*0.01, fYMin - dy*0.01, fXMax + dx*0.01,
fYMax + dy*0.01 );
1984 fZX->Range( fZMin - dz*0.01, fXMin - dx*0.01,
fZMax + dz*0.01, fXMax + dx*0.01 );
1987 fZMin = tpcParam.
MinZ();
void HitToGlobal(const FTSCAHit &hit, float &x, float &y, float &z)
friend F32vec4 cos(const F32vec4 &a)
const PndFTSCAGBTrack & Track(int i) const
void SetTPC(const PndFTSCAParam &tpcParam)
int TrackHit(int i) const
void DrawRecoTrack(int itr, int color=-1, int width=-1)
void DrawPVHisto(const vector< float > &pvHist, const PndFTSCAParam ¶m)
void GetDCAPoint(float x, float y, float z, float &px, float &py, float &pz, float Bz) const
bool Rotate(float alpha, float maxSinPhi=.999)
friend F32vec4 sqrt(const F32vec4 &a)
void DrawGBPoint(float x, float y, float z, int Start=1, Size_t width=1)
friend F32vec4 sin(const F32vec4 &a)
PndFTSCAGBTrack * Tracks() const
int GetColorK(double k) const
int GetTrackMC(const PndFTSCADisplayTmpHit *vHits, int NHits)
void DrawGBHit(const PndFTSCAGBTracker &tracker, int iHit, int color=-1, Size_t width=-1)
static PndFTSCADisplay & Instance()
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
const PndFTSCAGBTracker * fGB
void DrawGBLine(float x, float y, float z, float x2, float y2, float z2, int Start=1, Size_t width=1, int projection=-1)
int GetColorY(double y) const
TString pt(TString pts, TString exts="px py pz")
const PndFTSCATrackParam & OuterParam() const
void DrawGBTrackFast(const PndFTSCAGBTracker &tracker, int itr, int color=-1)
FTSCAElementsOnStation< T > & OnStation(char i)
static T RSqrt(const T &x)
void DrawMCTrack(int itr, int color=-1, int width=-1)
PndFTSCAPerformance * fPerf
void SetGB(const PndFTSCAGBTracker *GBTracker)
static void GlobalToCALocal(T x, T y, T angle, T &x0, T &x1)
static bool CompareHitDS(const PndFTSCADisplayTmpHit &a, const PndFTSCADisplayTmpHit &b)
void DrawGBTracks(const FTSCATracks &all)
const PndFTSCAParam & GetParameters() const
static T ATan2(const T &y, const T &x)
int GetColor(int i) const
void DrawGBTrack(int itr, int color=-1, int width=-1)
FTSCAElementsOnStation< T > & OnStation(char i)
const PndFTSCAGBHit * Hits() const
void SaveCanvasToFile(TString fileName)
FTSCAElementsOnStation< T > & OnStation(char i)
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
bool TransportToX0(float x, float Bz, float maxSinPhi=.999)
friend F32vec4 fabs(const F32vec4 &a)
bool DrawTrack(PndFTSCATrackParam t, double Alpha, const PndFTSCADisplayTmpHit *vHits, int NHits, int color=-1, Size_t width=-1, bool pPoint=0)
void GetLocalX0X1X2(float &x0, float &x1, float &x2) const
void DrawGBNPlets(const FTSCANPletsV &all)
virtual ~PndFTSCADisplay()
const PndFTSCATrackParam & InnerParam() const
static bool CompareHitZ(const PndFTSCADisplayTmpHit &a, const PndFTSCADisplayTmpHit &b)
void DrawPoint(float x, float y, float z, int Start=1, Size_t width=1)
const PndFTSCATrackParam & Param() const
void DrawTrackParam(PndFTSCATrackParam t, int color=1)
static void CALocalToGlobal(T x0, T x1, T angle, T &x, T &y)
void DrawArc(float x, float y, float r, int Start=1, Size_t width=1)
const PndFTSCAGBHit & Hit(int index) const
const FTSCAHit & Hit(int iH, int iT) const
friend F32vec4 operator<(const F32vec4 &a, const F32vec4 &b)
void DrawParticleGlobal(float *param, float q, float tStart, float tEnd, float b, int color=kOrange, Size_t width=1)
float Kappa(float Bz) const
const FTSCAHit & GetHit(int iV, int IH, int i) const
void DrawGBHits(const FTSCAHitsV &all)
int FirstMCPointID() const
void DrawHelix(float p0, float c, float z, float zStart, float z0, float xc, float yc, float r, float b, int color, Size_t width)
static const float RefThreshold
int GetColorZ(double z) const