FairRoot/PandaRoot
Functions
macro/detectors/drc/eventDisplay.C File Reference

Go to the source code of this file.

Functions

int eventDisplay (TString inFile="sim.root", TString parFile="par.root", TString hitFile="hit.root", TString outid="n")
 

Function Documentation

int eventDisplay ( TString  inFile = "sim.root",
TString  parFile = "par.root",
TString  hitFile = "hit.root",
TString  outid = "n" 
)

Definition at line 1 of file macro/detectors/drc/eventDisplay.C.

References b, Bool_t, Double_t, fi, file, fMan, fRun, gGeoManager, hitFile, i, inFile, next, parFile, parInput1, rtdb, topvol, tr, Track, TString, v, x, y, and z.

1  {
2  // ----- Reconstruction run -------------------------------------------
3  FairRunAna *fRun= new FairRunAna();
4  fRun->SetInputFile(inFile);
5  fRun->AddFriend(hitFile);
6  fRun->SetOutputFile("tst.root");
7 
8  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
9  FairParRootFileIo* parInput1 = new FairParRootFileIo();
10  parInput1->open(parFile);
11  rtdb->setFirstInput(parInput1);
12 
13  FairEventManager *fMan= new FairEventManager();
14  FairMCTracks *Track = new FairMCTracks ("Monte-Carlo Tracks");
15  FairMCPointDraw *PndBarPoint = new FairMCPointDraw ("DrcBarPoint",kViolet, kFullSquare);
16  FairMCPointDraw *PndEVPoint = new FairMCPointDraw ("DrcEVPoint",kViolet, kFullSquare);
17  FairMCPointDraw *PndPdPoint = new FairMCPointDraw ("DrcPDPoint",kBlue, kFullSquare);
18  PndDrcAccuDigiPixelDraw *PndAccuDigi = new PndDrcAccuDigiPixelDraw ("DrcPDHit",hitFile,7); //7. //3 //0.5
19 
20  fMan->AddTask(Track);
21  fMan->AddTask(PndBarPoint);
22  fMan->AddTask(PndEVPoint);
23  fMan->AddTask(PndPdPoint);
24  fMan->AddTask(PndAccuDigi);
25 
26  fMan->Init(1,5);
27 
28  gGeoManager->SetNsegments(100);
29  TIter next((TObjArray*)gGeoManager->GetListOfVolumes());
30  TGeoVolume *vol;
31  while((vol=(TGeoVolume*)next())){
32  TString volumename = vol->GetName();
33  if(!volumename.Contains("Drc")) vol->SetVisibility(kFALSE);
34  if(volumename.Contains("DrcBarSupport")) vol->SetVisibility(kFALSE);
35  if(volumename.Contains("DrcAirBox")) vol->SetTransparency(80);
36  if(volumename.Contains("DrcEVSensor")) vol->SetTransparency(80);
37  if(volumename.Contains("DrcBarSensor")) vol->SetTransparency(80);
38  if(volumename.Contains("DrcLENS")) vol->SetTransparency(90);
39  if(volumename.Contains("DrcMirr")) vol->SetTransparency(50);
40  if(volumename.Contains("DrcEVgrease")) vol->SetTransparency(90);
41 
42  //vol->SetTransparency(0);
43  // vol->SetLineColor(17);
44  }
45 
46 
47  TFile* fi = new TFile("vgeo.root","RECREATE");
48  TGeoVolume *topvol = gGeoManager->GetVolume("cave");
49  topvol->CheckOverlaps(0.0001, "");
50  gGeoManager->CheckOverlaps(0.00001,""); // [cm]
51  TObjArray *listOfOverlaps = gGeoManager->GetListOfOverlaps();
52  cout<<listOfOverlaps->GetEntries()<<endl;
53  listOfOverlaps->Print();
54 
55  gGeoManager->SetTopVolume(topvol);
56  gGeoManager->CloseGeometry();
57  topvol->Write();
58 
59  FairEventManager* fm = FairEventManager::Instance();
60  fm->NextEvent();
61  TEveTrackList *eltrack = (TEveTrackList*) fm->FindChild("Cherenkov");
62 
63  int b=0;
64  Double_t x,y,z;
65 
66  Bool_t storePYtracks = false;
67  if(storePYtracks){
68  TEveElement::List_t ll = eltrack->RefChildren();
69  ofstream file;
70  file.open ("trackst.py");
71  for ( TEveElement::List_i ii = ll.begin(); ii != ll.end();++ii){
72  TEveTrack * tr = (TEveTrack*)(*ii);
73  Int_t size = tr->Size();
74  if(size<10) continue;
75  TString blendtrack = "listOfVectors = [";
76  for(Int_t i=0; i<size; i++){
77  tr->GetPoint(i,x,y,z);
78  blendtrack += Form("Vector((%f,%f,%f)),",x,y,z);
79  }
80  blendtrack = blendtrack.Strip(TString::kTrailing,',') + "] \n";
81  blendtrack += Form("MakePolyLine(\"Track_%d\", \"TrackN_%d\", listOfVectors) \n",i,i);
82  file<< blendtrack;
83  }
84  file.close();
85  }
86 
87  // //fm->DisableListElements();
88  // TEveElement *el = fm->FindChild("DrcPDPoint");
89  // el->Destroy();
90  // el = fm->FindChild("DrcEVPoint");
91  // el->Destroy();
92 
93  TGLViewer *v = gEve->GetDefaultGLViewer();
94  //v->SetClearColor(0);
95  v->SetIgnoreSizesOnUpdate(kTRUE);
96  v->UpdateScene(kTRUE);
97  //v->GetLightSet()->SetSpecularPower(0.6);
98  v->GetLightSet()->SetFrontPower(0.8);
99  TGLSAViewer *sav = (TGLSAViewer *)v;
100  sav->SetDrawCameraCenter(false);
101 
102  // TGLCamera & cam=(TGLOrthoCamera &)v->CurrentCamera();
103  // Double_t c[] = {46.8, 8.9, -120.};
104  // Double_t c[] = {10, 125, -125};
105  // cam.Configure(16.5,1,c,-0.3,1.8);
106  // cam.SetExternalCenter(false);
107 
108  // TGLCamera & cam=(TGLOrthoCamera &)v->CurrentCamera();
109 
110  // Double_t c[] = {180, 0, -200}; // for hits
111  // cam.Configure(13,1,c,-0.2,1.3); // for hits
112 
113  // Double_t c[] = {90, 8.9, -150.};
114  // cam.Configure(25,1,c,-0.4,0.9); // for geom
115  // cam.SetExternalCenter(false);
116 
117  v->DoDraw();
118  fm->EnableListElements();
119  gEve->DoRedraw3D();
120  v->DoDraw();
121  v->SavePicture("geometry.png");
122  // v->SavePicture("anim_"+outid+".png");
123 
124  return 0;
125 }
Int_t i
Definition: run_full.C:25
TTree * b
TFile * file
TGeoManager * gGeoManager
__m128 v
Definition: P4_F32vec4.h:4
FairRunAna * fRun
Definition: hit_dirc.C:58
TString inFile
Definition: hit_dirc.C:8
FairMCTracks * Track
Definition: drawEveTracks.C:8
TFile * fi
Double_t
TString parFile
Definition: hit_dirc.C:14
TString hitFile
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
Double_t z
TGeoVolume * topvol
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
Double_t x
FairEventManager * fMan
Definition: drawEveTracks.C:7
Double_t y
static int next[96]
Definition: ranlxd.cxx:374