StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFtpcDisplay.cc
1 // $Id: StFtpcDisplay.cc,v 1.20 2015/05/21 21:53:38 genevb Exp $
2 // $Log: StFtpcDisplay.cc,v $
3 // Revision 1.20 2015/05/21 21:53:38 genevb
4 // Fixing memory leak (note: vers. 1.16 modifcations for old compilers no longer necessary)
5 //
6 // Revision 1.19 2009/08/25 19:41:19 fine
7 // fix the compilation issues under SL5_64_bits gcc 4.3.2
8 //
9 // Revision 1.18 2007/01/15 08:23:01 jcs
10 // replace printf, cout and gMesMgr with Logger commands
11 //
12 // Revision 1.17 2003/09/16 15:27:01 jcs
13 // removed inline as it would leave a few undefined reference
14 //
15 // Revision 1.16 2003/01/16 18:04:32 oldi
16 // Bugs eliminated. Now it compiles on Solaris again.
17 // Split residuals for global and primary fit.
18 //
19 // Revision 1.15 2002/11/06 13:45:14 oldi
20 // Code clean ups.
21 //
22 // Revision 1.14 2002/10/11 15:45:07 oldi
23 // Get FTPC geometry and dimensions from database.
24 // No field fit activated: Returns momentum = 0 but fits a helix.
25 // Bug in TrackMaker fixed (events with z_vertex > outer_ftpc_radius were cut).
26 // QA histograms corrected (0 was supressed).
27 // Code cleanup (several lines of code changed due to *params -> Instance()).
28 // cout -> gMessMgr.
29 //
30 // Revision 1.13 2002/04/29 15:49:55 oldi
31 // All tracking parameters moved to StFtpcTrackingParameters.cc/hh.
32 // In a future version the actual values should be moved to an .idl file (the
33 // interface should be kept as is in StFtpcTrackingParameters.cc/hh).
34 //
35 // Revision 1.12 2002/04/05 16:50:17 oldi
36 // Cleanup of MomentumFit (StFtpcMomentumFit is now part of StFtpcTrack).
37 // Each Track inherits from StHelix, now.
38 // Therefore it is possible to calculate, now:
39 // - residuals
40 // - vertex estimations obtained by back extrapolations of FTPC tracks
41 // Chi2 was fixed.
42 // Many additional minor (and major) changes.
43 //
44 // Revision 1.11 2001/09/27 14:00:35 oldi
45 // Small change to avoid ambiguous call of TPolyMarker() constructor.
46 //
47 // Revision 1.10 2001/07/13 18:00:50 oldi
48 // New function WriteData() added. It writes TPolyMarkers and TPolyLine3Ds to
49 // a file which can be used to display results (pictures) offline.
50 //
51 // Revision 1.9 2001/07/12 13:02:25 oldi
52 // Boundaries of FTPC set to correct values (7.73, 30.05).
53 //
54 // Revision 1.8 2001/04/25 17:53:42 perev
55 // HPcorrs
56 //
57 // Revision 1.7 2000/11/10 18:37:23 oldi
58 // It is now possible to display tracks which should be longer (so called 'short tracks').
59 //
60 // Revision 1.6 2000/07/18 21:22:16 oldi
61 // Changes due to be able to find laser tracks.
62 // Cleanup: - new functions in StFtpcConfMapper, StFtpcTrack, and StFtpcPoint
63 // to bundle often called functions
64 // - short functions inlined
65 // - formulas of StFormulary made static
66 // - avoid streaming of objects of unknown size
67 // (removes the bunch of CINT warnings during compile time)
68 // - two or three minor bugs cured
69 //
70 // Revision 1.5 2000/06/07 11:33:01 oldi
71 // Changed 0 pointers to NULL pointers.
72 // Names of variables changed to make the code easier to understand.
73 // Major changes to allow to display unclean, split and good (found) tracks and
74 // clusters with different colors.
75 // Major changes to allow to display electron, non main vertex and good (GEANT) \tracks and clusters with different colors.
76 // Allow to display specific momentum ranges only.
77 //
78 // Revision 1.4 2000/05/15 14:28:09 oldi
79 // problem of preVertex solved: if no main vertex is found (z = NaN) StFtpcTrackMaker stops with kStWarn,
80 // refitting procedure completed and included in StFtpcTrackMaker (commented),
81 // new constructor of StFtpcVertex due to refitting procedure,
82 // minor cosmetic changes
83 //
84 // Revision 1.3 2000/05/12 12:59:13 oldi
85 // removed delete operator for mSegment in StFtpcConfMapper (mSegment was deleted twice),
86 // add two new constructors for StFtpcTracker to be able to refit already existing tracks,
87 // minor cosmetics
88 //
89 // Revision 1.2 2000/05/11 15:14:43 oldi
90 // Changed class names *Hit.* due to already existing class StFtpcHit.cxx in StEvent
91 //
92 // Revision 1.1 2000/05/10 13:39:13 oldi
93 // Initial version of StFtpcTrackMaker
94 //
95 
96 //----------Author: Markus D. Oldenburg
97 //----------Last Modified: 17.10.2000
98 //----------Copyright: &copy MDO Production 2000
99 
100 #include "StFtpcDisplay.hh"
101 #include "StFtpcTrackingParams.hh"
102 #include "StFtpcConfMapPoint.hh"
103 #include "StFtpcTrack.hh"
104 #include "TMath.h"
105 #include "TSystem.h"
106 #include "TH1.h"
107 #include "TH2.h"
108 #include "TH3.h"
109 #include "TPolyMarker.h"
110 #include "TPolyMarker3D.h"
111 #include "TLine.h"
112 #include "TGraph.h"
113 #include "TMarker.h"
114 #include "TTUBE.h"
115 #include "TBRIK.h"
116 #include "TFile.h"
117 //#include "TCONE.h"
118 
119 
121 // //
122 // StFtpcDisplay class - displays tracks and clusters. //
123 // //
125 
126 
127 ClassImp(StFtpcDisplay)
128 
129 
131 {
132  // Default constructor.
133 
134  mNumRowSegment = StFtpcTrackingParams::Instance()->RowSegments();
135  mNumPhiSegment = StFtpcTrackingParams::Instance()->PhiSegments();
136  mNumEtaSegment = StFtpcTrackingParams::Instance()->EtaSegments();
137  mBounds = mNumRowSegment * mNumPhiSegment * mNumEtaSegment;
138 
139  mTrack = 0;
140  mHit = 0;
141  mGeantTrack = 0;
142  mGeantHit = 0;
143 
144  mX_Y_Z = 0;
145  mX_Y_Zplus = 0;
146  mX_Y_Zminus = 0;
147 
148  mNode0 = 0;
149  mNode1 = 0;
150  mNode2 = 0;
151 
152  current_line = 0;
153  found_line = 0;
154  geant_line = 0;
155 
156  found_hit = new TPolyMarker3D();
157  found_hit_plus = new TPolyMarker3D();
158  found_hit_minus = new TPolyMarker3D();
159  geant_hit = new TPolyMarker3D();
160  geant_hit_plus = new TPolyMarker3D();
161  geant_hit_minus = new TPolyMarker3D();
162  unused_hit = new TPolyMarker3D();
163  unused_hit_plus = new TPolyMarker3D();
164  unused_hit_minus = new TPolyMarker3D();
165  wrong_hit = new TPolyMarker3D();
166  wrong_hit_plus = new TPolyMarker3D();
167  wrong_hit_minus = new TPolyMarker3D();
168 
169  found_value = 0;
170  found_value_minus = 0;
171  found_value_plus = 0;
172  unused_value = 0;
173  unused_value_minus = 0;
174  unused_value_plus = 0;
175  geant_value = 0;
176  geant_value_minus = 0;
177  geant_value_plus = 0;
178  unused_value = 0;
179  unused_value_minus = 0;
180  unused_value_plus = 0;
181  wrong_value = 0;
182  wrong_value_minus = 0;
183  wrong_value_plus = 0;
184 }
185 
186 
187 StFtpcDisplay::StFtpcDisplay(TObjArray *hits, TObjArray *tracks)
188 {
189  // Ususal constructor.
190 
191  mNumRowSegment = StFtpcTrackingParams::Instance()->RowSegments();
192  mNumPhiSegment = StFtpcTrackingParams::Instance()->PhiSegments();
193  mNumEtaSegment = StFtpcTrackingParams::Instance()->EtaSegments();
194  mBounds = mNumRowSegment * mNumPhiSegment * mNumEtaSegment;
195 
196  mTrack = tracks;
197  mHit = hits;
198  mGeantHit = 0;
199  mGeantTrack = 0;
200 
201  mX_Y_Z = 0;
202  mX_Y_Zplus = 0;
203  mX_Y_Zminus = 0;
204 
205  mNode0 = 0;
206  mNode1 = 0;
207  mNode2 = 0;
208 
209  current_line = 0;
210  found_line = 0;
211  geant_line = 0;
212 
213  found_hit = new TPolyMarker3D();
214  found_hit_plus = new TPolyMarker3D();
215  found_hit_minus = new TPolyMarker3D();
216  geant_hit = new TPolyMarker3D();
217  geant_hit_plus = new TPolyMarker3D();
218  geant_hit_minus = new TPolyMarker3D();
219  unused_hit = new TPolyMarker3D();
220  unused_hit_plus = new TPolyMarker3D();
221  unused_hit_minus = new TPolyMarker3D();
222  wrong_hit = new TPolyMarker3D();
223  wrong_hit_plus = new TPolyMarker3D();
224  wrong_hit_minus = new TPolyMarker3D();
225 
226  found_value = 0;
227  found_value_minus = 0;
228  found_value_plus = 0;
229  unused_value = 0;
230  unused_value_minus = 0;
231  unused_value_plus = 0;
232  geant_value = 0;
233  geant_value_minus = 0;
234  geant_value_plus = 0;
235  unused_value = 0;
236  unused_value_minus = 0;
237  unused_value_plus = 0;
238  wrong_value = 0;
239  wrong_value_minus = 0;
240  wrong_value_plus = 0;
241 }
242 
243 
244 StFtpcDisplay::StFtpcDisplay(TObjArray *hits, TObjArray *tracks, TObjArray *geanthits, TObjArray *geanttracks)
245 {
246  // Constructor for evaluator output.
247 
248  mNumRowSegment = StFtpcTrackingParams::Instance()->RowSegments();
249  mNumPhiSegment = StFtpcTrackingParams::Instance()->PhiSegments();
250  mNumEtaSegment = StFtpcTrackingParams::Instance()->EtaSegments();
251  mBounds = mNumRowSegment * mNumPhiSegment * mNumEtaSegment;
252 
253  mTrack = tracks;
254  mHit = hits;
255  mGeantTrack = geanttracks;
256  mGeantHit = geanthits;
257 
258  mX_Y_Z = 0;
259  mX_Y_Zplus = 0;
260  mX_Y_Zminus = 0;
261 
262  mNode0 = 0;
263  mNode1 = 0;
264  mNode2 = 0;
265 
266  current_line = 0;
267  found_line = 0;
268  geant_line = 0;
269 
270  found_hit = new TPolyMarker3D();
271  found_hit_plus = new TPolyMarker3D();
272  found_hit_minus = new TPolyMarker3D();
273  geant_hit = new TPolyMarker3D();
274  geant_hit_plus = new TPolyMarker3D();
275  geant_hit_minus = new TPolyMarker3D();
276  unused_hit = new TPolyMarker3D();
277  unused_hit_plus = new TPolyMarker3D();
278  unused_hit_minus = new TPolyMarker3D();
279  wrong_hit = new TPolyMarker3D();
280  wrong_hit_plus = new TPolyMarker3D();
281  wrong_hit_minus = new TPolyMarker3D();
282 
283  found_value = 0;
284  found_value_minus = 0;
285  found_value_plus = 0;
286  unused_value = 0;
287  unused_value_minus = 0;
288  unused_value_plus = 0;
289  geant_value = 0;
290  geant_value_minus = 0;
291  geant_value_plus = 0;
292  unused_value = 0;
293  unused_value_minus = 0;
294  unused_value_plus = 0;
295  wrong_value = 0;
296  wrong_value_minus = 0;
297  wrong_value_plus = 0;
298 }
299 
300 
301 StFtpcDisplay::~StFtpcDisplay()
302 {
303  // Destructor.
304 
305  DeleteAll();
306 
307  delete found_hit;
308  delete found_hit_plus;
309  delete found_hit_minus;
310  delete unused_value;
311  delete unused_value_minus;
312  delete unused_value_plus;
313  delete geant_hit;
314  delete geant_hit_plus;
315  delete geant_hit_minus;
316  delete unused_hit;
317  delete unused_hit_plus;
318  delete unused_hit_minus;
319  delete wrong_hit;
320  delete wrong_hit_plus;
321  delete wrong_hit_minus;
322 }
323 
324 
325 void StFtpcDisplay::WriteData(Char_t *filename)
326 {
327  // Writes clusters and tracks to file.
328 
329  TFile file(filename, "RECREATE");
330  file.cd();
331 
332  Float_t x[100];
333  Float_t y[100];
334  Float_t z[100];
335 
336  Int_t track_entries = mTrack->GetEntriesFast();
337 
338  StFtpcConfMapPoint *cluster;
340  found_line = new TPolyLine3D[track_entries];
341 
342  // loop over all tracks
343  for (Int_t tracks = 0; tracks < track_entries; tracks++) {
344  track = (StFtpcTrack *)mTrack->At(tracks);
345 
346  Int_t cluster_entries = track->GetNumberOfPoints();
347 
348  // loop over all clusters
349  for (Int_t clusters = 0; clusters < cluster_entries && clusters < 100; clusters++) {
350 
351  cluster = (StFtpcConfMapPoint *)track->GetHits()->At(clusters);
352 
353  // fill point array
354  x[clusters] = (Float_t)(cluster->GetX());
355  y[clusters] = (Float_t)(cluster->GetY());
356  z[clusters] = (Float_t)(cluster->GetZ());
357  }
358 
359  // fill PolyLine for this track
360  current_line = &(found_line[tracks]);
361  current_line = new TPolyLine3D(cluster_entries, x, y, z, "");
362  current_line->SetLineColor(3);
363 
364  current_line->Write();
365  delete current_line;
366  }
367 
368  Int_t cluster_anz = mHit->GetEntriesFast();
369 
370  // coordinates of clusters (+, -, both)
371  found_value_plus = new Float_t[3*cluster_anz];
372  found_value_minus = new Float_t[3*cluster_anz];
373  found_value = new Float_t[3*cluster_anz];
374  unused_value_plus = new Float_t[3*cluster_anz];
375  unused_value_minus = new Float_t[3*cluster_anz];
376  unused_value = new Float_t[3*cluster_anz];
377 
379  Int_t cl_plus = 0;
380  Int_t cl_minus = 0;
381  Int_t cl = 0;
382  Int_t ucl_plus = 0;
383  Int_t ucl_minus = 0;
384  Int_t ucl = 0;
385 
386  // loop over all clusters
387  for (Int_t i = 0; i < cluster_anz; i++) {
388  h = (StFtpcConfMapPoint *)mHit->At(i);
389 
390  if (h->GetUsage()) {
391  // fill (+, -, both) cluster arrays
392  found_value[cl++] = h->GetX();
393  found_value[cl++] = h->GetY();
394 
395  if ((found_value[cl++] = h->GetZ())>0) {
396  found_value_plus[cl_plus++] = h->GetX();
397  found_value_plus[cl_plus++] = h->GetY();
398  found_value_plus[cl_plus++] = h->GetZ();
399  }
400 
401  else {
402  found_value_minus[cl_minus++] = h->GetX();
403  found_value_minus[cl_minus++] = h->GetY();
404  found_value_minus[cl_minus++] = h->GetZ();
405  }
406  }
407 
408  else { // unused clusters
409  // fill (+, -, both) cluster arrays
410  unused_value[ucl++] = h->GetX();
411  unused_value[ucl++] = h->GetY();
412 
413  if ((unused_value[ucl++] = h->GetZ())>0) {
414  unused_value_plus[ucl_plus++] = h->GetX();
415  unused_value_plus[ucl_plus++] = h->GetY();
416  unused_value_plus[ucl_plus++] = h->GetZ();
417  }
418 
419  else {
420  unused_value_minus[ucl_minus++] = h->GetX();
421  unused_value_minus[ucl_minus++] = h->GetY();
422  unused_value_minus[ucl_minus++] = h->GetZ();
423  }
424  }
425  }
426 
427  // create PolyMarkers
428  found_hit->SetPolyMarker(cl/3, found_value, 1);
429  found_hit_plus->SetPolyMarker(cl_plus/3, found_value_plus, 1);
430  found_hit_minus->SetPolyMarker(cl_minus/3, found_value_minus, 1);
431  unused_hit->SetPolyMarker(ucl/3, unused_value, 1);
432  unused_hit_plus->SetPolyMarker(ucl_plus/3, unused_value_plus, 1);
433  unused_hit_minus->SetPolyMarker(ucl_minus/3, unused_value_minus, 1);
434 
435  // set colors
436  found_hit->SetMarkerColor(2);
437  found_hit_plus->SetMarkerColor(2);
438  found_hit_minus->SetMarkerColor(2);
439  unused_hit->SetMarkerColor(5);
440  unused_hit_plus->SetMarkerColor(5);
441  unused_hit_minus->SetMarkerColor(5);
442 
443  found_hit->Write();
444  found_hit_plus->Write();
445  found_hit_minus->Write();
446  unused_hit->Write();
447  unused_hit_plus->Write();
448  unused_hit_minus->Write();
449 
450  file.Close();
451 }
452 
453 
454 void StFtpcDisplay::TrackInfo()
455 {
456  // Information about a specific track.
457 
458  Char_t mode;
459  Int_t address;
460  Int_t number;
461 
462  TCanvas *track_canvas = new TCanvas("track_canvas", "Tracks", 1580, 600);
463  track_canvas->Divide(3,1);
464  TH2F *phi_frame = new TH2F("phi_frame", "phi_frame", 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius(), 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius());
465  TH2F *eta_frame1 = new TH2F("eta_frame1", "eta_frame1", 120, -270, -150, 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius());
466  TH2F *eta_frame2 = new TH2F("eta_frame2", "eta_frame2", 120, 150, 270, 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius());
467 
468  TH2F *circle_frame = new TH2F("circle_frame", "circle_frame", 60, -0.15, 0.15, 60, -0.15, 0.15);
469  TH2F *z_frame = new TH2F("z_frame", "z_frame", 540, -270, 270, 700, -7, 7);
470 
471  TCanvas *fit_canvas = new TCanvas("fit_canvas", "Conformal Mapping Coordinates", 1000, 600);
472  fit_canvas->Divide(2,1);
473 
474  track_canvas->cd(1);
475  gPad->SetGridx();
476  gPad->SetGridy();
477  phi_frame->Draw();
478  track_canvas->cd(2);
479  gPad->SetGridx();
480  gPad->SetGridy();
481  eta_frame1->Draw();
482  track_canvas->cd(3);
483  gPad->SetGridx();
484  gPad->SetGridy();
485  eta_frame2->Draw();
486 
487  TLine *phi_line = new TLine[mNumPhiSegment];
488 
489  {for (Int_t i=0; i<mNumPhiSegment; i++) {
490  phi_line[i] = TLine(0., 0., StFtpcTrackingParams::Instance()->OuterRadius()*TMath::Cos(i*2*TMath::Pi()/mNumPhiSegment),
491  StFtpcTrackingParams::Instance()->OuterRadius()*TMath::Sin(i*2*TMath::Pi()/mNumPhiSegment));
492  }}
493 
494  TLine *eta_line = new TLine[2*mNumEtaSegment+2];
495 
496  Double_t eta_value;
497  {for (Int_t i=0; i<=mNumEtaSegment/2.; i++) {
498 
499  eta_value = (4.165-2.396)/(mNumEtaSegment/2.) * i + 2.396;
500 
501  eta_line[i*2] = TLine(-270*TMath::Cos(TMath::ATan(TMath::Exp(-eta_value))*2.),
502  -270*TMath::Sin(TMath::ATan(TMath::Exp(-eta_value))*2.),
503  270*TMath::Cos(TMath::ATan(TMath::Exp(-eta_value))*2.),
504  270*TMath::Sin(TMath::ATan(TMath::Exp(-eta_value))*2.));
505 
506  eta_line[2*i+1] = TLine( 270*TMath::Cos(TMath::ATan(TMath::Exp(-eta_value))*2.),
507  -270*TMath::Sin(TMath::ATan(TMath::Exp(-eta_value))*2.),
508  -270*TMath::Cos(TMath::ATan(TMath::Exp(-eta_value))*2.),
509  270*TMath::Sin(TMath::ATan(TMath::Exp(-eta_value))*2.));
510  }}
511 
512  TObjArray *hits;
513  Int_t trackcluster;
514  Int_t entries = mTrack->GetEntriesFast();
515 
516  TPolyMarker *phi_track = 0;
517  TPolyMarker *eta_track = 0;
518 
519  TPolyMarker *circle_track = 0;
520  TPolyMarker *z_track = 0;
521 
522  StFtpcTrack *track;
523 
524 // The following cout's are online prompts - not Logger messages!
525 
526  while (kTRUE) {
527 
528  cout << "Mode: ";
529  cin >> mode;
530 
531  switch (mode) {
532 
533  // Mode = s skip this event
534  case 's':
535  return;
536 
537  // Mode = t display track
538  // Number = number of track to be displayed
539  case 't':
540  cout << "Number: ";
541  cin >> number;
542 
543  if (number > entries-1) {
544  cout << "Only " << entries << " Tracks in this event found!" << endl;
545  continue;
546  }
547 
548  track = (StFtpcTrack *)mTrack->At(number);
549 
550  hits = (TObjArray *)(track->GetHits());
551  trackcluster = hits->GetEntriesFast();
552 
553  if (phi_track) delete phi_track;
554  phi_track = new TPolyMarker(trackcluster, (Float_t*)0, (Float_t*)0, "");
555  phi_track->SetMarkerStyle(4);
556  phi_track->SetMarkerSize(0.4);
557 
558  if (eta_track) delete eta_track;
559  eta_track = new TPolyMarker(trackcluster, (Float_t*)0, (Float_t*)0, "");
560  eta_track->SetMarkerStyle(4);
561  eta_track->SetMarkerSize(0.4);
562 
563  if (circle_track) delete circle_track;
564  circle_track = new TPolyMarker(trackcluster, (Float_t*)0, (Float_t*)0, "");
565  circle_track->SetMarkerStyle(4);
566  circle_track->SetMarkerSize(0.4);
567 
568  if (z_track) delete z_track;
569  z_track = new TPolyMarker(trackcluster, (Float_t*)0, (Float_t*)0, "");
570  z_track->SetMarkerStyle(4);
571  z_track->SetMarkerSize(0.4);
572 
573 
574  cout << "Track: " << number << " Cluster: " << trackcluster << endl;
576  {for (Int_t j = 0; j < trackcluster; j++) {
577 
578  h = (StFtpcConfMapPoint *)hits->At(j);
579  cout << "#" << h->GetHitNumber() << " address:" << h << endl;
580  phi_track->SetPoint(j, h->GetX(), h->GetY());
581  eta_track->SetPoint(j, h->GetZ(), h->GetY());
582  circle_track->SetPoint(j, h->GetXprime(), h->GetYprime());
583 
584  z_track->SetPoint(j, h->GetZv(), (track->GetRadius() * TMath::ASin((h->GetY() - track->GetCenterY()) / track->GetRadius()) - track->GetAlpha0())/1000.);
585  cout << "z: " << h->GetZv() << ", " << (track->GetRadius() * TMath::ASin((h->GetY() - track->GetCenterY()) / track->GetRadius()) - track->GetAlpha0())/1000. << endl;
586  }}
587 
588  fit_canvas->cd(1);
589  circle_frame->Draw();
590  circle_track->Draw("same");
591  fit_canvas->cd(2);
592  z_frame->Draw();
593  z_track->Draw("same");
594  fit_canvas->Update();
595 
596  track_canvas->cd(1);
597  phi_frame->Draw();
598 
599  {for (Int_t i=0; i<mNumPhiSegment; i++) {
600  phi_line[i].Draw("same");
601  }}
602 
603  phi_track->Draw("same");
604 
605  track_canvas->cd(2);
606  eta_frame1->Draw();
607 
608  {for (Int_t i=0; i<2*mNumEtaSegment+2; i++) {
609  eta_line[i].Draw("same");
610  }}
611 
612  eta_track->Draw("same");
613 
614  track_canvas->cd(3);
615  eta_frame2->Draw();
616 
617  {for (Int_t i=0; i<2*mNumEtaSegment+2; i++) {
618  eta_line[i].Draw("same");
619  }}
620 
621  eta_track->Draw("same");
622  track_canvas->Update();
623 
624  //delete phi_track;
625  //delete eta_track;
626  continue;
627 
628  // Mode = p display point on track
629  // Address = address of point to be dislayed
630  case 'p':
631  cout << "Address: ";
632  cin >> address;
633 
634  {for (Int_t i = 0; i < entries; i++) {
635  track = (StFtpcTrack *)mTrack->At(i);
636 
637  hits = (TObjArray *)(track->GetHits());
638  trackcluster = hits->GetEntriesFast();
639  // cout << "Track: " << i << " Cluster: " << trackcluster << endl;
640  for (Int_t j = 0; j < trackcluster; j++) {
641 
642  if ((StFtpcConfMapPoint *)address == (StFtpcConfMapPoint *)hits->At(j)) {
643  cout << "Track: " << i << " Cluster #" << j << endl;
644  }
645  }
646  }}
647 
648  continue;
649 
650  default:
651  cout << "Invalid argument - only (t)rack or (p)oint allowed!" << endl;
652  return;
653  }
654  }
655 
656  delete[] phi_line;
657  delete[] eta_line;
658 
659  return;
660 }
661 
662 /*
663 void StFtpcDisplay::Info()
664 {
665  // Information about clusters.
666 
667  TCanvas *c = new TCanvas("c", "Cluster Information", 1200, 1000);
668  c->Divide(2, 1);
669 
670  TH1F *segments = new TH1F("segments", "segments", mBounds, 0., mBounds);
671  TH1F *rowsegments = new TH1F("rowsegments", "rowsegments", mNumRowSegment, 0. ,mNumRowSegment);
672  TH1F *phisegments = new TH1F("phisegments", "phisegments", mNumPhiSegment, 0. ,mNumPhiSegment);
673  TH1F *etasegments = new TH1F("etasegments", "etasegments", mNumEtaSegment, 0. ,mNumEtaSegment);
674  TH1F *pad = new TH1F("pad", "pad", mNumRowSegment, 1., mNumRowSegment+1);
675  TH1F *phi = new TH1F("phi", "phi", mNumPhiSegment*10, 0. ,2*TMath::Pi());
676  TH1F *eta = new TH1F("eta", "eta", mNumEtaSegment*10, -4.165, 4.165);
677 
678  TH2F *xy = new TH2F("xy", "xy", 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius(), 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius());
679  TH2F *phi_eta = new TH2F("phi_eta", "phi_eta", 60, 0., 2*TMath::Pi(), 60, -4.165, 4.165);
680 
681  Int_t cluster_anz = mHit->GetEntriesFast();
682  cout << endl
683  << "Cluster Information" << endl
684  << "-------------------"
685  << endl << endl;
686  cout << cluster_anz << " clusters in this event." << endl;
687 
688  StFtpcConfMapPoint *h;
689  TPolyMarker *phi_points = new TPolyMarker(cluster_anz, 0, 0, "");
690  TPolyMarker *eta_points = new TPolyMarker(cluster_anz, 0, 0, "");
691 
692  for (Int_t i = 0; i < cluster_anz; i++) {
693  h = (StFtpcConfMapPoint *)mHit->At(i);
694 
695  cout << "No. " << i << " Pad: " << h->GetPadRow() << "/" << GetRowSegm(h)
696  << " Phi: " << h->GetPhi() << "/" << GetPhiSegm(h)
697  << " Eta: " << h->GetEta() << "/" << GetEtaSegm(h)
698  << " Segm: " << GetSegm(GetRowSegm(h), GetPhiSegm(h), GetEtaSegm(h))
699  << endl;
700 
701  segments->Fill(GetSegm(GetRowSegm(h), GetPhiSegm(h), GetEtaSegm(h)));
702  rowsegments->Fill(GetRowSegm(h));
703  phisegments->Fill(GetPhiSegm(h));
704  etasegments->Fill(GetEtaSegm(h));
705 
706  xy->Fill(h->GetX(), h->GetY(), 1);
707 
708  phi_eta->Fill(h->GetPhi(), h->GetEta(), 1);
709 
710  pad->Fill(h->GetPadRow());
711  phi->Fill(h->GetPhi());
712  eta->Fill(h->GetEta());
713  phi_points->SetPoint(i, h->GetX(), h->GetY());
714  eta_points->SetPoint(i, h->GetZ(), h->GetY());
715  }
716 
717  c->cd(1);
718  gPad->Divide(1,7);
719  gPad->cd(1);
720  segments->Draw();
721  c->cd(1);
722  gPad->cd(2);
723  rowsegments->Draw();
724  c->cd(1);
725  gPad->cd(3);
726  pad->Draw();
727  c->cd(1);
728  gPad->cd(4);
729  phisegments->Draw();
730  c->cd(1);
731  gPad->cd(5);
732  phi->Draw();
733  c->cd(1);
734  gPad->cd(6);
735  etasegments->Draw();
736  c->cd(1);
737  gPad->cd(7);
738  eta->Draw();
739 
740  c->cd(2);
741  gPad->Divide(1,2);
742  gPad->cd(1);
743  xy->Draw();
744  c->cd(2);
745  gPad->cd(2);
746  phi_eta->Draw();
747 
748  c->Update();
749 
750  // Information about tracks.
751 
752  TCanvas *track_canvas = new TCanvas("track_canvas", "Tracks", 1580, 600);
753  track_canvas->Divide(3,1);
754  TH2F *phi_frame = new TH2F("phi_frame", "phi_frame", 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius(), 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius());
755  TH2F *eta_frame1 = new TH2F("eta_frame1", "eta_frame1", 120, -270, -150, 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius());
756  TH2F *eta_frame2 = new TH2F("eta_frame2", "eta_frame2", 120, 150, 270, 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius());
757 
758  track_canvas->cd(1);
759  gPad->SetGridx();
760  gPad->SetGridy();
761  phi_frame->Draw();
762  track_canvas->cd(2);
763  gPad->SetGridx();
764  gPad->SetGridy();
765  eta_frame1->Draw();
766  track_canvas->cd(3);
767  gPad->SetGridx();
768  gPad->SetGridy();
769  eta_frame2->Draw();
770 
771 
772  TPolyMarker *phi_all = new TPolyMarker(cluster_anz, 0, 0, "");
773  TPolyMarker *phi_track = new TPolyMarker(10, 0, 0, "");
774  TPolyMarker *eta_all = new TPolyMarker(cluster_anz, 0, 0, "");
775  TPolyMarker *eta_track = new TPolyMarker(10, 0, 0, "");
776 
777  for (Int_t i = 0; i < cluster_anz; i ++) {
778  phi_all->SetPoint(i, 0., 0.);
779  eta_all->SetPoint(i, 0., 0.);
780 
781  if (i<10) {
782  phi_track->SetPoint(i, 0., 0.);
783  eta_track->SetPoint(i, 0., 0.);
784  }
785  }
786 
787  phi_track->SetMarkerStyle(4);
788  phi_track->SetMarkerSize(0.4);
789  eta_track->SetMarkerStyle(4);
790  eta_track->SetMarkerSize(0.4);
791  phi_all->SetMarkerColor(2);
792  eta_all->SetMarkerColor(2);
793  phi_all->SetMarkerStyle(4);
794  phi_all->SetMarkerSize(0.4);
795  eta_all->SetMarkerStyle(4);
796  eta_all->SetMarkerSize(0.4);
797 
798 
799  TLine phi_line[mNumPhiSegment];
800 
801  for (Int_t i=0; i<mNumPhiSegment; i++) {
802  phi_line[i] = TLine(0., 0., StFtpcTrackingParams::Instance()->OuterRadius()*TMath::Cos(i*2*TMath::Pi()/mNumPhiSegment),
803  StFtpcTrackingParams::Instance()->OuterRadius()*TMath::Sin(i*2*TMath::Pi()/mNumPhiSegment));
804  }
805 
806  TLine eta_line[2*mNumEtaSegment+2];
807 
808  Double_t eta_value;
809  for (Int_t i=0; i<=mNumEtaSegment/2.; i++) {
810 
811  eta_value = (4.165-2.396)/(mNumEtaSegment/2.) * i + 2.396;
812 
813  eta_line[2*i] = TLine(-270*TMath::Cos(TMath::ATan(TMath::Exp(-eta_value))*2.),
814  -270*TMath::Sin(TMath::ATan(TMath::Exp(-eta_value))*2.),
815  270*TMath::Cos(TMath::ATan(TMath::Exp(-eta_value))*2.),
816  270*TMath::Sin(TMath::ATan(TMath::Exp(-eta_value))*2.));
817 
818  eta_line[2*i+1] = TLine(270*TMath::Cos(TMath::ATan(TMath::Exp(-eta_value))*2.),
819  -270*TMath::Sin(TMath::ATan(TMath::Exp(-eta_value))*2.),
820  -270*TMath::Cos(TMath::ATan(TMath::Exp(-eta_value))*2.),
821  270*TMath::Sin(TMath::ATan(TMath::Exp(-eta_value))*2.));
822  }
823 
824  Int_t track_anz = mTrack->GetEntriesFast();
825  cout << endl
826  << "Track Information" << endl
827  << "-----------------"
828  << endl << endl;
829  cout << track_anz << " tracks in this event." << endl;
830 
831  Float_t x[track_anz][10];
832  Float_t y[track_anz][10];
833  Float_t z[track_anz][10];
834 
835  Bool_t non_stop = kFALSE;
836  Int_t hitcounter = 0;
837 
838  //track_canvas->cd(1);
839  //phi_frame->Draw();
840 
841  //for (Int_t i=0; i<fNum_phi_segm; i++) {
842  // phi_line[i].Draw("same");
843  //}
844 
845  //trac_canvas->cd(2);
846  //eta_frame1->Draw();
847 
848  //for (Int_t i=0; i<2*fNum_eta_segm+2; i++) {
849  // eta_line[i].Draw("same");
850  //}
851 
852  //track_canvas->cd(3);
853  //eta_frame2->Draw();
854 
855  //for (Int_t i=0; i<2*fNum_eta_segm+2; i++) {
856  // eta_line[i].Draw("same");
857  //}
858 
859 
860  TClonesArray g_xy("TGraph", track_anz);
861  TClonesArray g_zy("TGraph", track_anz);
862 
863  for (Int_t i = 0; i < track_anz; i++) {
864  StFtpcTrack *track = (StFtpcTrack *)mTrack->At(i);
865  TObjArray *hits = (TObjArray *)(track->GetHits());
866  Int_t trackcluster = hits->GetEntriesFast();
867  cout << "Track: " << i << " Cluster: " << trackcluster << endl;
868 
869  new(g_xy[i]) TGraph(trackcluster, x[i], y[i]);
870  new(g_zy[i]) TGraph(trackcluster, z[i], y[i]);
871 
872  for (Int_t j = 0; j < trackcluster; j++) {
873 
874  h = (StFtpcConfMapPoint *)hits->At(j);
875 
876  x[i][j] = h->GetX();
877  y[i][j] = h->GetY();
878  z[i][j] = h->GetZ();
879 
880  phi_all->SetPoint(hitcounter, h->GetX(), h->GetY());
881  phi_track->SetPoint(j, h->GetX(), h->GetY());
882  eta_all->SetPoint(hitcounter, h->GetZ(), h->GetY());
883  eta_track->SetPoint(j, h->GetZ(), h->GetY());
884  hitcounter++;
885  }
886 
887  // track_canvas->cd(1);
888 
889  //phi_track->Draw("same");
890 
891  // gPad->Update();
892 
893  // for (Int_t here = 0; here < trackcluster; here++) {
894  // phi_track->SetPoint(here, 0., 0.);
895  //}
896 
897  // track_canvas->cd(2);
898  //eta_track->Draw("same");
899  //gPad->Update();
900 
901  //track_canvas->cd(3);
902  //eta_track->Draw("same");
903  //gPad->Update();
904 
905  if (non_stop == kFALSE){
906  Char_t var;
907  cin >> var;
908  if (var == '!') non_stop = kTRUE;
909  }
910 
911  for (Int_t here = 0; here < trackcluster; here++) {
912  eta_track->SetPoint(here, 0., 0.);
913  }
914  }
915 
916  phi_points->SetMarkerColor(4);
917  eta_points->SetMarkerColor(4);
918  phi_points->SetMarkerStyle(4);
919  eta_points->SetMarkerStyle(4);
920  phi_points->SetMarkerSize(0.4);
921  eta_points->SetMarkerSize(0.4);
922 
923  track_canvas->cd(1);
924  phi_frame->Draw();
925 
926  for (Int_t i=0; i<mNumPhiSegment; i++) {
927  phi_line[i].Draw("same");
928  }
929 
930  phi_points->Draw("same");
931  phi_all->Draw("same");
932  //((TGraph *) g_xy.At(1))->Draw("AC*");
933 
934 
935 // for(Int_t i = 0; i< track_anz; i++) {
936 // ((TGraph *) g_xy.At(i))->Draw("AC*same");
937 // }
938 
939  gPad->Update();
940 
941  track_canvas->cd(2);
942  eta_frame1->Draw();
943 
944  for (Int_t i=0; i<2*mNumEtaSegment+2; i++) {
945  eta_line[i].Draw("same");
946  }
947 
948  eta_points->Draw("same");
949  eta_all->Draw("same");
950  gPad->Update();
951 
952  track_canvas->cd(3);
953  eta_frame2->Draw();
954 
955  for (Int_t i=0; i<2*mNumEtaSegment+2; i++) {
956  eta_line[i].Draw("same");
957  }
958 
959  eta_points->Draw("same");
960  eta_all->Draw("same");
961  gPad->Update();
962 
963  TCanvas *X_Y = new TCanvas("X_Y", "Blick in Beamrichtung", 600, 600);
964  X_Y->cd();
965 
966  //X_Y->SetOptStat(0);
967  phi_frame->Draw();
968  phi_points->Draw("same");
969  phi_all->Draw("same");
970 
971 }
972 */
973 
974 void StFtpcDisplay::ShowClusters()
975 {
976  // Displays the clusters (2D view).
977 
978  Int_t cluster_anz = mHit->GetEntriesFast();
979 
980  TCanvas *X_Yplus = new TCanvas("X_Yplus", "Blick in Beamrichtung +", 1100, 1100);
981  TCanvas *X_Yminus = new TCanvas("X_Yminus", "Blick in Beamrichtung -", 1100, 1100);
982 
983  TH2F *xy = new TH2F("xy", "xy", 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius(), 60, -StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius());
984  X_Yplus->cd();
985  xy->Draw();
986  X_Yminus->cd();
987  xy->Draw();
988 
989  TMarker *ma = new TMarker[cluster_anz];
991  for (Int_t i = 0; i < cluster_anz; i++) {
992  h = (StFtpcConfMapPoint *)mHit->At(i);
993  ma[i] = TMarker(h->GetX(), h->GetY(), 4);
994 
995  ma[i].SetMarkerSize((TMath::Sqrt(h->GetX()*h->GetX()+h->GetY()*h->GetY()+h->GetZ()*h->GetZ())-163.)/98.*10.*0.1);
996 
997  Int_t tn = h->GetTrackNumber();
998 
999  if (tn == -1) {
1000  ma[i].SetMarkerColor(2);
1001  ma[i].SetMarkerStyle(8);
1002  }
1003 
1004  else {
1005  Int_t color = ((tn%54)%6) +1;
1006  Int_t style = ((tn%54)%9) +2;
1007 
1008  if (color >= 2) color++;
1009  if (style >= 6) style+=18;
1010  if (style == 29) style=30;
1011 
1012  ma[i].SetMarkerColor(color);
1013  ma[i].SetMarkerStyle(style);
1014  }
1015  if (h->GetZ() > 0) X_Yplus->cd();
1016  else X_Yminus->cd();
1017  ma[i].Draw("same");
1018  }
1019 
1020  X_Yplus->Update();
1021  X_Yminus->Update();
1022 
1023  delete[] ma;
1024 }
1025 
1026 
1027 void StFtpcDisplay::ShowTracks(Int_t trackanz, Int_t trackarray[])
1028 {
1029  // Displays the found tracks and the clusters in a nice 3D view.
1030  // You will be asked if you want to see only one of the Ftpcs ('+' or '-') or both.
1031  //
1032  // ShowTracks() or ShowTracks(0) displays all tracks and all clusters
1033  // Showtracks(-1) displays all unused clusters
1034  // ShowTracks(-2) displays all tracks but no clusters
1035  // Showtracks(trackanz, x[trackanz]) displays all tracks given by the numbers in the array x[] and all clusters
1036 
1037  // create 3 canvases (for +, -, and both Ftpcs)
1038  TCanvas *X_Y_Zplus = new TCanvas("X_Y_Zplus", "Event +", 600, 600);
1039  TCanvas *X_Y_Zminus = new TCanvas("X_Y_Zminus", "Event -", 600, 600);
1040  TCanvas *X_Y_Z = new TCanvas("X_Y_Z", "Event", 600, 600);
1041 
1042  // create point of origin (our vertex has the shape of a cube, of course)
1043  TBRIK *origin = new TBRIK("origin", "origin", "void", 0.1, 0.1, 0.1);
1044 
1045  // create 4 tubes (cylinders) - two big ones (out) and two small ones (in) - to draw the Ftpcs
1046  TTUBE *ftpc1_out = new TTUBE("ftpc1_out", "Ftpc + (out)", "void", StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius(), (StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2., 1);
1047  TTUBE *ftpc1_in = new TTUBE("ftpc1_in", "Ftpc + (in)", "void", StFtpcTrackingParams::Instance()->InnerRadius(), StFtpcTrackingParams::Instance()->InnerRadius(), (StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2., 1);
1048  TTUBE *ftpc2_out = new TTUBE("ftpc2_out", "Ftpc - (out)", "void", StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius(), (StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2., 1);
1049  TTUBE *ftpc2_in = new TTUBE("ftpc2_in", "Ftpc - (in)", "void", StFtpcTrackingParams::Instance()->InnerRadius(), StFtpcTrackingParams::Instance()->InnerRadius(), (StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2., 1);
1050 
1051  // set divisions of tubes
1052  ftpc1_out->SetNumberOfDivisions(50);
1053  ftpc1_in->SetNumberOfDivisions(50);
1054  ftpc2_out->SetNumberOfDivisions(50);
1055  ftpc2_in->SetNumberOfDivisions(50);
1056 
1057  // set colors
1058  origin->SetLineColor(1);
1059  ftpc1_out->SetLineColor(4);
1060  ftpc1_in->SetLineColor(4);
1061  ftpc2_out->SetLineColor(4);
1062  ftpc2_in->SetLineColor(4);
1063 
1064  // create 3 nodes (+, -, both) to generate the dependencies of the different geometric shapes
1065  TNode *node0 = new TNode("node0", "node0", "origin");
1066  TNode *node2 = new TNode("node2", "node2", "origin");
1067  TNode *node1 = new TNode("node1", "node1", "origin");
1068 
1069  // create dependencies for 'both' Ftpcs
1070  X_Y_Z->cd();
1071  node0->cd();
1072  TNode *node01_out = new TNode("node01_out", "node01_out", "ftpc1_out", 0, 0, StFtpcTrackingParams::Instance()->PadRowPosZ(0)+(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1073  TNode *node01_in = new TNode("node01_in", "node01_in", "ftpc1_in", 0, 0, StFtpcTrackingParams::Instance()->PadRowPosZ(0)+(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1074  TNode *node02_out = new TNode("node02_out", "node02_out", "ftpc2_out", 0, 0, -StFtpcTrackingParams::Instance()->PadRowPosZ(0)-(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1075  TNode *node02_in = new TNode("node02_in", "node02_in", "ftpc2_in", 0, 0, -StFtpcTrackingParams::Instance()->PadRowPosZ(0)-(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1076 
1077  // create dependencies for '-' Ftpc
1078  X_Y_Zminus->cd();
1079  node2->cd();
1080  TNode *node2_out = new TNode("node2_out", "node2_out", "ftpc2_out", 0, 0, -StFtpcTrackingParams::Instance()->PadRowPosZ(0)-(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1081  TNode *node2_in = new TNode("node2_in", "node2_in", "ftpc2_in", 0, 0, -StFtpcTrackingParams::Instance()->PadRowPosZ(0)-(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1082 
1083  // create dependencies for '+' Ftpc
1084  X_Y_Zplus->cd();
1085  node1->cd();
1086  TNode *node1_out = new TNode("node1_out", "node1_out", "ftpc1_out", 0, 0, StFtpcTrackingParams::Instance()->PadRowPosZ(0)+(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1087  TNode *node1_in = new TNode("node1_in", "node1_in", "ftpc1_in", 0, 0, StFtpcTrackingParams::Instance()->PadRowPosZ(0)+(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1088 
1089  // The following lines are unnecessary. They avoid compiler warnings. They can be simply deleted.
1090  node0->cd();
1091  node1->cd();
1092  node2->cd();
1093  node1_in->cd();
1094  node2_in->cd();
1095  node1_out->cd();
1096  node2_out->cd();
1097  node01_in->cd();
1098  node02_in->cd();
1099  node01_out->cd();
1100  node02_out->cd();
1101 
1102  // fill histograms with tracks and clusters
1103 
1104  // coordinates of trackpoints
1105  Float_t x[100];
1106  Float_t y[100];
1107  Float_t z[100];
1108 
1109  if (trackanz != -1) { // do everything if the '-1' option is not given
1110 
1111  if (trackanz == 0 || trackanz == -2) { // show all tracks
1112  Int_t track_entries = mTrack->GetEntriesFast();
1113 
1114  StFtpcConfMapPoint *cluster;
1115  StFtpcTrack *track;
1116  found_line = new TPolyLine3D[track_entries];
1117 
1118  // loop over all tracks
1119  for (Int_t tracks = 0; tracks < track_entries; tracks++) {
1120  track = (StFtpcTrack *)mTrack->At(tracks);
1121 
1122  Int_t cluster_entries = track->GetNumberOfPoints();
1123 
1124  // loop over all clusters
1125  for (Int_t clusters = 0; clusters < cluster_entries && clusters < 100; clusters++) {
1126 
1127  cluster = (StFtpcConfMapPoint *)track->GetHits()->At(clusters);
1128 
1129  // fill point array
1130  x[clusters] = (Float_t)(cluster->GetX());
1131  y[clusters] = (Float_t)(cluster->GetY());
1132  z[clusters] = (Float_t)(cluster->GetZ());
1133 
1134  // decide in which canvas (+,-) this track belongs
1135  if (z[clusters]>0) X_Y_Zplus->cd();
1136  else X_Y_Zminus->cd();
1137  }
1138 
1139  // fill PolyLine for this track
1140  current_line = &(found_line[tracks]);
1141  current_line = new TPolyLine3D(cluster_entries, x, y, z, "");
1142 
1143  // set colors
1144  Int_t color = tracks%50+51;
1145  current_line->SetLineColor(color);
1146 
1147  // draw track in the right canvas
1148  current_line->Draw("Csame");
1149  // and draw track in the canvas for both Ftpcs
1150  X_Y_Z->cd();
1151  current_line->Draw("Csame");
1152  }
1153  }
1154 
1155  else { // option was set to a 'trackanz' != (0, -1, or -2) -> show only given tracks
1156  Int_t track_entries = trackanz;
1157 
1158  StFtpcConfMapPoint *cluster;
1159  StFtpcTrack *track;
1160  found_line = new TPolyLine3D[track_entries];
1161 
1162  // loop over all tracks specified by the given trackarray
1163  for (Int_t tracks = 0; tracks < track_entries; tracks++) {
1164  track = (StFtpcTrack *)mTrack->At(trackarray[tracks]);
1165 
1166  Int_t cluster_entries = track->GetNumberOfPoints();
1167 
1168  // loop over all clusters
1169  for (Int_t clusters = 0; clusters < cluster_entries; clusters++) {
1170 
1171  cluster = (StFtpcConfMapPoint *)track->GetHits()->At(clusters);
1172 
1173  // fill point array
1174  x[clusters] = (Float_t)(cluster->GetX());
1175  y[clusters] = (Float_t)(cluster->GetY());
1176  z[clusters] = (Float_t)(cluster->GetZ());
1177 
1178  // decide in which canvas (+,-) this track belongs
1179  if (z[clusters]>0) X_Y_Zplus->cd();
1180  else X_Y_Zminus->cd();
1181  }
1182 
1183  // fill PolyLine for this track
1184  current_line = &(found_line[tracks]);
1185  current_line = new TPolyLine3D(cluster_entries, x, y, z, "");
1186 
1187  // set colors
1188  current_line->SetLineColor(3);
1189 
1190  // draw track in the right canvas
1191  current_line->Draw("same");
1192  // and draw track in the canvas for both Ftpcs
1193  X_Y_Z->cd();
1194  current_line->Draw("same");
1195  }
1196  }
1197  }
1198 
1199  if (trackanz != -2) { // show clusters only if '-2' option is not given
1200  Int_t cluster_anz = mHit->GetEntriesFast();
1201 
1202  // coordinates of clusters (=, -, both)
1203  found_value_plus = new Float_t[3*cluster_anz];
1204  found_value_minus = new Float_t[3*cluster_anz];
1205  found_value = new Float_t[3*cluster_anz];
1206 
1207  StFtpcConfMapPoint *h;
1208  Int_t cl_plus = 0;
1209  Int_t cl_minus = 0;
1210  Int_t cl = 0;
1211 
1212  // loop over all clusters
1213  for (Int_t i = 0; i < cluster_anz; i++) {
1214  h = (StFtpcConfMapPoint *)mHit->At(i);
1215 
1216  if (trackanz == -1 && h->GetUsage() == 1) { // don't show used clusters if '-1' option was given
1217  continue;
1218  }
1219 
1220  // fill (+, -, both) cluster arrays
1221  found_value[cl++] = h->GetX();
1222  found_value[cl++] = h->GetY();
1223 
1224  if ((found_value[cl++] = h->GetZ())>0) {
1225  found_value_plus[cl_plus++] = h->GetX();
1226  found_value_plus[cl_plus++] = h->GetY();
1227  found_value_plus[cl_plus++] = h->GetZ();
1228  }
1229 
1230  else {
1231  found_value_minus[cl_minus++] = h->GetX();
1232  found_value_minus[cl_minus++] = h->GetY();
1233  found_value_minus[cl_minus++] = h->GetZ();
1234  }
1235  }
1236 
1237  // create PolyMarkers
1238  found_hit->SetPolyMarker(cl/3, found_value, 1);
1239  found_hit_plus->SetPolyMarker(cl_plus/3, found_value_plus, 1);
1240  found_hit_minus->SetPolyMarker(cl_minus/3, found_value_minus, 1);
1241 
1242  // set colors
1243  found_hit->SetMarkerColor(2);
1244  found_hit_plus->SetMarkerColor(2);
1245  found_hit_minus->SetMarkerColor(2);
1246 
1247  // switch to right canvas and draw clusters
1248  X_Y_Z->cd();
1249  found_hit->Draw("same");
1250  X_Y_Zplus->cd();
1251  found_hit_plus->Draw("same");
1252  X_Y_Zminus->cd();
1253  found_hit_minus->Draw("same");
1254  }
1255 
1256  // draw nodes in right canvases
1257  X_Y_Zplus->cd();
1258  node1->cd();
1259  node1->Draw("same");
1260  X_Y_Zplus->Update();
1261 
1262  X_Y_Zminus->cd();
1263  node2->cd();
1264  node2->Draw("same");
1265  X_Y_Zminus->Update();
1266 
1267  X_Y_Z->cd();
1268  node0->cd();
1269  node0->Draw("same");
1270  X_Y_Z->Update();
1271 
1272  // ask user, which Ftpc(s) ('+', '-', 'b'oth) to display in 3D view
1273  Char_t a;
1274 
1275  while (1) {
1276  cout << "Please enter '+', '-' or 'b' to see one or both Ftpc's, 'q' to quit: ";
1277  cin >> a;
1278 
1279  // call the x3d function (this does the actual 3D displaying) for the right canvas
1280  if (a == '+') X_Y_Zplus->x3d();
1281  if (a == '-') X_Y_Zminus->x3d();
1282  if (a == 'b') X_Y_Z->x3d();
1283  if (a == 'q') break;
1284  }
1285 
1286  // cleanup
1287  delete X_Y_Zplus;
1288  delete X_Y_Zminus;
1289  delete X_Y_Z;
1290 
1291  DeleteFound();
1292 
1293  return;
1294 }
1295 
1296 
1297 void StFtpcDisplay::ShowEvalTracks(MIntArray *splitArr, MIntArray *uncleanArr, MIntArray *clusterArr)
1298 {
1299  // Displays the tracks and the clusters in a nice 3D view (GEANT ant found!).
1300 
1301  // create 3 canvases (for +, -, and both Ftpcs)
1302  mX_Y_Zplus = new TCanvas("X_Y_Zplus", "Event +", 600, 600);
1303  mX_Y_Zminus = new TCanvas("X_Y_Zminus", "Event -", 600, 600);
1304  mX_Y_Z = new TCanvas("X_Y_Z", "Event", 600, 600);
1305 
1306  // create point of origin (our vertex has the shape of a cube, of course)
1307  TBRIK *origin = new TBRIK("origin", "origin", "void", 0.1, 0.1, 0.1);
1308 
1309  // create 4 tubes (cylinders) - two big ones (out) and two small ones (in) - to draw the Ftpcs
1310  TTUBE *ftpc1_out = new TTUBE("ftpc1_out", "Ftpc + (out)", "void", StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius(), (StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2., 1);
1311  TTUBE *ftpc1_in = new TTUBE("ftpc1_in", "Ftpc + (in)", "void", StFtpcTrackingParams::Instance()->InnerRadius(), StFtpcTrackingParams::Instance()->InnerRadius(), (StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2., 1);
1312  TTUBE *ftpc2_out = new TTUBE("ftpc2_out", "Ftpc - (out)", "void", StFtpcTrackingParams::Instance()->OuterRadius(), StFtpcTrackingParams::Instance()->OuterRadius(), (StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2., 1);
1313  TTUBE *ftpc2_in = new TTUBE("ftpc2_in", "Ftpc - (in)", "void", StFtpcTrackingParams::Instance()->InnerRadius(), StFtpcTrackingParams::Instance()->InnerRadius(), (StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2., 1);
1314 
1315  // set divisions of tubes
1316  ftpc1_out->SetNumberOfDivisions(50);
1317  ftpc1_in->SetNumberOfDivisions(50);
1318  ftpc2_out->SetNumberOfDivisions(50);
1319  ftpc2_in->SetNumberOfDivisions(50);
1320 
1321  // set colors
1322  origin->SetLineColor(1);
1323  ftpc1_out->SetLineColor(4);
1324  ftpc1_in->SetLineColor(4);
1325  ftpc2_out->SetLineColor(4);
1326  ftpc2_in->SetLineColor(4);
1327 
1328  /*
1329  TCONE *cone = new TCONE("cone", "cone", "void", 5., StFtpcTrackingParams::Instance()->OuterRadius()/StFtpcTrackingParams::Instance()->PadRowPosZ(9)*254.20-0.22, StFtpcTrackingParams::Instance()->OuterRadius()/StFtpcTrackingParams::Instance()->PadRowPosZ(9)*254.20, StFtpcTrackingParams::Instance()->OuterRadius()/StFtpcTrackingParams::Instance()->PadRowPosZ(9)*258.7-0.22,StFtpcTrackingParams::Instance()->OuterRadius()/StFtpcTrackingParams::Instance()->PadRowPosZ(9)*258.7 );
1330  cone->SetNumberOfDivisions(100);
1331  cone->SetLineColor(1);
1332  */
1333 
1334  // create 3 nodes (+, -, both) to generate the dependencies of the different geometric shapes
1335  mNode0 = new TNode("node0", "node0", "origin");
1336  mNode2 = new TNode("node2", "node2", "origin");
1337  mNode1 = new TNode("node1", "node1", "origin");
1338 
1339  // create dependencies for 'both' Ftpcs
1340  mX_Y_Z->cd();
1341  mNode0->cd();
1342  TNode *node01_out = new TNode("node01_out", "node01_out", "ftpc1_out", 0, 0, StFtpcTrackingParams::Instance()->PadRowPosZ(0)+(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1343  TNode *node01_in = new TNode("node01_in", "node01_in", "ftpc1_in", 0, 0, StFtpcTrackingParams::Instance()->PadRowPosZ(0)+(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1344  TNode *node02_out = new TNode("node02_out", "node02_out", "ftpc2_out", 0, 0, -StFtpcTrackingParams::Instance()->PadRowPosZ(0)-(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1345  TNode *node02_in = new TNode("node02_in", "node02_in", "ftpc2_in", 0, 0, -StFtpcTrackingParams::Instance()->PadRowPosZ(0)-(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1346 
1347  // create dependencies for '-' Ftpc
1348  mX_Y_Zminus->cd();
1349  mNode2->cd();
1350  TNode *node2_out = new TNode("node2_out", "node2_out", "ftpc2_out", 0, 0, -StFtpcTrackingParams::Instance()->PadRowPosZ(0)-(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1351  TNode *node2_in = new TNode("node2_in", "node2_in", "ftpc2_in", 0, 0, -StFtpcTrackingParams::Instance()->PadRowPosZ(0)-(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1352 
1353  // create dependencies for '+' Ftpc
1354  mX_Y_Zplus->cd();
1355  mNode1->cd();
1356  //TNode *cone_1 = new TNode("con1_1", "cone_1", "cone", 0, 0, StFtpcTrackingParams::Instance()->PadRowPosZ(9));
1357  TNode *node1_out = new TNode("node1_out", "node1_out", "ftpc1_out", 0, 0, StFtpcTrackingParams::Instance()->PadRowPosZ(0)+(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1358  TNode *node1_in = new TNode("node1_in", "node1_in", "ftpc1_in", 0, 0, StFtpcTrackingParams::Instance()->PadRowPosZ(0)+(StFtpcTrackingParams::Instance()->PadRowPosZ(9)-StFtpcTrackingParams::Instance()->PadRowPosZ(0))/2.);
1359 
1360  // The following lines are unnecessary. They avoid compiler warnings. They can be simply deleted.
1361  mNode0->cd();
1362  mNode1->cd();
1363  mNode2->cd();
1364  node1_in->cd();
1365  node2_in->cd();
1366  node1_out->cd();
1367  node2_out->cd();
1368  node01_in->cd();
1369  node02_in->cd();
1370  node01_out->cd();
1371  node02_out->cd();
1372  //cone_1->cd();
1373 
1374  Char_t a;
1375 
1376  Bool_t geant = (Bool_t) kFALSE;
1377  Bool_t found = (Bool_t) kTRUE;
1378  Bool_t electrons = (Bool_t) kTRUE;
1379  Bool_t non_vtx = (Bool_t) kTRUE;
1380  Bool_t geant_hits = (Bool_t) kTRUE;
1381  Bool_t good_geant = (Bool_t) kTRUE;
1382  Bool_t good_found = (Bool_t) kTRUE;
1383  Bool_t split = (Bool_t) kTRUE;
1384  Bool_t unclean = (Bool_t) kTRUE;
1385  Bool_t st = (Bool_t) kFALSE;
1386  Bool_t found_hits = (Bool_t) kTRUE;
1387  Bool_t blue = (Bool_t) kFALSE;
1388 
1389  Float_t eta_low_geant = 2.0;
1390  Float_t eta_up_geant = 4.4;
1391  Float_t pt_low_geant = 0.0;
1392  Float_t pt_up_geant = 5.0;
1393 
1394  Float_t eta_low_found = 2.0;
1395  Float_t eta_up_found = 4.4;
1396  Float_t pt_low_found = 0.0;
1397  Float_t pt_up_found = 5.0;
1398 
1399  while (1) {
1400  //gSystem->Exec("/usr/bin/clear");
1401 
1402  cout << endl << endl;
1403  cout << "Display (f)ound tracks..................: ";
1404  OnOff(found);
1405  cout << "---------------------------------------------" << endl;
1406  cout << " Show (g)ood tracks..............[red]: ";
1407  OnOff(good_found);
1408  cout << " (s)plit tracks...........[green]: ";
1409  OnOff(split);
1410  cout << " (u)nclean tracks........[yellow]: ";
1411  OnOff(unclean);
1412  cout << " sho(r)t tracks..................: ";
1413  OnOff(st);
1414  cout << " (c)lusters......................: ";
1415  OnOff(found_hits);
1416  cout << endl;
1417  cout << "Display (G)EANT tracks..................: ";
1418  OnOff(geant);
1419  cout << "---------------------------------------------" << endl;
1420  cout << " Show (e)lectron tracks..........[red]: ";
1421  OnOff(electrons);
1422  cout << " (n)on main vertex tracks [green]: ";
1423  OnOff(non_vtx);
1424  cout << " g(o)od tracks...........[yellow]: ";
1425  OnOff(good_geant);
1426  cout << " c(l)usters................[grey]: ";
1427  OnOff(geant_hits);
1428  cout << "Color of tracks changed to (b)lue.......: ";
1429  OnOff(blue);
1430  cout << endl;
1431  cout << "(E)ta range (2.0 - 4.4) : " << eta_low_geant << " - " << eta_up_geant << endl;
1432  cout << "(p)t range (0.0 - 5.0 GeV): " << pt_low_geant << " - " << pt_up_geant << endl;
1433  cout << endl;
1434  cout << "Show (+), (-), or bo(t)h Ftpcs or (q)uit: ";
1435  cin >> a;
1436 
1437  if (a == 'f' || a == 'g' || a == 's' || a == 'u' || a == 'c' || a == 'G' || a == 'e' || a == 'n' || a == 'o' || a == 'l' || a== 'E' || a == 'p' || a == 'b' || a == 'r') {
1438 
1439  if (a == 'f') found = !found;
1440  if (a == 'g') good_found = !good_found;
1441  if (a == 's') split = !split ;
1442  if (a == 'u') unclean = !unclean;
1443  if (a == 'r') st = !st;
1444  if (a == 'c') found_hits = !found_hits;
1445  if (a == 'G') geant = !geant;
1446  if (a == 'e') electrons = !electrons;
1447  if (a == 'n') non_vtx = !non_vtx;
1448  if (a == 'o') good_geant = !good_geant;
1449  if (a == 'l') geant_hits = !geant_hits;
1450  if (a == 'b') blue = !blue;
1451 
1452 
1453  if (a == 'E') {
1454  cout << endl;
1455  cout << "Enter eta lower and upper limit (" << eta_low_geant << " - " << eta_up_geant << "): ";
1456  cin >> eta_low_geant >> eta_up_geant;
1457  }
1458 
1459  if (a == 'p') {
1460  cout << endl;
1461  cout << "Enter pt lower and upper limit (" << pt_low_geant << " - " << pt_up_geant << "): ";
1462  cin >> pt_low_geant >> pt_up_geant;
1463  }
1464  }
1465 
1466  else {
1467 
1468  if (a == 'q') break;
1469 
1470  else {
1471  cout << endl;
1472  MIntArray *sp = 0;
1473  MIntArray *uncl = 0;
1474  MIntArray *hits = 0;
1475 
1476  if (split) sp = splitArr;
1477  if (unclean) uncl = uncleanArr;
1478  if (found_hits) hits = clusterArr;
1479 
1480  DrawNodes();
1481 
1482  if (geant) {
1483  FillGeant(electrons, non_vtx, good_geant, geant_hits, eta_low_geant, eta_up_geant, pt_low_geant, pt_up_geant, blue);
1484  }
1485 
1486  if (found) {
1487  FillFound(good_found, st, sp, uncl, hits, eta_low_found, eta_up_found, pt_low_found, pt_up_found);
1488  }
1489 
1490  // call the x3d function (this does the actual 3D displaying) for the right canvas
1491  if (a == '+') mX_Y_Zplus->x3d();
1492  if (a == '-') mX_Y_Zminus->x3d();
1493  if (a == 't') mX_Y_Z->x3d();
1494  }
1495  }
1496  }
1497 
1498  // cleanup
1499  delete mX_Y_Zplus;
1500  delete mX_Y_Zminus;
1501  delete mX_Y_Z;
1502 
1503  DeleteAll();
1504 
1505  return;
1506 }
1507 
1508 
1509 void StFtpcDisplay::FillGeant(Bool_t electrons, Bool_t non_vtx, Bool_t good, Bool_t geant_hits, Float_t eta_low, Float_t eta_up, Float_t pt_low, Float_t pt_up, Bool_t blue)
1510 {
1511  // Fill histograms with tracks and clusters.
1512 
1513  DeleteGeant();
1514 
1515  StFtpcConfMapPoint *cluster;
1516  StFtpcTrack *track;
1517 
1518  // coordinates of trackpoints
1519  Float_t x[100];
1520  Float_t y[100];
1521  Float_t z[100];
1522 
1523  Float_t shift = .05;
1524 
1525  Int_t track_entries = mGeantTrack->GetEntriesFast();
1526  geant_line = new TPolyLine3D[track_entries];
1527 
1528  // loop over all tracks
1529  for (Int_t tracks = 0; tracks < track_entries; tracks++) {
1530  track = (StFtpcTrack *)mGeantTrack->At(tracks);
1531 
1532  if ((track->GetPid() <= 3 && !electrons) ||
1533  (!track->ComesFromMainVertex() && track->GetPid()>3 && !non_vtx) ||
1534  (track->ComesFromMainVertex() && track->GetPid()>3 && !good) ||
1535  TMath::Abs(track->GetEta()) < eta_low || TMath::Abs(track->GetEta()) > eta_up ||
1536  track->GetPt() < pt_low || track->GetPt() > pt_up) {
1537  continue;
1538  }
1539 
1540  else {
1541  Int_t cluster_entries = track->GetNumberOfPoints();
1542 
1543  // loop over all clusters
1544  for (Int_t clusters = 0; clusters < cluster_entries && clusters < 100; clusters++) {
1545 
1546  cluster = (StFtpcConfMapPoint *)track->GetHits()->At(clusters);
1547 
1548  // fill point array
1549  x[clusters] = (Float_t)(cluster->GetX()-shift);
1550  y[clusters] = (Float_t)(cluster->GetY()-shift);
1551  z[clusters] = (Float_t)(cluster->GetZ());
1552 
1553  // decide in which canvas (+,-) this track belongs
1554  if (z[clusters]>0) mX_Y_Zplus->cd();
1555  else mX_Y_Zminus->cd();
1556  }
1557 
1558  // fill PolyLine for this track
1559  current_line = &(geant_line[tracks]);
1560  current_line = new TPolyLine3D(cluster_entries, x, y, z, "");
1561 
1562  // set colors
1563  Int_t color;
1564 
1565  if (blue) {
1566  color = 4;
1567  }
1568 
1569  else {
1570 
1571  if (track->GetPid()<=3) {
1572  color = 2;
1573  }
1574 
1575  else {
1576 
1577  if (track->ComesFromMainVertex()) {
1578  color = 5;
1579  }
1580 
1581  else {
1582  color = 3;
1583  }
1584  }
1585  }
1586 
1587  current_line->SetLineColor(color);
1588 
1589  // draw track in the right canvas
1590  current_line->Draw("same");
1591  // and draw track in the canvas for both Ftpcs
1592  mX_Y_Z->cd();
1593  current_line->Draw("same");
1594  }
1595  }
1596 
1597  // show clusters
1598  if (geant_hits) {
1599  Int_t cluster_anz = mGeantHit->GetEntriesFast();
1600 
1601  // coordinates of clusters (=, -, both)
1602  geant_value_plus = new Float_t[3*cluster_anz];
1603  geant_value_minus = new Float_t[3*cluster_anz];
1604  geant_value = new Float_t[3*cluster_anz];
1605 
1606  StFtpcConfMapPoint *h;
1607  Int_t cl_plus = 0;
1608  Int_t cl_minus = 0;
1609  Int_t cl = 0;
1610 
1611  // loop over all clusters
1612  for (Int_t i = 0; i < cluster_anz; i++) {
1613  h = (StFtpcConfMapPoint *)mGeantHit->At(i);
1614 
1615  // fill (+, -, both) cluster arrays
1616  geant_value[cl++] = h->GetX()-shift;
1617  geant_value[cl++] = h->GetY()-shift;
1618 
1619  if ((geant_value[cl++] = h->GetZ())>0) {
1620  geant_value_plus[cl_plus++] = h->GetX()-shift;
1621  geant_value_plus[cl_plus++] = h->GetY()-shift;
1622  geant_value_plus[cl_plus++] = h->GetZ();
1623  }
1624 
1625  else {
1626  geant_value_minus[cl_minus++] = h->GetX()-shift;
1627  geant_value_minus[cl_minus++] = h->GetY()-shift;
1628  geant_value_minus[cl_minus++] = h->GetZ();
1629  }
1630  }
1631 
1632  // create PolyMarkers
1633  geant_hit->SetPolyMarker(cl/3, geant_value, 1);
1634  geant_hit_plus->SetPolyMarker(cl_plus/3, geant_value_plus, 1);
1635  geant_hit_minus->SetPolyMarker(cl_minus/3, geant_value_minus, 1);
1636 
1637  // set colors
1638  geant_hit->SetMarkerColor(1);
1639  geant_hit_plus->SetMarkerColor(1);
1640  geant_hit_minus->SetMarkerColor(1);
1641 
1642  // switch to right canvas and draw clusters
1643  mX_Y_Z->cd();
1644  geant_hit->Draw("same");
1645  mX_Y_Zplus->cd();
1646  geant_hit_plus->Draw("same");
1647  mX_Y_Zminus->cd();
1648  geant_hit_minus->Draw("same");
1649  }
1650 
1651  // update canvases
1652  mX_Y_Zplus->Update();
1653  mX_Y_Zminus->Update();
1654  mX_Y_Z->Update();
1655 
1656  return;
1657 }
1658 
1659 
1660 void StFtpcDisplay::FillFound(Bool_t good_found, Bool_t st, MIntArray *split, MIntArray *unclean, MIntArray *found_hits, Float_t eta_low, Float_t eta_up, Float_t pt_low, Float_t pt_up)
1661 {
1662  // Fill histograms with tracks and clusters.
1663 
1664  DeleteFound();
1665 
1666  StFtpcConfMapPoint *cluster;
1667  StFtpcTrack *track;
1668 
1669  // coordinates of trackpoints
1670  Float_t *x = new Float_t[StFtpcTrackingParams::Instance()->NumberOfPadRowsPerSide()];
1671  Float_t *y = new Float_t[StFtpcTrackingParams::Instance()->NumberOfPadRowsPerSide()];
1672  Float_t *z = new Float_t[StFtpcTrackingParams::Instance()->NumberOfPadRowsPerSide()];
1673 
1674  Int_t track_entries = mTrack->GetEntriesFast();
1675  Bool_t *good_track_to_show = new Bool_t[track_entries];
1676 
1677  found_line = new TPolyLine3D[track_entries];
1678 
1679  for (Int_t good_counter = 0; good_counter < track_entries; good_counter++) {
1680  StFtpcTrack *track = (StFtpcTrack *)mTrack->At(good_counter);
1681 
1682  if (TMath::Abs(track->GetEta()) < eta_low || TMath::Abs(track->GetEta()) > eta_up || track->GetPt() < pt_low || track->GetPt() > pt_up) {
1683  good_track_to_show[good_counter] = (Bool_t) kFALSE;
1684  }
1685 
1686  else {
1687  good_track_to_show[good_counter] = (Bool_t) kTRUE;
1688  }
1689  }
1690 
1691  if (unclean) {
1692 
1693  for (Int_t unclean_counter = 0; unclean_counter < unclean->GetSize(); unclean_counter++) {
1694  good_track_to_show[unclean->At(unclean_counter)] = (Bool_t) kFALSE;
1695  }
1696  }
1697 
1698  if (split) {
1699 
1700  for (Int_t split_counter = 0; split_counter < split->GetSize(); split_counter++) {
1701  good_track_to_show[split->At(split_counter)] = (Bool_t) kFALSE;
1702  }
1703  }
1704 
1705  Int_t entry = 0;
1706 
1707  if (split) {
1708  for (Int_t split_counter = 0; split_counter < split->GetSize(); split_counter++) {
1709  track = (StFtpcTrack *)mTrack->At(split->At(split_counter));
1710 
1711  if (TMath::Abs(track->GetEta()) < eta_low || TMath::Abs(track->GetEta()) > eta_up || track->GetPt() < pt_low || track->GetPt() > pt_up) {
1712  continue;
1713  }
1714 
1715  Int_t cluster_entries = track->GetNumberOfPoints();
1716 
1717  // loop over all clusters
1718  for (Int_t clusters = 0; clusters < cluster_entries; clusters++) {
1719 
1720  cluster = (StFtpcConfMapPoint *)track->GetHits()->At(clusters);
1721 
1722  // fill point array
1723  x[clusters] = (Float_t)(cluster->GetX());
1724  y[clusters] = (Float_t)(cluster->GetY());
1725  z[clusters] = (Float_t)(cluster->GetZ());
1726 
1727  // decide in which canvas (+,-) this track belongs
1728  if (z[clusters]>0) mX_Y_Zplus->cd();
1729  else mX_Y_Zminus->cd();
1730  }
1731 
1732  // fill PolyLine for this track
1733  current_line = &(found_line[entry++]);
1734  current_line = new TPolyLine3D(cluster_entries, x, y, z, "");
1735 
1736  // set colors
1737  current_line->SetLineColor(3);
1738 
1739  // draw track in the right canvas
1740  current_line->Draw("same");
1741  // and draw track in the canvas for both Ftpcs
1742  mX_Y_Z->cd();
1743  current_line->Draw("same");
1744  }
1745  }
1746 
1747  if (unclean) {
1748 
1749  for (Int_t unclean_counter = 0; unclean_counter < unclean->GetSize(); unclean_counter++) {
1750  track = (StFtpcTrack *)mTrack->At(unclean->At(unclean_counter));
1751 
1752  if (TMath::Abs(track->GetEta()) < eta_low || TMath::Abs(track->GetEta()) > eta_up || track->GetPt() < pt_low || track->GetPt() > pt_up) {
1753  continue;
1754  }
1755 
1756  Int_t cluster_entries = track->GetNumberOfPoints();
1757 
1758  // loop over all clusters
1759  for (Int_t clusters = 0; clusters < cluster_entries; clusters++) {
1760 
1761  cluster = (StFtpcConfMapPoint *)track->GetHits()->At(clusters);
1762 
1763  // fill point array
1764  x[clusters] = (Float_t)(cluster->GetX());
1765  y[clusters] = (Float_t)(cluster->GetY());
1766  z[clusters] = (Float_t)(cluster->GetZ());
1767 
1768  // decide in which canvas (+,-) this track belongs
1769  if (z[clusters]>0) mX_Y_Zplus->cd();
1770  else mX_Y_Zminus->cd();
1771  }
1772 
1773  // fill PolyLine for this track
1774  current_line = &(found_line[entry++]);
1775  current_line = new TPolyLine3D(cluster_entries, x, y, z, "");
1776 
1777  // set colors
1778  current_line->SetLineColor(5);
1779 
1780  // draw track in the right canvas
1781  current_line->Draw("same");
1782  // and draw track in the canvas for both Ftpcs
1783  mX_Y_Z->cd();
1784  current_line->Draw("same");
1785  }
1786  }
1787 
1788  if (good_found) {
1789 
1790  // loop over all tracks
1791  for (Int_t tracks = 0; tracks < track_entries; tracks++) {
1792 
1793  if (!good_track_to_show[tracks]) {
1794  continue;
1795  }
1796 
1797  else {
1798  track = (StFtpcTrack *)mTrack->At(tracks);
1799 
1800  Int_t cluster_entries = track->GetNumberOfPoints();
1801 
1802  // loop over all clusters
1803  for (Int_t clusters = 0; clusters < cluster_entries; clusters++) {
1804 
1805  cluster = (StFtpcConfMapPoint *)track->GetHits()->At(clusters);
1806 
1807  // fill point array
1808  x[clusters] = (Float_t)(cluster->GetX());
1809  y[clusters] = (Float_t)(cluster->GetY());
1810  z[clusters] = (Float_t)(cluster->GetZ());
1811 
1812  // decide in which canvas (+,-) this track belongs
1813  if (z[clusters]>0) mX_Y_Zplus->cd();
1814  else mX_Y_Zminus->cd();
1815  }
1816 
1817  // fill PolyLine for this track
1818  current_line = &(found_line[tracks]);
1819  current_line = new TPolyLine3D(cluster_entries, x, y, z, "");
1820 
1821  // set colors
1822  current_line->SetLineColor(2);
1823 
1824  // draw track in the right canvas
1825  current_line->Draw("same");
1826  // and draw track in the canvas for both Ftpcs
1827  mX_Y_Z->cd();
1828  current_line->Draw("same");
1829  }
1830  }
1831  }
1832 
1833  if (st) {
1834 
1835  // loop over all tracks
1836  for (Int_t tracks = 0; tracks < track_entries; tracks++) {
1837 
1838  track = (StFtpcTrack *)mTrack->At(tracks);
1839 
1840  Int_t cluster_entries = track->GetNumberOfPoints();
1841 
1842  if (cluster_entries < StFtpcTrackingParams::Instance()->NumberOfPadRowsPerSide() && track->GetRFirst() > StFtpcTrackingParams::Instance()->InnerRadius() && track->GetRLast() < StFtpcTrackingParams::Instance()->OuterRadius()) {
1843 
1844  // loop over all clusters
1845  for (Int_t clusters = 0; clusters < cluster_entries; clusters++) {
1846 
1847  cluster = (StFtpcConfMapPoint *)track->GetHits()->At(clusters);
1848 
1849  // fill point array
1850  x[clusters] = (Float_t)(cluster->GetX());
1851  y[clusters] = (Float_t)(cluster->GetY());
1852  z[clusters] = (Float_t)(cluster->GetZ());
1853 
1854  // decide in which canvas (+,-) this track belongs
1855  if (z[clusters]>0) mX_Y_Zplus->cd();
1856  else mX_Y_Zminus->cd();
1857  }
1858 
1859  // fill PolyLine for this track
1860  current_line = &(found_line[tracks]);
1861  current_line = new TPolyLine3D(cluster_entries, x, y, z, "");
1862 
1863  // set colors
1864  current_line->SetLineColor(2);
1865 
1866  // draw track in the right canvas
1867  current_line->Draw("same");
1868  // and draw track in the canvas for both Ftpcs
1869  mX_Y_Z->cd();
1870  current_line->Draw("same");
1871  }
1872  }
1873  }
1874 
1875  // show clusters
1876  if (found_hits) {
1877  Int_t cluster_anz = mHit->GetEntriesFast();
1878 
1879  // coordinates of clusters (=, -, both)
1880  found_value_plus = new Float_t[3*cluster_anz];
1881  found_value_minus = new Float_t[3*cluster_anz];
1882  found_value = new Float_t[3*cluster_anz];
1883  unused_value_plus = new Float_t[3*cluster_anz];
1884  unused_value_minus = new Float_t[3*cluster_anz];
1885  unused_value = new Float_t[3*cluster_anz];
1886  wrong_value_plus = new Float_t[3*cluster_anz];
1887  wrong_value_minus = new Float_t[3*cluster_anz];
1888  wrong_value = new Float_t[3*cluster_anz];
1889 
1890  StFtpcConfMapPoint *h;
1891  Int_t found_cl_plus = 0;
1892  Int_t found_cl_minus = 0;
1893  Int_t found_cl = 0;
1894  Int_t unused_cl_plus = 0;
1895  Int_t unused_cl_minus = 0;
1896  Int_t unused_cl = 0;
1897  Int_t wrong_cl_plus = 0;
1898  Int_t wrong_cl_minus = 0;
1899  Int_t wrong_cl = 0;
1900 
1901  // loop over all clusters
1902  for (Int_t i = 0; i < cluster_anz; i++) {
1903  h = (StFtpcConfMapPoint *)mHit->At(i);
1904 
1905  if (found_hits->At(h->GetHitNumber()) == 1) {
1906 
1907  // fill (+, -, both) cluster arrays
1908  found_value[found_cl++] = h->GetX();
1909  found_value[found_cl++] = h->GetY();
1910 
1911  if ((found_value[found_cl++] = h->GetZ())>0) {
1912  found_value_plus[found_cl_plus++] = h->GetX();
1913  found_value_plus[found_cl_plus++] = h->GetY();
1914  found_value_plus[found_cl_plus++] = h->GetZ();
1915  }
1916 
1917  else {
1918  found_value_minus[found_cl_minus++] = h->GetX();
1919  found_value_minus[found_cl_minus++] = h->GetY();
1920  found_value_minus[found_cl_minus++] = h->GetZ();
1921  }
1922  }
1923 
1924  else if (found_hits->At(h->GetHitNumber()) == 0) {
1925 
1926  unused_value[unused_cl++] = h->GetX();
1927  unused_value[unused_cl++] = h->GetY();
1928 
1929  if ((unused_value[unused_cl++] = h->GetZ())>0) {
1930  unused_value_plus[unused_cl_plus++] = h->GetX();
1931  unused_value_plus[unused_cl_plus++] = h->GetY();
1932  unused_value_plus[unused_cl_plus++] = h->GetZ();
1933  }
1934 
1935  else {
1936  unused_value_minus[unused_cl_minus++] = h->GetX();
1937  unused_value_minus[unused_cl_minus++] = h->GetY();
1938  unused_value_minus[unused_cl_minus++] = h->GetZ();
1939  }
1940  }
1941 
1942  else if (found_hits->At(h->GetHitNumber()) == -1) {
1943 
1944  wrong_value[wrong_cl++] = h->GetX();
1945  wrong_value[wrong_cl++] = h->GetY();
1946 
1947  if ((wrong_value[wrong_cl++] = h->GetZ())>0) {
1948  wrong_value_plus[wrong_cl_plus++] = h->GetX();
1949  wrong_value_plus[wrong_cl_plus++] = h->GetY();
1950  wrong_value_plus[wrong_cl_plus++] = h->GetZ();
1951  }
1952 
1953  else {
1954  wrong_value_minus[wrong_cl_minus++] = h->GetX();
1955  wrong_value_minus[wrong_cl_minus++] = h->GetY();
1956  wrong_value_minus[wrong_cl_minus++] = h->GetZ();
1957  }
1958  }
1959  }
1960 
1961  // create PolyMarkers
1962  found_hit->SetPolyMarker(found_cl/3, found_value, 1);
1963  found_hit_plus->SetPolyMarker(found_cl_plus/3, found_value_plus, 1);
1964  found_hit_minus->SetPolyMarker(found_cl_minus/3, found_value_minus, 1);
1965  unused_hit->SetPolyMarker(unused_cl/3, unused_value, 1);
1966  unused_hit_plus->SetPolyMarker(unused_cl_plus/3, unused_value_plus, 1);
1967  unused_hit_minus->SetPolyMarker(unused_cl_minus/3, unused_value_minus, 1);
1968  wrong_hit->SetPolyMarker(wrong_cl/3, wrong_value, 1);
1969  wrong_hit_plus->SetPolyMarker(wrong_cl_plus/3, wrong_value_plus, 1);
1970  wrong_hit_minus->SetPolyMarker(wrong_cl_minus/3, wrong_value_minus, 1);
1971 
1972  // set colors
1973  found_hit->SetMarkerColor(5);
1974  found_hit_plus->SetMarkerColor(5);
1975  found_hit_minus->SetMarkerColor(5);
1976  unused_hit->SetMarkerColor(1);
1977  unused_hit_plus->SetMarkerColor(1);
1978  unused_hit_minus->SetMarkerColor(1);
1979  wrong_hit->SetMarkerColor(2);
1980  wrong_hit_plus->SetMarkerColor(2);
1981  wrong_hit_minus->SetMarkerColor(2);
1982 
1983  // switch to right canvas and draw clusters
1984  mX_Y_Z->cd();
1985  found_hit->Draw("same");
1986  unused_hit->Draw("same");
1987  wrong_hit->Draw("same");
1988  mX_Y_Zplus->cd();
1989  found_hit_plus->Draw("same");
1990  unused_hit_plus->Draw("same");
1991  wrong_hit_plus->Draw("same");
1992  mX_Y_Zminus->cd();
1993  found_hit_minus->Draw("same");
1994  unused_hit_minus->Draw("same");
1995  wrong_hit_minus->Draw("same");
1996  }
1997 
1998  // update canvases
1999  mX_Y_Zplus->Update();
2000  mX_Y_Zminus->Update();
2001  mX_Y_Z->Update();
2002 
2003  delete[] x;
2004  delete[] y;
2005  delete[] z;
2006  delete[] good_track_to_show;
2007 
2008  return;
2009 }
2010 
2011 
2012 void StFtpcDisplay::DeleteFound()
2013 {
2014  // Deletes objects of found tracks.
2015 
2016  if (found_line) {
2017  delete[] found_line;
2018  found_line = 0;
2019  }
2020 
2021  if (found_value) {
2022  delete[] found_value;
2023  found_value = 0;
2024  }
2025 
2026  if (found_value_plus) {
2027  delete[] found_value_plus;
2028  found_value_plus = 0;
2029  }
2030 
2031  if (found_value_minus) {
2032  delete[] found_value_minus;
2033  found_value_minus = 0;
2034  }
2035 
2036  if (unused_value) {
2037  delete[] unused_value;
2038  unused_value = 0;
2039  }
2040 
2041  if (unused_value_plus) {
2042  delete[] unused_value_plus;
2043  unused_value_plus = 0;
2044  }
2045 
2046  if (unused_value_minus) {
2047  delete[] unused_value_minus;
2048  unused_value_minus = 0;
2049  }
2050 
2051  if (wrong_value) {
2052  delete[] wrong_value;
2053  wrong_value = 0;
2054  }
2055 
2056  if (wrong_value_plus) {
2057  delete[] wrong_value_plus;
2058  wrong_value_plus = 0;
2059  }
2060 
2061  if (wrong_value_minus) {
2062  delete[] wrong_value_minus;
2063  wrong_value_minus = 0;
2064  }
2065 
2066  return;
2067 }
2068 
2069 
2070 void StFtpcDisplay::DeleteGeant()
2071 {
2072  // Deletes objects of geant tracks.
2073 
2074  if (geant_line) {
2075  delete[] geant_line;
2076  geant_line = 0;
2077  }
2078 
2079  if (geant_value) {
2080  delete[] geant_value;
2081  geant_value = 0;
2082  }
2083 
2084  if (geant_value_plus) {
2085  delete[] geant_value_plus;
2086  geant_value_plus = 0;
2087  }
2088 
2089  if (geant_value_minus) {
2090  delete[] geant_value_minus;
2091  geant_value_minus = 0;
2092  }
2093 
2094  return;
2095 }
2096 
2097 void StFtpcDisplay::DrawNodes()
2098 {
2099  // Draw nodes in the right canvases and clears the canvases before.
2100  mX_Y_Zplus->cd();
2101  mNode1->cd();
2102  mNode1->Draw("");
2103 
2104  mX_Y_Zminus->cd();
2105  mNode2->cd();
2106  mNode2->Draw("");
2107 
2108  mX_Y_Z->cd();
2109  mNode0->cd();
2110  mNode0->Draw("");
2111 
2112  return;
2113 }
2114 
2115 
2116 void StFtpcDisplay::DeleteAll()
2117 {
2118  // Deletes objects of found and geant tracks.
2119 
2120  DeleteFound();
2121  DeleteGeant();
2122 }
2123 
2124 
2125 void StFtpcDisplay::OnOff(Bool_t on)
2126 {
2127  // Prints "On" or "Off".
2128 
2129  if (on) {
2130  cout << "On" << endl;
2131  }
2132 
2133  else {
2134  cout << "Off" << endl;
2135  }
2136 
2137  return;
2138 }
StFtpcDisplay()
wrong found hit coordinates of negative Ftpc