FairRoot/PandaRoot
ex1/macro/draw.C
Go to the documentation of this file.
1 // Macro for displaying the tracks for the STT1 simulation
2 // only the STT1 detector is ON
3 // input file testrun.root contains the MC information
4 //13/09/2006 Pablo Genova
5 
6 
7 {
8 
9  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
10  basiclibs();
11 
12  gSystem->Load("libGeoBase");
13  gSystem->Load("libParBase");
14  gSystem->Load("libBase");
15  gSystem->Load("libPndData");
16  gSystem->Load("libField");
17  gSystem->Load("libPassive");
18  gSystem->Load("libPlane");
19  gSystem->Load("libStt");
20  gSystem->Load("libGen");
21  gSystem->Load("libGeom.so");
22 
23 
24  TFile* file = new TFile("ex1.root");
25  TGeoManager *geoMan = (TGeoManager*) file->Get("FAIRGeom");
26 
27 
28  TCanvas* c1 = new TCanvas("c1", "", 100, 100, 800, 800);
29  c1->SetFillColor(10);
30 
31  geoMan->SetVisLevel(3);
32  geoMan->GetMasterVolume()->Draw("same");
33 
34 
35  TView* view = c1->GetView();
36  view->Top();
37  view->Centered();
38  // view->SetParralel();
39 
40  //drawing tracks
41  TTree *t=file->Get("pndsim") ;
42 
43  TClonesArray *fT=new TClonesArray("TGeoTrack");
44 
45  t->SetBranchAddress("GeoTracks",&fT) ;
46 
47 
48 TGeoTrack *tr;
49  TObjArray *TrList= geoMan->GetListOfTracks();
50  for (Int_t j=0; j< t->GetEntriesFast(); j++) {
51  t->GetEntry(j);
52  for (Int_t i=0; i<fT->GetEntriesFast(); i++) {
53  tr=(TGeoTrack *)fT->At(i);
54 // tr->Draw("same"); // uncommit this to draw the tracks one by on
55  TrList->AddLast(tr);
56  }
57  }
58 
59  //geoMan->AnimateTracks(0,1E-7, 500,"/G"); // uncommit this to animate the tracks
60 
61  geoMan->DrawTracks("same"); // this will draw all tracks added to the TrList at once
62 
63 }
64 
TObjArray * TrList
TGeoManager * geoMan
Int_t i
Definition: run_full.C:25
TFile * file
basiclibs()
TView * view
TClonesArray * fT
TGeoTrack * tr
TCanvas * c1
TTree * t