Changeset f53a4d2 in git for display/DelphesEventDisplay.cc
- Timestamp:
- Jun 26, 2015, 11:17:38 AM (9 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 28027d5, d38348d
- Parents:
- c9803f7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
display/DelphesEventDisplay.cc
rc9803f7 rf53a4d2 1 1 /* 2 *Delphes: a framework for fast simulation of a generic collider experiment3 *Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium2 * Delphes: a framework for fast simulation of a generic collider experiment 3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium 4 4 * 5 *This program is free software: you can redistribute it and/or modify6 *it under the terms of the GNU General Public License as published by7 *the Free Software Foundation, either version 3 of the License, or8 *(at your option) any later version.5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 9 * 10 *This program is distributed in the hope that it will be useful,11 *but WITHOUT ANY WARRANTY; without even the implied warranty of12 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 *GNU General Public License for more details.10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 14 * 15 *You should have received a copy of the GNU General Public License16 *along with this program. If not, see <http://www.gnu.org/licenses/>.15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 18 … … 21 21 #include <utility> 22 22 #include <algorithm> 23 23 24 #include "TGeoManager.h" 24 25 #include "TGeoVolume.h" 25 #include "external/ExRootAnalysis/ExRootConfReader.h"26 #include "external/ExRootAnalysis/ExRootTreeReader.h"27 #include "display/DelphesCaloData.h"28 #include "display/DelphesBranchElement.h"29 #include "display/Delphes3DGeometry.h"30 #include "display/DelphesEventDisplay.h"31 #include "classes/DelphesClasses.h"32 26 #include "TEveElement.h" 33 27 #include "TEveJetCone.h" … … 53 47 #include "TCanvas.h" 54 48 #include "TH1F.h" 49 #include "TAxis.h" 50 #include "TChain.h" 51 #include "TGHtml.h" 52 #include "TGStatusBar.h" 53 54 #include "display/DelphesCaloData.h" 55 #include "display/DelphesBranchElement.h" 56 #include "display/Delphes3DGeometry.h" 57 #include "display/DelphesEventDisplay.h" 58 #include "display/DelphesDisplay.h" 59 #include "display/Delphes3DGeometry.h" 60 #include "display/DelphesHtmlSummary.h" 61 #include "display/DelphesPlotSummary.h" 62 63 #include "classes/DelphesClasses.h" 64 #include "external/ExRootAnalysis/ExRootConfReader.h" 65 #include "external/ExRootAnalysis/ExRootTreeReader.h" 55 66 56 67 DelphesEventDisplay::DelphesEventDisplay() … … 98 109 TEveManager::Create(kTRUE, "IV"); 99 110 fStatusBar_ = gEve->GetBrowser()->GetStatusBar(); 100 TGeoManager *geom = gGeoManager;111 TGeoManager *geom = gGeoManager; 101 112 102 113 // build the detector … … 108 119 etaAxis_ = det3D.getCaloAxes().first; 109 120 phiAxis_ = det3D.getCaloAxes().second; 110 TGeoVolume *top = det3D.getDetector(false);121 TGeoVolume *top = det3D.getDetector(false); 111 122 geom->SetTopVolume(top); 112 123 TEveElementList *geometry = new TEveElementList("Geometry"); 113 TObjArray *nodes = top->GetNodes();124 TObjArray *nodes = top->GetNodes(); 114 125 TIter itNodes(nodes); 115 TGeoNode *nodeobj;116 TEveGeoTopNode *node;126 TGeoNode *nodeobj; 127 TEveGeoTopNode *node; 117 128 while((nodeobj = (TGeoNode*)itNodes.Next())) { 118 129 node = new TEveGeoTopNode(gGeoManager,nodeobj); … … 131 142 // prepare data collections 132 143 readConfig(configFile, elements_); 133 for(std::vector<DelphesBranchBase *>::iterator element = elements_.begin(); element<elements_.end(); ++element) {134 DelphesBranchElement<TEveTrackList> *item_v1 = dynamic_cast<DelphesBranchElement<TEveTrackList>*>(*element);135 DelphesBranchElement<TEveElementList> *item_v2 = dynamic_cast<DelphesBranchElement<TEveElementList>*>(*element);144 for(std::vector<DelphesBranchBase *>::iterator element = elements_.begin(); element<elements_.end(); ++element) { 145 DelphesBranchElement<TEveTrackList> *item_v1 = dynamic_cast<DelphesBranchElement<TEveTrackList>*>(*element); 146 DelphesBranchElement<TEveElementList> *item_v2 = dynamic_cast<DelphesBranchElement<TEveElementList>*>(*element); 136 147 if(item_v1) gEve->AddElement(item_v1->GetContainer()); 137 148 if(item_v2) gEve->AddElement(item_v2->GetContainer()); … … 144 155 delphesDisplay_->ImportGeomRhoZ(geometry); 145 156 // find the first calo data and use that to initialize the calo display 146 for(std::vector<DelphesBranchBase *>::iterator data=elements_.begin();data<elements_.end();++data) {157 for(std::vector<DelphesBranchBase *>::iterator data=elements_.begin();data<elements_.end();++data) { 147 158 if(TString((*data)->GetType())=="Tower") { // we could also use GetClassName()=="DelphesCaloData" 148 DelphesCaloData *container = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>((*data))->GetContainer();159 DelphesCaloData *container = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>((*data))->GetContainer(); 149 160 assert(container); 150 161 TEveCalo3D *calo3d = new TEveCalo3D(container); … … 182 193 ExRootConfParam branches = confReader->GetParam("TreeWriter::Branch"); 183 194 Int_t nBranches = branches.GetSize()/3; 184 DelphesBranchElement<TEveTrackList> *tlist;185 DelphesBranchElement<DelphesCaloData> *clist;186 DelphesBranchElement<TEveElementList> *elist;195 DelphesBranchElement<TEveTrackList> *tlist; 196 DelphesBranchElement<DelphesCaloData> *clist; 197 DelphesBranchElement<TEveElementList> *elist; 187 198 // first loop with all but tracks 188 199 for(Int_t b = 0; b<nBranches; ++b) { … … 273 284 274 285 // update display 275 TEveElement *top = (TEveElement*)gEve->GetCurrentEvent();286 TEveElement *top = (TEveElement*)gEve->GetCurrentEvent(); 276 287 delphesDisplay_->DestroyEventRPhi(); 277 288 delphesDisplay_->ImportEventRPhi(top); … … 356 367 357 368 // add a tab on the left 358 TEveBrowser *browser = gEve->GetBrowser();369 TEveBrowser *browser = gEve->GetBrowser(); 359 370 browser->SetWindowName("Delphes Event Display"); 360 371 browser->StartEmbedding(TRootBrowser::kLeft); 361 372 362 373 // set the main title 363 TGMainFrame *frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);374 TGMainFrame *frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600); 364 375 frmMain->SetWindowName("Delphes Event Display"); 365 376 frmMain->SetCleanup(kDeepCleanup); … … 371 382 if(!gSystem->OpenDirectory(icondir)) 372 383 icondir = Form("%s/icons/", (const char*)gSystem->GetFromPipe("root-config --etcdir") ); 373 TGGroupFrame *vf = new TGGroupFrame(frmMain,"Event navigation",kVerticalFrame | kFitWidth );384 TGGroupFrame *vf = new TGGroupFrame(frmMain,"Event navigation",kVerticalFrame | kFitWidth ); 374 385 { 375 TGHorizontalFrame *hf = new TGHorizontalFrame(frmMain);386 TGHorizontalFrame *hf = new TGHorizontalFrame(frmMain); 376 387 { 377 TGPictureButton *b = 0;388 TGPictureButton *b = 0; 378 389 379 390 b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoBack.gif")); … … 381 392 b->Connect("Clicked()", "DelphesEventDisplay", this, "Bck()"); 382 393 383 TGNumberEntry *numberEntry = new TGNumberEntry(hf,0,9,-1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, treeReader_->GetEntries());394 TGNumberEntry *numberEntry = new TGNumberEntry(hf,0,9,-1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, treeReader_->GetEntries()); 384 395 hf->AddFrame(numberEntry, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 2, 0, 10, 10)); 385 396 this->Connect("EventChanged(Int_t)","TGNumberEntry",numberEntry,"SetIntNumber(Long_t)"); … … 394 405 vf->AddFrame(hf, new TGLayoutHints(kLHintsExpandX , 2, 2, 2, 2)); 395 406 396 TGHProgressBar *progress = new TGHProgressBar(frmMain, TGProgressBar::kFancy, 100);407 TGHProgressBar *progress = new TGHProgressBar(frmMain, TGProgressBar::kFancy, 100); 397 408 progress->SetMax( treeReader_->GetEntries()); 398 409 progress->ShowPosition(kTRUE, kFALSE, "Event %.0f"); … … 418 429 // the summary tab 419 430 htmlSummary_ = new DelphesHtmlSummary("Delphes Event Display Summary Table"); 420 TEveWindowSlot *slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());431 TEveWindowSlot *slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight()); 421 432 gHtml_ = new TGHtml(0, 100, 100); 422 433 TEveWindowFrame *wf = slot->MakeFrame(gHtml_); … … 426 437 // plot tab 427 438 slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight()); 428 TEveWindowTab *tab = slot->MakeTab();439 TEveWindowTab *tab = slot->MakeTab(); 429 440 tab->SetElementName("Summary plots"); 430 441 tab->SetShowTitleBar(kFALSE); … … 435 446 } 436 447 437 448 void DelphesEventDisplay::Fwd() { 449 if (event_id_ < treeReader_->GetEntries() - 2) { 450 EventChanged(event_id_+1); 451 } else { 452 printf("Already at last event.\n"); 453 } 454 } 455 456 void DelphesEventDisplay::Bck() { 457 if (event_id_ > 0) { 458 EventChanged(event_id_-1); 459 } else { 460 printf("Already at first event.\n"); 461 } 462 } 463 464 void DelphesEventDisplay::PreSetEv(char *ev) { 465 event_id_tmp_ = Int_t(atoi(ev)); 466 } 467 468 void DelphesEventDisplay::GoTo() { 469 if (event_id_tmp_>=0 && event_id_tmp_ < treeReader_->GetEntries()-1) { 470 EventChanged(event_id_tmp_); 471 } else { 472 printf("Error: no such event.\n"); 473 } 474 } 475 476 void DelphesEventDisplay::InitSummaryPlots() { 477 plotSummary_->FillSample(treeReader_, event_id_); 478 plotSummary_->FillEvent(); 479 plotSummary_->Draw(); 480 } 481 482 void DelphesEventDisplay::DisplayProgress(Int_t p) { 483 fStatusBar_->SetText(Form("Processing... %d %%",p), 1); 484 gSystem->ProcessEvents(); 485 }
Note:
See TracChangeset
for help on using the changeset viewer.