StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
viz.C
1 #include "TFile.h"
2 #include "TH1F.h"
3 #include "TH2F.h"
4 #include "TTree.h"
5 
6 
7 TFile * fData;
8 TTree * fwd;
9 TH2 * hFrame;
10 TCanvas *gCan;
11 TPad *padRZ, *padXY, *padStat;
12 
13 float LegendX, LegendY;
14 float lineScale = 1.5;
15 
16 enum ProjectionType { kXY, kRZ, kRZSigned, kXZ, kYZ };
17 
18 float xx( float x, float y, float z, ProjectionType proj = kRZ ){
19 
20  if ( proj == kRZ || proj == kRZSigned){
21  return z;//(TMath::ATan2( y, x ) + 2*3.1415926 )/ (2*3.14159) * 360;
22  } else if ( proj == kXY ){
23  return x;
24  } else if ( proj == kXZ ){
25  return z;
26  } else if ( proj == kYZ ){
27  return z;
28  }
29 
30  return x;
31 }
32 
33 float yy( float x, float y, float z, ProjectionType proj = kRZ ){
34 
35  if ( proj == kRZ ){
36  float r = sqrt( pow(x, 2) + pow(y, 2) );
37  return r;
38  } else if ( proj == kXY ){
39  return y;
40  } else if ( proj == kRZSigned ){
41  float r = sqrt( pow(x, 2) + pow(y, 2) );
42  if ( y == 0 ) return r;
43  r *= y / fabs(y);
44  return r;
45  } else if ( proj == kXZ ){
46  return x;
47  } else if ( proj == kYZ ){
48  return y;
49  }
50 
51  return y;
52 }
53 
54 void viz_points(const char* name, const char* cmd, int color, int eventIndex, ProjectionType projType, bool Legend = false ){
55 
56  fwd->Draw( cmd, "", "goff", 1, eventIndex );
57  int N = fwd->GetSelectedRows();
58  printf( "%s : has %d results \n", cmd, N );
59  printf( "Projection Mode : %d \n", projType );
60 
61  auto cmdX = fwd->GetV1();
62  auto cmdY = fwd->GetV2();
63  auto cmdZ = fwd->GetV3();
64  auto cmdE = fwd->GetV4();
65  if ( cmdE != nullptr ){
66  printf( "TOWERS\n" );
67  }
68  float vizX; //change from array-AGE
69  float vizY;
70 
71  TText *t = new TText(.5,.5,"Hello World !");
72  // t->SetTextAlign(22);
73  t->SetTextColor(kBlack);
74  t->SetTextFont(43);
75  t->SetTextSize(20);
76 
77  int zColorStep = 90;
78  int slc = color;
79  int zColors[50]; // fst1 fst2 fst3 ftt1 ftt2 ftt3 ftt4 epd ecal hcal
80  float zSizes[] = {2.5, 2.5, 2.0, 1.5, 1.5, 1.5, 1.5, 1.5, 2.5, 2.0, 1.5}; //first element is for hits that don't match any positions (only goes to ftt3--changing to allow all)
81  for ( int i = 0; i < 50; i++ )
82  zColors[i] = TColor::GetColorPalette(i*zColorStep % 255 );
83 
84 
85  bool lgZ = false;
86  float alpha = 0.6;
87  for ( int i = 0; i < N; i++ ){
88 
89  vizX = xx( cmdX[i], cmdY[i], cmdZ[i], projType );
90  vizY = yy( cmdX[i], cmdY[i], cmdZ[i], projType );
91  printf( "\tpoint at (%f, %f, %f) -> (%f, %f)\n", cmdX[i], cmdY[i], cmdZ[i], vizX, vizY );
92 
93  int zIndex = 0;
94  if ( fabs( cmdZ[i] - 151.75) < 2.5 ) zIndex = 1;
95  if ( fabs( cmdZ[i] - 165.25) < 2.5 ) zIndex = 2;
96  if ( fabs( cmdZ[i] - 178.75) < 2.5 ) zIndex = 3;
97 
98  //add locations of other detectors-AGE
99  //FTT--approximate locations
100  if ( fabs( cmdZ[i] - 281) < 2.5 ) zIndex = 4;
101  if ( fabs( cmdZ[i] - 304) < 2.5 ) zIndex = 5;
102  if ( fabs( cmdZ[i] - 325) < 2.5 ) zIndex = 6;
103  if ( fabs( cmdZ[i] - 348) < 2.5 ) zIndex = 7;
104  //EPD--approx.
105  if ( fabs( cmdZ[i] - 375) < 2.5 ) zIndex = 8;
106  //FCS--approx.
107  //if ( fabs( cmdZ[i] - 721) < 2.5 ) zIndex = 9; //wcal
108  //if ( fabs( cmdZ[i] - 804) < 2.5 ) zIndex = 10; //hcal
109 
110  TMarker *mk = new TMarker( vizX, vizY, 20 );
111 
112  mk->SetMarkerSize( 2.5 );
113  if (zIndex >= 1 && zIndex < 50){ //see if should be changed to zIndex < 9-AGE
114  slc = zColors[zIndex];
115  }
116  mk->SetMarkerSize( zSizes[zIndex] );
117 
118 
119 
120 
121  // mk->SetMarkerSize( (float)(zIndex) * 0.5 + 0.5 );
122 
123  alpha = 0.6;
124  if ( zIndex != 8 && (cmdE != nullptr && projType == kRZSigned) ){ //FCS for RZ
125  //mk->SetMarkerStyle( 21 ); //sets marker to a square, change to use TBox instead-AGE
126  //mk->SetMarkerSize( 0.5 + 0.5 * cmdE[i] );
127  mk->SetMarkerSize(0);
128  alpha = (cmdE[i] / 10.0);
129  if (alpha>=1) alpha = 1;
130  TBox *box = new TBox( vizX-0.05*cmdE[i], vizY-0.5, vizX, vizY+0.5 );
131  box->SetFillColor(210);
132  if ( name == "WCal Clusters" || name == "HCal CLusters" ){
133  box->SetFillColor(880);
134  mk->SetMarkerSize(1);
135  }
136  box->Draw("same");
137  }
138  if ( name == "FTT Clusters" && projType == kXY ){
139  mk->SetMarkerSize(0);
140  TLine XCluster;
141  XCluster.SetLineWidth(1);
142  XCluster.SetLineColor(9); //dark blue
143  TLine YCluster;
144  YCluster.SetLineWidth(1);
145  YCluster.SetLineColor(46); //dark red
146  float x0;
147  float x1;
148  float y0;
149  float y1;
150  if (vizX < 0){
151  x0 = -50;
152  x1 = 0;
153  } else if(vizX >= 0){
154  x0 = 0;
155  x1 = 50;
156  }
157  if (vizY < 0){
158  y0 = -50;
159  y1 = 0;
160  } else if (vizY >= 0){
161  y0 = 0;
162  y1 = 50;
163  }
164 
165  XCluster.DrawLine(vizX, y0, vizX, y1);
166  YCluster.DrawLine(x0, vizY, x1, vizY);
167 
168  }
169 
170  if ( cmdE != nullptr && (zIndex == 8 || projType != kRZSigned) ){ //EPD for RZ and EPD and FCS for XY
171  mk->SetMarkerStyle(21);
172  mk->SetMarkerSize( 0.005 * cmdE[i]);
173  }
174 
175  printf( "\tzIndex = %d -> color = %d \n", zIndex, slc );
176 
177  mk->SetMarkerColorAlpha( slc, alpha );
178  if ( zIndex >= 1 ){
179  mk->SetMarkerColorAlpha( slc, alpha );
180  lgZ = true;
181  }
182 
183  //change marker style etc. for projected points only-AGE
184  /*if( name == "Proj" ){
185  mk->SetMarkerStyle(23);
186  mk->SetMarkerColor(2);
187  mk->SetMarkerSize(1.5);
188  }*/
189 
190  mk->Draw("same");
191 
192  }
193 
194  if ( lgZ ){
195  /*for ( int i = 1; i < 4; i++){
196  TMarker *mk1 = new TMarker( LegendX, LegendY, 20 );
197  mk1->SetMarkerSize( 2.5 );
198  mk1->SetMarkerColorAlpha( zColors[i], 0.5 );
199  mk1->Draw("same");
200  t->DrawText( LegendX + 2, LegendY - 0.5, TString::Format( "%s: %d", name, i ) );
201 
202  LegendY -= 5;
203  }*/
204  if (name == "FST"){
205  for ( int i = 1; i < 4; i++ ){
206  TMarker *mk1 = new TMarker( LegendX, LegendY, 20 );
207  mk1->SetMarkerSize( 2.5 );
208  mk1->SetMarkerColorAlpha( zColors[i], 0.5 );
209  mk1->Draw("same");
210  t->DrawText( LegendX + 2, LegendY - 0.5, TString::Format( "%s: %d", name, i ) );
211 
212  LegendY -= 5;
213  }
214  } else if (name == "FTT"){
215  for ( int i = 1; i < 5; i++ ){
216  TMarker *mk1 = new TMarker( LegendX, LegendY, 20 );
217  mk1->SetMarkerSize( 2.5 );
218  mk1->SetMarkerColorAlpha( zColors[i+3], 0.5 );
219  mk1->Draw("same");
220  t->DrawText( LegendX + 2, LegendY - 0.5, TString::Format( "%s: %d", name, i ) );
221 
222  LegendY -= 5;
223  }
224  } else if (name == "FCS"){
225  for ( int i = 1; i < 3; i++ ){
226  TMarker *mk1 = new TMarker( LegendX, LegendY, 20 );
227  mk1->SetMarkerSize( 2.5 );
228  mk1->SetMarkerColorAlpha( zColors[i], 0.5 );
229  mk1->Draw("same");
230  t->DrawText( LegendX + 2, LegendY - 0.5, TString::Format( "%s: %d", name, i ) );
231 
232  LegendY -= 5;
233  }
234  }
235 
236  } else {
237  TMarker *mk1 = new TMarker( LegendX, LegendY, 20 );
238  mk1->SetMarkerSize( 2.5 );
239  mk1->SetMarkerColor( color );
240  mk1->Draw("same");
241  t->DrawText( LegendX + 2, LegendY - 0.5, TString::Format( "%s:", name ) );
242 
243  LegendY -= 5;
244  }
245 }
246 
247 //add function for seed finding-AGE
248 void viz_seed( const char* name, const char* cmd, int eventIndex, ProjectionType projType = kRZSigned){
249 
250  fwd->Draw( "reco.id", "", "goff", 1, eventIndex );
251  int nTrks = fwd->GetSelectedRows();
252 
253  TLine line;
254  line.SetLineWidth(2);
255  line.SetLineColor(1);
256  TLine proj;
257  for (int i = 0; i < nTrks; i++){ //loop over number of tracks
258 
259  fwd->Draw( TString::Format("reco[%d].projs.mXYZ.fX:reco[%d].projs.mXYZ.fY:reco[%d].projs.mXYZ.fZ", i, i, i), "", "goff", 1, eventIndex );
260  auto nHits = fwd->GetSelectedRows();
261  auto projX = fwd->GetV1();
262  auto projY = fwd->GetV2();
263  auto projZ = fwd->GetV3();
264  /*std::vector<double> projX;
265  std::vector<double> projY;
266  std::vector<double> projZ;
267 
268  for (int hit = 0; hit < nHits; ++hit) {
269  projX.push_back(fwd->GetV1()[hit]);
270  projY.push_back(fwd->GetV2()[hit]);
271  projZ.push_back(fwd->GetV3()[hit]);
272  }*/
273 
274  //select only the seeds that have same track id as track number
275  fwd->Draw( cmd, TString::Format("seeds.trackId == %d", i), "goff", 1, eventIndex );
276  //fwd->Draw( TString::Format("seeds[%d].pos.fX:seeds[%d].pos.fY:seeds[%d].pos.fZ", i, i, i), "", "goff", 1, eventIndex );
277  int numSeeds = fwd->GetSelectedRows();
278  auto newX = fwd->GetV1();
279  auto newY = fwd->GetV2();
280  auto newZ = fwd->GetV3();
281 
282  for ( int j = 0; j < numSeeds - 1; j++){
283 
284  float x0 = xx( newX[j], newY[j], newZ[j], projType );
285  float y0 = yy( newX[j], newY[j], newZ[j], projType );
286  float x1 = xx( newX[j+1], newY[j+1], newZ[j+1], projType );
287  float y1 = yy( newX[j+1], newY[j+1], newZ[j+1], projType );
288 
289  /*if ( fabs(x0 - projX[j+1]) <= 1 ){
290  line.SetLineColor(1);
291  }*/
292 
293  line.DrawLine(x0, y0, x1, y1);
294  }
295 
296  }
297 }
298 
299 //add function for track projection
300 void viz_proj( int eventIndex, ProjectionType projType = kRZSigned, bool markers = false ){
301 
302  //get number of tracks
303  fwd->Draw( "reco.id", "", "goff", 1, eventIndex); //check if this is correct data to use to get nTrks
304  int nTrks = fwd->GetSelectedRows();
305 
306  //create line for track
307  TLine trkproj;
308  trkproj.SetLineWidth(1.5);
309  trkproj.SetLineColor(24); //light green
310 
311  //loop over each track in the event
312  for ( int i = 0; i < nTrks; i++ ){
313 
314  //get hits in i'th track
315  fwd->Draw( TString::Format("reco[%d].projs.mXYZ.fX:reco[%d].projs.mXYZ.fY:reco[%d].projs.mXYZ.fZ", i, i, i), "", "goff", 1, eventIndex );
316  auto nHits = fwd->GetSelectedRows();
317  auto projX = fwd->GetV1();
318  auto projY = fwd->GetV2();
319  auto projZ = fwd->GetV3();
320 
321 
322  //loop over hits in each track
323  for ( int j = 0; j < nHits - 1; j++ ){
324 
325  //assign the x and y positions of the track projection
326  float x0 = xx( projX[j], projY[j], projZ[j], projType );
327  float y0 = yy( projX[j], projY[j], projZ[j], projType );
328  float x1 = xx( projX[j+1], projY[j+1], projZ[j+1], projType );
329  float y1 = yy( projX[j+1], projY[j+1], projZ[j+1], projType );
330 
331  /*trkproj.SetLineColor(i+2);
332  if (i == 0 || i == 10 ){
333  trkproj.SetLineColor(1);
334  }*/
335  trkproj.DrawLine(x0, y0, x1, y1);
336  }
337 
338  //add markers
339  if (markers){
340  for ( int j = 0; j < nHits; j++ ){
341 
342  float x = xx( projX[j], projY[j], projZ[j], projType );
343  float y = yy( projX[j], projY[j], projZ[j], projType );
344 
345  TMarker *mk = new TMarker( x, y, 20);
346  mk->SetMarkerStyle(23);
347  mk->SetMarkerColor(2);
348  mk->SetMarkerSize(1.5);
349 
350  mk->Draw("same");
351  }
352  }
353  }
354  if (markers){
355  //add marker to the legend
356  TText *t = new TText(.5,.5,"Hello World !");
357  t->SetTextColor(kBlack);
358  t->SetTextFont(43);
359  t->SetTextSize(20);
360  //make this more functional?
361  if ( projType == kRZSigned ){
362  LegendY = 5;
363  } else if (projType == kXY ){
364  LegendY = -15;
365  }
366  TMarker *mk1 = new TMarker( LegendX, LegendY, 23 );
367  mk1->SetMarkerSize( 2.5 );
368  mk1->SetMarkerColor( 2 );
369  mk1->Draw("same");
370  t->DrawText( LegendX + 2, LegendY - 0.5, TString::Format( "Projected Hits ") );
371  }
372 
373 } //end of fn
374 
375 
376 //add function to compare lines
377 //float comp_lines()
378 
379 
380 float statTextY = 0.97;
381 void n() { statTextY -= 0.05; }
382 void viz_stats( int eventIndex ){
383  statTextY = 0.97;
384  TText text;
385  text.SetTextFont(43);
386  text.SetTextSize(36);
387 
388 
389  /*fwd->Draw( "fstX:fstY:fstZ", "", "goff", 1, eventIndex );
390  int numEpd = fwd->GetSelectedRows();
391  fwd->Draw( "fttX:fttY:fttZ", "", "goff", 1, eventIndex );
392  int numEpd = fwd->GetSelectedRows();
393  fwd->Draw( "epdX:epdY:epdZ", "", "goff", 1, eventIndex );
394  int numEpd = fwd->GetSelectedRows();
395  fwd->Draw( "fcsX:fcsY:fcsZ", "", "goff", 1, eventIndex );
396  int numEpd = fwd->GetSelectedRows();*/
397 
398  fwd->Draw( "reco.id", "", "goff", 1, eventIndex );
399  int numTracks = fwd->GetSelectedRows();
400  fwd->Draw( "fst.pos.fX:fst.pos.fY:fst.pos.fZ", "", "goff", 1, eventIndex );
401  int numFst = fwd->GetSelectedRows();
402  fwd->Draw( "ftt.pos.fX:ftt.pos.fY:ftt.pos.fZ", "", "goff", 1, eventIndex );
403  int numFtt = fwd->GetSelectedRows();
404  //fwd->Draw( "EPD hits", "", "goff", 1, eventIndex );
405  //int numEpd = fwd->GetSelectedRows();
406  fwd->Draw( "wcalHits.starXYZ.fX:wcalHits.starXYZ.fY:wcalHits.starXYZ.fZ", "", "goff", 1, eventIndex );
407  int numWcalHits = fwd->GetSelectedRows();
408  fwd->Draw( "hcalHits.starXYZ.fX:hcalHits.starXYZ.fY:hcalHits.starXYZ.fZ", "", "goff", 1, eventIndex );
409  int numHcalHits = fwd->GetSelectedRows();
410  fwd->Draw( "wcalClusters.pos.fX:wcalClusters.pos.fY:wcalClusters.pos.fZ", "", "goff", 1, eventIndex );
411  int numWcal = fwd->GetSelectedRows();
412  fwd->Draw( "hcalClusters.pos.fX:hcalClusters.pos.fY:hcalClusters.pos.fZ", "", "goff", 1, eventIndex );
413  int numHcal = fwd->GetSelectedRows();
414 
415  text.DrawTextNDC( 0.05, statTextY, TString::Format("Event : %d", eventIndex) ); n();
416  text.DrawTextNDC( 0.05, statTextY, TString::Format("Tracks : %d", numTracks) ); n();
417  text.DrawTextNDC( 0.05, statTextY, TString::Format("FST Hits : %d", numFst) ); n();
418  text.DrawTextNDC( 0.05, statTextY, TString::Format("FTT Hits : %d", numFtt) ); n();
419  //text.DrawTextNDC( 0.05, statTextY, TString::Format("EPD Hits : %d", numEpd) ); n();
420  //text.DrawTextNDC( 0.05, statTextY, TString::Format("WCal Hits : %d", numWcalHits) ); n();
421  //text.DrawTextNDC( 0.05, statTextY, TString::Format("HCal Hits : %d", numHcalHits) ); n();
422  text.DrawTextNDC( 0.05, statTextY, TString::Format("WCal Clusters : %d", numWcal) ); n();
423  text.DrawTextNDC( 0.05, statTextY, TString::Format("HCal Clusters : %d", numHcal) ); n();
424 
425  //print reco statistics
426  /*fwd->Draw( "reco.reco.projs.mXYZ:fX:reco.reco.projs.mXYZ:fY:reco.reco.projs.mXYZ:fZ", "", "goff", 1, eventIndex );
427  int numReco = fwd->GetSelectedRows();
428  statTextY = 0.92;
429  text.DrawTextNDC( 0.35, statTextY, TString::Format("Reco Hits : %d", numReco) ); n();*/
430 
431 }
432 
433 
434 int viz_event( int eventIndex, ProjectionType projType = kRZSigned ){
435 
436  if ( projType == kRZSigned || projType == kXZ || projType == kYZ ){
437  hFrame = new TH2F( "hFrame", ";z;R", 520, -30, 900, 260, -130, 130 );
438  hFrame->SetTitle( "Event Visualization (RZ Signed)" );
439  LegendX = 10;
440  LegendY = 60;
441  } else if ( projType == kRZ ){
442  hFrame = new TH2F( "hFrame", ";z;R", 500, 0, 900, 60, 0, 60 );
443  hFrame->SetTitle( "Event Visualization (RZ Signed)" );
444  LegendX = 10;
445  LegendY = 60;
446  } else if ( projType == kXY ){
447  hFrame = new TH2F( "hFrame", ";x;y", 5, -50, 50, 5, -50, 50 );
448  hFrame->SetTitle( "Event Visualization (XY)" );
449  LegendX = -40;
450  LegendY = 40;
451  }
452 
453  printf( "Visualizing Event %d \n", eventIndex );
454 
455  fwd->Draw( "reco.id", "", "", 1, eventIndex );
456  int nTrk = fwd->GetSelectedRows(); //number of reco tracks
457  printf( "Event has %d Tracks \n", nTrk ); //changed from %lld to %d to eliminate an error that occurred-AGE
458 
459 
460  hFrame->Draw("colz");
461 
462  //add detector locations
463  if (projType == kRZSigned){
464 
465  TLine *fst1 = new TLine(151.75, -28.3, 151.75, 28.3);
466  fst1->SetLineWidth(2);
467  fst1->SetLineColor(12);
468  fst1->Draw("same");
469  TLine *fst2 = new TLine(165.25, -28.3, 165.25, 28.3);
470  fst2->SetLineWidth(2);
471  fst2->SetLineColor(12);
472  fst2->Draw("same");
473  TLine *fst3 = new TLine(178.75, -28.3, 178.75, 28.3);
474  fst3->SetLineWidth(2);
475  fst3->SetLineColor(12);
476  fst3->Draw("same");
477 
478  TLine *ftt1 = new TLine(281, -60, 281, 60);
479  ftt1->SetLineWidth(2);
480  ftt1->SetLineColor(12);
481  ftt1->Draw("same");
482  TLine *ftt2 = new TLine(304, -60, 304, 60);
483  ftt2->SetLineWidth(2);
484  ftt2->SetLineColor(12);
485  ftt2->Draw("same");
486  TLine *ftt3 = new TLine(325, -60, 325, 60);
487  ftt3->SetLineWidth(2);
488  ftt3->SetLineColor(12);
489  ftt3->Draw("same");
490  TLine *ftt4 = new TLine(348, -60, 348, 60);
491  ftt4->SetLineWidth(2);
492  ftt4->SetLineColor(12);
493  ftt4->Draw("same");
494 
495  TLine *epd = new TLine(375, -130, 375, 130);
496  epd->SetLineWidth(2);
497  epd->SetLineColor(12);
498  epd->Draw("same");
499 
500  //add tboxes for fcs
501  TBox *wcal = new TBox( 720, -120, 735, 120 );
502  wcal->SetFillColorAlpha(4, 0.2);
503  wcal->Draw("same");
504  TBox *hcal = new TBox( 800, -120, 815, 120 );
505  hcal->SetFillColorAlpha(2, 0.2);
506  hcal->Draw("same");
507 
508  }
509 
510  //viz_points( "FST", "fstX:fstY:fstZ", kGray, eventIndex, projType/*, true*/ );
511  //viz_points( "EPD", "epdX:epdY:epdZ:epdE", kBlue, eventIndex, projType/*, true*/ ); //epd hits (only in fwdtree2)-AGE
512  //viz_points( "FCS", "fcsX:fcsY:fcsZ:fcsE", kGreen, eventIndex, projType/*, true*/ );
513  viz_points( "FST", "fst.pos.fX:fst.pos.fY:fst.pos.fZ", kGray, eventIndex, projType, true );
514  viz_points( "FTT", "ftt.pos.fX:ftt.pos.fY:ftt.pos.fZ", kRed, eventIndex, projType );
515  viz_points( "FTT Clusters", "fttClusters.pos.fX:fttClusters.pos.fY:fttClusters.pos.fZ", kRed, eventIndex, projType );
516  viz_points( "WCal Hits", "wcalHits.starXYZ.fX:wcalHits.starXYZ.fY:wcalHits.starXYZ.fZ+705:100*wcalHits.energy", kBlue, eventIndex, projType );
517  viz_points( "HCal Hits", "hcalHits.starXYZ.fX:hcalHits.starXYZ.fY:hcalHits.starXYZ.fZ+785:100*wcalClusters.mEnergy", kTeal, eventIndex, projType/*, true*/ );
518  viz_points( "WCal Clusters", "wcalClusters.pos.fX:wcalClusters.pos.fY:wcalClusters.pos.fZ+705:100*wcalClusters.mEnergy", kViolet, eventIndex, projType/*, true*/ );
519  viz_points( "HCal Clusters", "hcalClusters.pos.fX:hcalClusters.pos.fY:hcalClusters.pos.fZ+785:100*wcalClusters.mEnergy", kGreen, eventIndex, projType/*, true*/ ); //add fcs hits-AGE
520 
521  viz_seed( "Seeds", "seeds.pos.fX:seeds.pos.fY:seeds.pos.fZ", eventIndex, projType );
522  //viz_proj( eventIndex, projType, false);
523  //viz_points( "Proj", "reco.reco.projs.mXYZ.fX:reco.reco.projs.mXYZ.fY:reco.reco.projs.mXYZ.fZ", kRed, eventIndex, projType);
524  return nTrk;
525 }
526 
527 
528 //change to name of file being used-AGE
529 void viz( TString fn = "fwdtree5.root", int view = kXY) {
530 
531  ProjectionType pjt = (ProjectionType)view;
532  fData = new TFile( fn );
533  fwd = (TTree*)fData->Get( "fwd" );
534 
535  gStyle->SetOptStat(0);
536 
537  float canWidth = 19 * 100;
538  float canHeight = 16 * 100;
539  gCan = new TCanvas( "g", "", canWidth, canHeight );
540  gCan->SetMargin( 0, 0, 0, 0);
541  gCan->cd();
542  gCan->Draw();
543 
544  padRZ = new TPad( "padRZ", "", 0.0, 0.5, 0.95, 0.99 );
545  padRZ->SetMargin( .05,.01,.05,.01 );
546  padRZ->Draw("same");
547  padRZ->cd();
548 
549  gCan->cd();
550  padXY = new TPad( "padXY", "", 0.0, 0.0, 0.5, 0.5 );
551  padXY->SetMargin( .1,.02,.05,.01 );
552  padXY->Draw("same");
553  padXY->cd();
554 
555  gCan->cd();
556  padStat = new TPad( "padStat", "", 0.5, 0.0, 1.0, 0.5 );
557  padStat->SetMargin( .1,.02,.05,.01 );
558  padStat->Draw("same");
559  padStat->cd();
560 
561  // gPad->SetMargin(0.1, 0.05, 0.15, 0.05);
562 
563  int nEvents = fwd->GetEntries();
564  // nEvents = 1;
565  for ( int iEvent = 0; iEvent < nEvents; iEvent ++ ){
566 
567  printf( "Event: %d\n", iEvent );
568  padRZ->cd();
569 
570  //TBox *wcal = new TBox( 720, -60, 735, 60 );
571  //wcal->SetFillColor(4);
572  //wcal->Draw("");
573  int nTrk = viz_event( iEvent, kRZSigned );
574 
575 
576  padXY->cd();
577  viz_event( iEvent, kXY );
578  if (nTrk > -1){
579  padRZ->Update();
580  padXY->Update();
581 
582  padStat->cd();
583  padStat->Clear();
584  viz_stats( iEvent ); //changed to provide number of tracks as well-AGE
585  padStat->Update();
586  gCan->Update();
587  gCan->Print( TString::Format( "out_event%d.pdf", iEvent ) );
588  }
589 
590 
591  // cin.get();
592  // if (viz_event( iEvent ) > 0 )
593  // break;
594 
595  hFrame->Reset();
596  }
597 
598 }