FairRoot/PandaRoot
hyp/draw_geom.C
Go to the documentation of this file.
1 {
2  // Macro created 19/09/2006 by S.Spataro
3  // It loads a simulation file and plot the geometry
4 
5  // Loading libraries
6  // If the macro gives error messages in loading libraries, please check the path of the libs and put it by hands
7 
8  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
9  basiclibs();
10 
11  gSystem->Load("libGeoBase");
12  gSystem->Load("libParBase");
13  gSystem->Load("libBase");
14  gSystem->Load("libPndData");
15  gSystem->Load("libField");
16  gSystem->Load("libGen");
17  gSystem->Load("libPassive");
18 
19  // add the detector libraries you need
20  //gSystem->Load("libStt");
21  //gSystem->Load("libMuo");
22  gSystem->Load("libHyp");
23  gSystem->Load("libGeom.so");
24 
25  TFile* f = new TFile("./sim_hyp.root"); // the sim file you want to analyse
26 
27  TGeoManager *geoMan = (TGeoManager*) f->Get("FAIRGeom");
28 
29  TCanvas* c1 = new TCanvas("c1", "", 100, 100, 800, 800); // to create a canvas where to plot the geometry
30  c1->SetFillColor(10);
31 
32  geoMan->SetVisLevel(4); // Number of folded geo levels; 3 for emc. Try to change the number and to see how the geometry changes.
33 
34  geoMan->GetMasterVolume()->Draw("same");
35 
36  TView* view = c1->GetView();
37  view->Top();
38  view->Centered();
39 
40  //drawing tracks
41 /*
42  TTree *t=file->Get("pndsim") ;
43 
44  TClonesArray *fT=new TClonesArray("TGeoTrack");
45 
46  t->SetBranchAddress("GeoTracks",&fT) ;
47 
48  TGeoTrack *tr;
49  TGeoTrack *tr1;
50 
51  for (Int_t j=0; j< t->GetEntriesFast(); j++)
52  {
53  t->GetEntry(j);
54  for (Int_t i=0; i<fT->GetEntriesFast(); i++)
55  {
56  tr=(TGeoTrack *)fT->At(i);
57  tr->Draw("same");
58  }
59  }*/
60 
61 }
62 
basiclibs()
TGeoManager * geoMan
TView * view
Definition: hyp/draw_geom.C:36
TFile * f
Definition: bump_analys.C:12
c1
Definition: plot_dirc.C:35