Warning, file /pfRICH/Visualization/Draw_model.C was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "TEveTrack.h"
0020 #include "TEveTrackPropagator.h"
0021 #include "TEveElement.h"
0022 #include "TEveGeoShape.h"
0023 #include "TGeoTube.h"
0024 #include "TTreeReader.h"
0025 #include "TTreeReaderArray.h"
0026 #include "TROOT.h"
0027 #include "TSystem.h"
0028 #include "TFile.h"
0029 #include "TEveManager.h"
0030 #include "TGeoManager.h"
0031 #include "TGeoVolume.h"
0032 #include "TEveGeoNode.h"
0033 #include "TEveText.h"
0034 #ifndef __RUN_EPIC_DISPLAY__
0035
0036
0037
0038
0039 void epic_load_event();
0040 void epic_make_gui();
0041 void SetViewers(TEveViewer *RPhi, TEveViewer *RhoZ, TEveScene *fRPhiScene, TEveScene *fRhoZScene);
0042 TEvePointSet* AddHits(TTreeReaderArray<Double_t> *xhit,TTreeReaderArray<Double_t> *yhit,TTreeReaderArray<Double_t> *zhit, TTreeReaderArray<Int_t> *quality, TEvePointSet *hits, TString name ="");
0043 void run_epic_display();
0044
0045
0046 class MultiView;
0047 MultiView* gMultiView = 0;
0048 TEveTrack *track; TEveRecTrackD *rc; TEvePointSetArray *hits=0;
0049 TEveTrackList *gTrackList = 0;
0050 Int_t iEvent = 0;
0051 TGNumberEntry *num=0x0;
0052
0053
0054
0055
0056
0057 TFile* file = new TFile("sim.edm4hep.root");
0058
0059 TTreeReader myReader("events", file);
0060
0061 TTreeReaderArray<Float_t> charge(myReader, "MCParticles.charge");
0062 TTreeReaderArray<Double_t> vx_mc(myReader, "MCParticles.vertex.x");
0063 TTreeReaderArray<Double_t> vy_mc(myReader, "MCParticles.vertex.y");
0064 TTreeReaderArray<Double_t> vz_mc(myReader, "MCParticles.vertex.z");
0065 TTreeReaderArray<Float_t> px_mc(myReader, "MCParticles.momentum.x");
0066 TTreeReaderArray<Float_t> py_mc(myReader, "MCParticles.momentum.y");
0067 TTreeReaderArray<Float_t> pz_mc(myReader, "MCParticles.momentum.z");
0068 TTreeReaderArray<Int_t> status(myReader, "MCParticles.generatorStatus");
0069 TTreeReaderArray<Int_t> pdg(myReader, "MCParticles.PDG");
0070
0071
0072 TTreeReaderArray<Double_t> *vtx_si_x, *vtx_si_y, *vtx_si_z;
0073 TTreeReaderArray<Double_t> *barrel_si_x1, *barrel_si_y1, *barrel_si_z1;
0074 TTreeReaderArray<Double_t> *disks_si_x2, *disks_si_y2, *disks_si_z2;
0075 TTreeReaderArray<Double_t> *endcap_tof_x1, *endcap_tof_y1, *endcap_tof_z1;
0076 TTreeReaderArray<Double_t> *barrel_mm_x2, *barrel_mm_y2, *barrel_mm_z2;
0077 TTreeReaderArray<Double_t> *barrel_tof_x, *barrel_tof_y, *barrel_tof_z;
0078 TTreeReaderArray<Double_t> *pfRICH_x, *pfRICH_y, *pfRICH_z;
0079 TTreeReaderArray<Int_t> *vtx_si_quality, *barrel_si_quality, *disks_si_quality, *endcap_etof_quality, *barrel_mm_quality, *barrel_tof_quality, *pfRICH_quality;
0080
0081
0082 void epic_display()
0083 {
0084
0085
0086
0087
0088
0089
0090 vtx_si_x = new TTreeReaderArray<Double_t>(myReader, "VertexBarrelHits.position.x");
0091 vtx_si_y = new TTreeReaderArray<Double_t>(myReader, "VertexBarrelHits.position.y");
0092 vtx_si_z = new TTreeReaderArray<Double_t>(myReader, "VertexBarrelHits.position.z");
0093 vtx_si_quality = new TTreeReaderArray<Int_t>(myReader, "VertexBarrelHits.quality");
0094
0095 barrel_si_x1 = new TTreeReaderArray<Double_t>(myReader, "SiBarrelHits.position.x");
0096 barrel_si_y1 = new TTreeReaderArray<Double_t>(myReader, "SiBarrelHits.position.y");
0097 barrel_si_z1 = new TTreeReaderArray<Double_t>(myReader, "SiBarrelHits.position.z");
0098 barrel_si_quality = new TTreeReaderArray<Int_t>(myReader, "SiBarrelHits.quality");
0099
0100 disks_si_x2 = new TTreeReaderArray<Double_t>(myReader, "TrackerEndcapHits.position.x");
0101 disks_si_y2 = new TTreeReaderArray<Double_t>(myReader, "TrackerEndcapHits.position.y");
0102 disks_si_z2 = new TTreeReaderArray<Double_t>(myReader, "TrackerEndcapHits.position.z");
0103 disks_si_quality = new TTreeReaderArray<Int_t>(myReader, "TrackerEndcapHits.quality");
0104
0105 endcap_tof_x1 = new TTreeReaderArray<Double_t>(myReader, "TOFEndcapHits.position.x");
0106 endcap_tof_y1 = new TTreeReaderArray<Double_t>(myReader, "TOFEndcapHits.position.y");
0107 endcap_tof_z1 = new TTreeReaderArray<Double_t>(myReader, "TOFEndcapHits.position.z");
0108 endcap_etof_quality = new TTreeReaderArray<Int_t>(myReader, "TOFEndcapHits.quality");
0109
0110 barrel_mm_x2 = new TTreeReaderArray<Double_t>(myReader, "MPGDBarrelHits.position.x");
0111 barrel_mm_y2 = new TTreeReaderArray<Double_t>(myReader, "MPGDBarrelHits.position.y");
0112 barrel_mm_z2 = new TTreeReaderArray<Double_t>(myReader, "MPGDBarrelHits.position.z");
0113 barrel_mm_quality = new TTreeReaderArray<Int_t>(myReader, "MPGDBarrelHits.quality");
0114
0115 barrel_tof_x = new TTreeReaderArray<Double_t>(myReader, "TOFBarrelHits.position.x");
0116 barrel_tof_y = new TTreeReaderArray<Double_t>(myReader, "TOFBarrelHits.position.y");
0117 barrel_tof_z = new TTreeReaderArray<Double_t>(myReader, "TOFBarrelHits.position.z");
0118 barrel_tof_quality = new TTreeReaderArray<Int_t>(myReader, "TOFBarrelHits.quality");
0119
0120 pfRICH_x = new TTreeReaderArray<Double_t>(myReader, "PFRICHHits.position.x");
0121 pfRICH_y = new TTreeReaderArray<Double_t>(myReader, "PFRICHHits.position.y");
0122 pfRICH_z = new TTreeReaderArray<Double_t>(myReader, "PFRICHHits.position.z");
0123 pfRICH_quality = new TTreeReaderArray<Int_t>(myReader, "PFRICHHits.quality");
0124
0125
0126 gROOT->LoadMacro("MultiView.C+");
0127
0128
0129 }
0130
0131
0132
0133
0134
0135 void run_epic_display()
0136 {
0137
0138
0139
0140 Bool_t enable_rectrack_draw = kFALSE;
0141 Bool_t enable_hit_draw = kTRUE;
0142 Bool_t drawname = kFALSE;
0143 Bool_t draw_transparent = false;
0144 Bool_t draw_full_geo = true;
0145
0146 int startnode = 3; int endnode = 9;
0147
0148 TString rootfile="Recolored_detector.root";
0149 TEveManager::Create();
0150 gGeoManager = TGeoManager::Import(rootfile);
0151 if (gGeoManager == nullptr) return;
0152
0153
0154
0155 if (draw_transparent){
0156 TObjArray* allvolumes = gGeoManager->GetListOfVolumes();
0157 for(Int_t i=0; i<allvolumes->GetEntries();i++){
0158 TGeoVolume* vol= (TGeoVolume*)allvolumes->At(i);
0159 TString volname = vol->GetIconName();
0160 if (volname.Contains("SVTX")) vol->SetLineColor(kRed);
0161 else if (volname.Contains("BARR")) vol->SetLineColor(kBlue);
0162 vol->SetTransparency(99);
0163 }
0164 }
0165
0166
0167 TObjArray* allnodes = gGeoManager->GetTopNode()->GetNodes();
0168 const int nNodes = allnodes->GetEntries();
0169 if (draw_full_geo){
0170 TEveGeoTopNode *EPIC_Tracker = new TEveGeoTopNode(gGeoManager,gGeoManager->GetTopNode());
0171 EPIC_Tracker->SetVisLevel(100);
0172 cout << "Number of nodes in the geometry: " << nNodes << endl;
0173 gEve->AddGlobalElement(EPIC_Tracker);
0174 }
0175 else{
0176 for(Int_t i=startnode; i<endnode;i++){
0177 TGeoNode* node= (TGeoNode*)allnodes->At(i);
0178 TString volname = node->GetVolume()->GetName();
0179 TEveGeoTopNode *evenode = new TEveGeoTopNode(gGeoManager,node);
0180 evenode->SetVisLevel(5);
0181 gEve->AddGlobalElement(evenode);
0182 }
0183 }
0184
0185 gEve->FullRedraw3D(kTRUE);
0186 gEve->GetBrowser()->GetTabRight()->SetTab(1);
0187
0188 TEveProjectionManager *fRPhiProjManager = new TEveProjectionManager(TEveProjection::kPT_RPhi);
0189 TEveProjectionManager *fRhoZProjManager = new TEveProjectionManager(TEveProjection::kPT_RhoZ);
0190 gEve->AddToListTree(fRPhiProjManager, kFALSE);
0191 gEve->AddToListTree(fRhoZProjManager, kFALSE);
0192 TEveProjectionAxes *fAxesPhi = new TEveProjectionAxes(fRPhiProjManager);
0193 TEveProjectionAxes *fAxesRho = new TEveProjectionAxes(fRhoZProjManager);
0194
0195 TEveWindowSlot *RPhiSlot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
0196 TEveWindowPack *RPhiPack = RPhiSlot->MakePack();
0197 RPhiPack->SetElementName("RPhi View");
0198 RPhiPack->SetShowTitleBar(kFALSE);
0199 RPhiPack->NewSlot()->MakeCurrent();
0200 TEveViewer *fRPhiView = gEve->SpawnNewViewer("RPhi View", "");
0201 TEveScene *fRPhiScene = gEve->SpawnNewScene("RPhi", "Scene holding axis.");
0202 fRPhiScene->AddElement(fAxesPhi);
0203
0204 TEveWindowSlot *RhoZSlot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
0205 TEveWindowPack *RhoZPack = RhoZSlot->MakePack();
0206 RhoZPack->SetElementName("RhoZ View");
0207 RhoZPack->SetShowTitleBar(kFALSE);
0208 RhoZPack->NewSlot()->MakeCurrent();
0209 TEveViewer *fRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
0210 TEveScene *fRhoZScene = gEve->SpawnNewScene("RhoZ", "Scene holding axis.");
0211 fRhoZScene->AddElement(fAxesRho);
0212
0213 SetViewers(fRPhiView, fRhoZView,fRPhiScene,fRhoZScene);
0214
0215
0216 gTrackList = new TEveTrackList("MCTracks");
0217 gTrackList->SetMainColor(kMagenta);
0218 gTrackList->SetLineColor(kMagenta);
0219 gTrackList->SetMarkerColor(kMagenta);
0220 gTrackList->SetMarkerStyle(4);
0221 gTrackList->SetMarkerSize(0.5);
0222 gEve->AddElement(gTrackList);
0223
0224 for (int ilayer=0; ilayer<6; ilayer++){
0225 hits = new TEvePointSetArray(Form("EPICHits%d",ilayer));
0226 hits->SetMarkerColor(kGreen);
0227 hits->SetMarkerStyle(47);
0228 hits->SetMarkerSize(1.4);
0229 gEve->AddElement(hits);
0230 }
0231
0232 TEveTrackPropagator* trkProp = gTrackList->GetPropagator();
0233 trkProp->SetFitDaughters(kFALSE);
0234 trkProp->SetMaxZ(300);
0235 trkProp->SetMaxR(300);
0236 trkProp->SetMagField(0.,0.,1.7);
0237 trkProp->SetMaxStep(25.0);
0238
0239
0240
0241
0242 epic_make_gui();
0243 epic_load_event();
0244
0245 gEve->Redraw3D(kTRUE);
0246 }
0247
0248
0249
0250
0251
0252
0253 void epic_load_event()
0254 {
0255 cout<<"Event No. "<<iEvent<<endl;
0256 myReader.SetEntry(iEvent);
0257 gTrackList->DestroyElements();
0258 hits->DestroyElements();
0259
0260 Int_t propagator = 1;
0261 TEveTrackPropagator *trkProp = gTrackList->GetPropagator();
0262 if (propagator==1)
0263 {
0264 trkProp->SetStepper(TEveTrackPropagator::kRungeKutta);
0265 gTrackList->SetName("RK Propagator");
0266 }
0267 else if (propagator==2)
0268 {
0269 trkProp->SetStepper(TEveTrackPropagator::kHelix);
0270 gTrackList->SetName("Heix Propagator");
0271 }
0272
0273 bool flag = true;
0274 for (int iParticle = 0; iParticle < charge.GetSize(); ++iParticle)
0275 {
0276 if ((status[iParticle]!=1)) continue;
0277 rc = new TEveRecTrackD();
0278 rc->fV.Set(vx_mc[iParticle],vy_mc[iParticle],vz_mc[iParticle]);
0279 rc->fP.Set(px_mc[iParticle],py_mc[iParticle],pz_mc[iParticle]);
0280 rc->fSign = charge[iParticle];
0281
0282 Double_t prec = sqrt(px_mc[iParticle]*px_mc[iParticle]+py_mc[iParticle]*py_mc[iParticle]+pz_mc[iParticle]*pz_mc[iParticle]);
0283 Double_t etarec = -1.0*TMath::Log(TMath::Tan((TMath::ACos(pz_mc[iParticle]/prec))/2));
0284
0285
0286 track = new TEveTrack(rc, trkProp);
0287
0288 track->SetMarkerStyle(4);
0289 track->SetLineWidth(2);
0290 track->SetLineColor(kMagenta);
0291 track->SetName(Form("Track_No%d",iParticle));
0292 track->SetElementTitle(Form("Event =%d \n" "TrackNo.=%d,"
0293 "P = (%.3f, %.3f, %.3f)\n" "P = %.3f GeV/c \n" "Eta =%.3f \n" "Pt =%.3f \n"
0294 ,iEvent,iParticle, px_mc[iParticle],py_mc[iParticle],pz_mc[iParticle],prec,etarec,sqrt(px_mc[iParticle]*px_mc[iParticle]+py_mc[iParticle]*py_mc[iParticle])));
0295 gTrackList->AddElement(track);
0296 }
0297 gTrackList->MakeTracks();
0298 gTrackList->SetLineColor(kMagenta);
0299 TEvePointSet *hits_EPIC[7];
0300 if (flag){
0301 hits->AddElement(AddHits(vtx_si_x, vtx_si_y, vtx_si_z, vtx_si_quality, hits_EPIC[0],"VTX Hits"));
0302 hits->AddElement(AddHits(barrel_si_x1, barrel_si_y1, barrel_si_z1, barrel_si_quality, hits_EPIC[1],"BARREL Hits"));
0303 hits->AddElement(AddHits(disks_si_x2, disks_si_y2, disks_si_z2, disks_si_quality, hits_EPIC[2],"Si Disks Hits"));
0304 hits->AddElement(AddHits(endcap_tof_x1, endcap_tof_y1, endcap_tof_z1, endcap_etof_quality, hits_EPIC[3],"ETOF Hits"));
0305 hits->AddElement(AddHits(barrel_mm_x2, barrel_mm_y2, barrel_mm_z2, barrel_mm_quality, hits_EPIC[4],"Barrel MPGD Hits"));
0306 hits->AddElement(AddHits(barrel_tof_x, barrel_tof_y, barrel_tof_z, barrel_tof_quality, hits_EPIC[5],"Barrel TOF Hits"));
0307 hits->AddElement(AddHits(pfRICH_x, pfRICH_y, pfRICH_z, pfRICH_quality, hits_EPIC[6],"pfRICH Hits"));
0308 }
0309
0310 TGLViewer *viewer = gEve->GetDefaultGLViewer();
0311 viewer->GetClipSet()->SetClipType(TGLClip::kClipNone);
0312 Double_t center[3] ={0.,0.,0.};
0313 Double_t *cent; cent = center;
0314 viewer->SetOrthoCamera(TGLViewer::kCameraOrthoZOX,2.0, 1.0, cent,1.0,0.);
0315
0316 viewer->RefreshPadEditor(viewer);
0317
0318 viewer->DoDraw();
0319
0320 TEveElement* top = static_cast<TEveElement*>(gEve->GetEventScene());
0321 gEve->Redraw3D();
0322 }
0323
0324
0325
0326
0327
0328 class EventHandler
0329 {
0330 public:
0331 void Fwd()
0332 {
0333 ++iEvent;
0334 epic_load_event();
0335 }
0336 void Bck()
0337 {
0338 if(iEvent>0) {
0339 --iEvent;
0340 epic_load_event();
0341 }
0342 }
0343 void GotoEvent()
0344 {
0345 if (!num) cout<<"GotoEvent: Event Not Found !!! "<<endl;
0346 iEvent = num->GetIntNumber();
0347 if (iEvent>=0)
0348 epic_load_event();
0349 }
0350 };
0351
0352
0353 void epic_make_gui()
0354 {
0355
0356
0357 TEveBrowser* browser = gEve->GetBrowser();
0358 browser->StartEmbedding(TRootBrowser::kLeft);
0359
0360 TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
0361 frmMain->SetWindowName("XX GUI");
0362 frmMain->SetCleanup(kDeepCleanup);
0363
0364 TGHorizontalFrame* hf = new TGHorizontalFrame(frmMain);
0365 {
0366
0367 TString icondir( Form("%s/icons/", gSystem->Getenv("ROOTSYS")) );
0368 TGPictureButton* b = 0;
0369 Int_t width = 30;
0370
0371
0372 EventHandler *fh = new EventHandler;
0373
0374 b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoBack.gif"));
0375
0376 b->SetToolTipText("Go to previous event - not supported.");
0377 hf->AddFrame(b);
0378 b->Connect("Clicked()", "EventHandler", fh, "Bck()");
0379
0380 b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoForward.gif"));
0381 b->SetToolTipText("Generate new event.");
0382 hf->AddFrame(b);
0383 b->Connect("Clicked()", "EventHandler", fh, "Fwd()");
0384
0385
0386 num = new TGNumberEntry(hf, 0, 5, 1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
0387 TGNumberFormat::kNELLimitMinMax, 0, 10000);
0388 hf->AddFrame(num, new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,5,5));
0389
0390 TGTextButton *btext = new TGTextButton(hf, "Go to Event", 100);
0391 hf->AddFrame(btext, new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,5,5));
0392 btext->Connect("Clicked()", "EventHandler", fh, "GotoEvent()");
0393
0394 }
0395 frmMain->AddFrame(hf);
0396
0397 frmMain->MapSubwindows();
0398 frmMain->Resize();
0399 frmMain->MapWindow();
0400
0401 browser->StopEmbedding();
0402 browser->SetTabTitle("Event Control", 0);
0403 }
0404
0405
0406 TEvePointSet* AddHits(TTreeReaderArray<Double_t> *xhit,TTreeReaderArray<Double_t> *yhit,TTreeReaderArray<Double_t> *zhit, TTreeReaderArray<Int_t> *quality, TEvePointSet *hits, TString name ="")
0407 {
0408
0409 Int_t nhits = xhit->GetSize();
0410 hits = new TEvePointSet(nhits);
0411 for (Int_t hitno=0; hitno<nhits; ++hitno){
0412 Int_t hitquality = quality->At(hitno);
0413
0414 hits->SetPoint(hitno,xhit->At(hitno)*0.1,yhit->At(hitno)*0.1,zhit->At(hitno)*0.1);
0415 hits->SetName(Form("Hits_%s",name.Data()));
0416 hits->SetMarkerColor(kGreen);
0417 hits->SetMarkerStyle(47);
0418 hits->SetMarkerSize(1.4);
0419 }
0420 return hits;
0421 }
0422
0423 void SetViewers(TEveViewer *RPhi, TEveViewer *RhoZ, TEveScene *fRPhiScene, TEveScene *fRhoZScene)
0424 {
0425
0426 RPhi->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
0427
0428
0429
0430 RPhi->GetGLViewer()->GetCameraOverlay()->SetOrthographicMode(TGLCameraOverlay::kAxis);
0431 RPhi->GetGLViewer()->GetCameraOverlay()->SetShowOrthographic(kTRUE);
0432
0433 RPhi->GetGLViewer()->GetLightSet()->SetLight(TGLLightSet::kLightLeft, false);
0434 RPhi->GetGLViewer()->GetLightSet()->SetLight(TGLLightSet::kLightRight, false);
0435 RPhi->GetGLViewer()->GetLightSet()->SetLight(TGLLightSet::kLightTop, false);
0436 RPhi->GetGLViewer()->GetLightSet()->SetLight(TGLLightSet::kLightBottom, false);
0437
0438 RhoZ->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoZOY);
0439
0440
0441
0442 RhoZ->GetGLViewer()->GetCameraOverlay()->SetOrthographicMode(TGLCameraOverlay::kAxis);
0443 RhoZ->GetGLViewer()->GetCameraOverlay()->SetShowOrthographic(kTRUE);
0444
0445 RhoZ->GetGLViewer()->GetLightSet()->SetLight(TGLLightSet::kLightLeft, false);
0446 RhoZ->GetGLViewer()->GetLightSet()->SetLight(TGLLightSet::kLightRight, false);
0447 RhoZ->GetGLViewer()->GetLightSet()->SetLight(TGLLightSet::kLightFront, false);
0448
0449 RPhi->AddScene(fRPhiScene);
0450 RPhi->AddScene(gEve->GetGlobalScene());
0451 RPhi->AddScene(gEve->GetEventScene());
0452 RhoZ->AddScene(fRhoZScene);
0453 RhoZ->AddScene(gEve->GetGlobalScene());
0454 RhoZ->AddScene(gEve->GetEventScene());
0455
0456 }
0457
0458
0459 #endif
0460
0461
0462 void Draw_model(const bool event=false)
0463 {
0464 epic_display();
0465 TEveManager::Create();
0466 gGeoManager = TGeoManager::Import("Recolored_detector.root");
0467
0468
0469
0470
0471 if (gGeoManager == nullptr) return;
0472
0473
0474 std::vector<TString> nodes;
0475 Bool_t draw_transparent = false;
0476 Bool_t draw_event = true;
0477
0478
0479 if (draw_transparent){
0480 TObjArray* allvolumes = gGeoManager->GetListOfVolumes();
0481 for(Int_t i=0; i<allvolumes->GetEntries();i++){
0482 TGeoVolume* vol= (TGeoVolume*)allvolumes->At(i);
0483 TString volname = vol->GetIconName();
0484 vol->SetTransparency(80);
0485 }
0486 }
0487
0488 TEveGeoTopNode *EPIC_Tracker = new TEveGeoTopNode(gGeoManager,gGeoManager->GetTopNode());
0489 EPIC_Tracker->SetVisLevel(10);
0490 gEve->AddGlobalElement(EPIC_Tracker);
0491
0492
0493 if (event) {
0494 gEve->FullRedraw3D(kTRUE);
0495 gEve->GetBrowser()->GetTabRight()->SetTab(1);
0496
0497 TEveProjectionManager *fRPhiProjManager = new TEveProjectionManager(TEveProjection::kPT_RPhi);
0498 TEveProjectionManager *fRhoZProjManager = new TEveProjectionManager(TEveProjection::kPT_RhoZ);
0499 gEve->AddToListTree(fRPhiProjManager, kFALSE);
0500 gEve->AddToListTree(fRhoZProjManager, kFALSE);
0501 TEveProjectionAxes *fAxesPhi = new TEveProjectionAxes(fRPhiProjManager);
0502 TEveProjectionAxes *fAxesRho = new TEveProjectionAxes(fRhoZProjManager);
0503
0504 TEveWindowSlot *RPhiSlot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
0505 TEveWindowPack *RPhiPack = RPhiSlot->MakePack();
0506 RPhiPack->SetElementName("RPhi View");
0507 RPhiPack->SetShowTitleBar(kFALSE);
0508 RPhiPack->NewSlot()->MakeCurrent();
0509 TEveViewer *fRPhiView = gEve->SpawnNewViewer("RPhi View", "");
0510 TEveScene *fRPhiScene = gEve->SpawnNewScene("RPhi", "Scene holding axis.");
0511 fRPhiScene->AddElement(fAxesPhi);
0512
0513 TEveWindowSlot *RhoZSlot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
0514 TEveWindowPack *RhoZPack = RhoZSlot->MakePack();
0515 RhoZPack->SetElementName("RhoZ View");
0516 RhoZPack->SetShowTitleBar(kFALSE);
0517 RhoZPack->NewSlot()->MakeCurrent();
0518 TEveViewer *fRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
0519 TEveScene *fRhoZScene = gEve->SpawnNewScene("RhoZ", "Scene holding axis.");
0520 fRhoZScene->AddElement(fAxesRho);
0521
0522 SetViewers(fRPhiView, fRhoZView,fRPhiScene,fRhoZScene);
0523
0524
0525 gTrackList = new TEveTrackList("MCTracks");
0526 gTrackList->SetMainColor(kMagenta);
0527 gTrackList->SetLineColor(kMagenta);
0528 gTrackList->SetMarkerColor(kMagenta);
0529 gTrackList->SetMarkerStyle(4);
0530 gTrackList->SetMarkerSize(0.5);
0531 gEve->AddElement(gTrackList);
0532
0533 for (int ilayer=0; ilayer<6; ilayer++){
0534 hits = new TEvePointSetArray(Form("EPICHits%d",ilayer));
0535 hits->SetMarkerColor(kGreen);
0536 hits->SetMarkerStyle(47);
0537 hits->SetMarkerSize(1.4);
0538 gEve->AddElement(hits);
0539 }
0540
0541
0542 TEveTrackPropagator* trkProp = gTrackList->GetPropagator();
0543 trkProp->SetFitDaughters(kFALSE);
0544 trkProp->SetMaxZ(300);
0545 trkProp->SetMaxR(300);
0546 trkProp->SetMagField(0.,0.,1.7);
0547 trkProp->SetMaxStep(25.0);
0548
0549
0550
0551
0552
0553 epic_make_gui();
0554 epic_load_event();
0555 }
0556
0557 gEve->Redraw3D(kTRUE);
0558
0559 TGLViewer *viewer = gEve->GetDefaultGLViewer();
0560
0561 double data[4] = {1.0, 0.0, 0.0, 0.0};
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578 viewer->DoDraw();
0579
0580
0581
0582
0583
0584
0585 }
0586
0587
0588
0589