StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DrawTpcHits.C
1 {
2 
3  StTpcHitCollection *t = ((StEvent *)Event)->tpcHitCollection();
4  if (!t) {
5  printf(" No colection have been found!\n Did you forget to run <EventRead.C> macro first ?\n");
6  return;
7  }
8  TCanvas *m_TreeD = new TCanvas("STAF","Events",10,600,200,200);
9  TFile f("/star/u2a/fine/WWW/STAR");
10  // read STAR geometry database remotely
11  TGeometry *star = f.Get("STAR");
12  if (!star) {
13  printf("Sorry, STAR was not found !\n");
14  return;
15  }
16  TList *listOfNode = star->GetListOfNodes();
17  St_Node *hall = listOfNode->First();
18  // Remove hall from the kist of ROOT nodes to make it free of ROOT control
19  listOfNode->Remove(hall);
20  listOfNode->Remove(hall);
21  St_DataSetIter volume(hall);
22 //_______________________________________
23  St_Node *thisTrack = 0;
24  // Create a shape for this node
25  StHits3DPoints hitPoints(t);
26  St_PolyLineShape *trackShape = new St_PolyLineShape(&hitPoints);
27  trackShape->SetVisibility(1);
28  trackShape->SetLineColor(kYellow);
29  trackShape->SetLineStyle(1);
30  trackShape->SetLineWidth(2);
31  // Create a node to hold it
32  if (!thisTrack) {
33  thisTrack = new St_Node("hits","hits",trackShape);
34  thisTrack->Mark();
35  thisTrack->SetVisibility();
36  St_NodePosition *pp = hall->Add(thisTrack);
37  if (!pp) printf(" no position %d\n",ntrack);
38  }
39 //_______________________________________
40 
41  gBenchmark->Stop("Draw time");
42 // Select sensors
43  fullView = new St_NodeView(*hall);
44  // Create the "open" sub-structure from the full one
45  sensible = new St_NodeView(fullView);
46  printf(" drawing the STAR geometry sensible volumes and hits \n");
47  sensible->Draw();
48 
49  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/HitsDrawFullView.gif"> </P> End_Html //
50 
51  gPad->Update();
52  // Draw a help for x3d picture
53  printf(" drawing the HELP windows\n");
54  // === x3dHelpDraw();
55  // make simple view
56 
57  // Select node to be left
58  printf(" Marking the current structure to create another simplified one\n");
59  sensible->Mark(); // Select HALL
60  shortView = (St_NodeView *)sensible->FindByName("TPGV"); // Select TPGV
61  if (shortView) shortView->Mark();
62 
63  // Select all hits // Select ALL Hits
64  St_DataSetIter nextHits(sensible);
65  while (shortView = (St_NodeView *) nextHits()) {
66  if (strcmp(shortView->GetName(),"ZCAL")==0) continue; // skip ZCAL detector element
67  shortView->Mark();
68  }
69 
70  // Create new short view // New "short" dataset
71  printf(" Creating a new structure simplified structure\n");
72  shortView = new St_NodeView(sensible);
73  TCanvas *m_simpleD = new TCanvas("Detector","Simple view and hits",500,500,400,400);
74  shortView->Draw("L");
75 
76  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/HitsDrawSimpleView.gif"> </P> End_Html //
77 
78  printf(" Drawing the new structure simplified structure\n");
79  gPad->Update();
80  gBenchmark->Summary();
81  printf(" Drawing 3d solid view of the last structure\n");
82 
83 }
virtual TDataSet * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TDataSet.cxx:403
virtual void Remove(TDataSet *set)
Remiove the &quot;set&quot; from this TDataSet.
Definition: TDataSet.cxx:641
virtual void SetVisibility(ENodeSEEN vis=TVolume::kBothVisible)
Definition: TVolume.cxx:753
Definition: AgUStep.h:26