[369744d] | 1 | /*
|
---|
| 2 | * Delphes: a framework for fast simulation of a generic collider experiment
|
---|
| 3 | * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
|
---|
| 4 | *
|
---|
| 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 | *
|
---|
| 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 | *
|
---|
| 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 | */
|
---|
| 18 |
|
---|
[cfc3160] | 19 | #include <cassert>
|
---|
[84dd1c8] | 20 | #include <iostream>
|
---|
[cfc3160] | 21 | #include <utility>
|
---|
| 22 | #include <algorithm>
|
---|
| 23 | #include "TGeoManager.h"
|
---|
| 24 | #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 | #include "TEveElement.h"
|
---|
| 33 | #include "TEveJetCone.h"
|
---|
| 34 | #include "TEveTrack.h"
|
---|
| 35 | #include "TEveTrackPropagator.h"
|
---|
| 36 | #include "TEveCalo.h"
|
---|
| 37 | #include "TEveManager.h"
|
---|
| 38 | #include "TEveGeoNode.h"
|
---|
| 39 | #include "TEveTrans.h"
|
---|
| 40 | #include "TEveViewer.h"
|
---|
| 41 | #include "TEveBrowser.h"
|
---|
| 42 | #include "TEveArrow.h"
|
---|
| 43 | #include "TMath.h"
|
---|
| 44 | #include "TSystem.h"
|
---|
| 45 | #include "TRootBrowser.h"
|
---|
| 46 | #include "TGButton.h"
|
---|
[6301e02] | 47 | #include "TGTextEntry.h"
|
---|
| 48 | #include "TGProgressBar.h"
|
---|
| 49 | #include "TGNumberEntry.h"
|
---|
[2ca23b5] | 50 | #include "TRootEmbeddedCanvas.h"
|
---|
[cfc3160] | 51 | #include "TClonesArray.h"
|
---|
[8b04b31] | 52 | #include "TEveEventManager.h"
|
---|
[2ca23b5] | 53 | #include "TCanvas.h"
|
---|
| 54 | #include "TH1F.h"
|
---|
[cfc3160] | 55 |
|
---|
| 56 | DelphesEventDisplay::DelphesEventDisplay()
|
---|
| 57 | {
|
---|
[fafc433] | 58 | event_id_ = 0;
|
---|
[cfc3160] | 59 | tkRadius_ = 1.29;
|
---|
| 60 | totRadius_ = 2.0;
|
---|
| 61 | tkHalfLength_ = 3.0;
|
---|
[4fd37d4] | 62 | muHalfLength_ = 6.0;
|
---|
[cfc3160] | 63 | bz_ = 3.8;
|
---|
| 64 | chain_ = new TChain("Delphes");
|
---|
[fafc433] | 65 | treeReader_ = 0;
|
---|
| 66 | delphesDisplay_ = 0;
|
---|
[4fd37d4] | 67 | etaAxis_ = 0;
|
---|
| 68 | phiAxis_ = 0;
|
---|
[cfc3160] | 69 | }
|
---|
| 70 |
|
---|
| 71 | DelphesEventDisplay::~DelphesEventDisplay()
|
---|
| 72 | {
|
---|
| 73 | delete chain_;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | DelphesEventDisplay::DelphesEventDisplay(const char *configFile, const char *inputFile, Delphes3DGeometry& det3D)
|
---|
| 77 | {
|
---|
[fafc433] | 78 | event_id_ = 0;
|
---|
[cfc3160] | 79 | tkRadius_ = 1.29;
|
---|
| 80 | totRadius_ = 2.0;
|
---|
| 81 | tkHalfLength_ = 3.0;
|
---|
| 82 | bz_ = 3.8;
|
---|
| 83 | chain_ = new TChain("Delphes");
|
---|
[fafc433] | 84 | treeReader_ = 0;
|
---|
| 85 | delphesDisplay_ = 0;
|
---|
[cfc3160] | 86 |
|
---|
| 87 | // initialize the application
|
---|
| 88 | TEveManager::Create(kTRUE, "IV");
|
---|
[2ca23b5] | 89 | fStatusBar_ = gEve->GetBrowser()->GetStatusBar();
|
---|
[cfc3160] | 90 | TGeoManager* geom = gGeoManager;
|
---|
| 91 |
|
---|
| 92 | // build the detector
|
---|
| 93 | tkRadius_ = det3D.getTrackerRadius();
|
---|
| 94 | totRadius_ = det3D.getDetectorRadius();
|
---|
| 95 | tkHalfLength_ = det3D.getTrackerHalfLength();
|
---|
[4fd37d4] | 96 | muHalfLength_ = det3D.getDetectorHalfLength();
|
---|
[cfc3160] | 97 | bz_ = det3D.getBField();
|
---|
[4fd37d4] | 98 | etaAxis_ = det3D.getCaloAxes().first;
|
---|
| 99 | phiAxis_ = det3D.getCaloAxes().second;
|
---|
[cfc3160] | 100 | TGeoVolume* top = det3D.getDetector(false);
|
---|
| 101 | geom->SetTopVolume(top);
|
---|
| 102 | TEveElementList *geometry = new TEveElementList("Geometry");
|
---|
[30bb83a] | 103 | TObjArray* nodes = top->GetNodes();
|
---|
| 104 | TIter itNodes(nodes);
|
---|
| 105 | TGeoNode* nodeobj;
|
---|
| 106 | TEveGeoTopNode* node;
|
---|
| 107 | while((nodeobj = (TGeoNode*)itNodes.Next())) {
|
---|
| 108 | node = new TEveGeoTopNode(gGeoManager,nodeobj);
|
---|
| 109 | node->UseNodeTrans();
|
---|
| 110 | geometry->AddElement(node);
|
---|
| 111 | }
|
---|
[cfc3160] | 112 |
|
---|
| 113 | // Create chain of root trees
|
---|
| 114 | chain_->Add(inputFile);
|
---|
| 115 |
|
---|
| 116 | // Create object of class ExRootTreeReader
|
---|
[2ca23b5] | 117 | fStatusBar_->SetText("Opening Delphes data file", 1);
|
---|
[6301e02] | 118 | gSystem->ProcessEvents();
|
---|
[fafc433] | 119 | treeReader_ = new ExRootTreeReader(chain_);
|
---|
[cfc3160] | 120 |
|
---|
| 121 | // prepare data collections
|
---|
[4fd37d4] | 122 | readConfig(configFile, elements_);
|
---|
[fafc433] | 123 | for(std::vector<DelphesBranchBase*>::iterator element = elements_.begin(); element<elements_.end(); ++element) {
|
---|
[84dd1c8] | 124 | DelphesBranchElement<TEveTrackList>* item_v1 = dynamic_cast<DelphesBranchElement<TEveTrackList>*>(*element);
|
---|
[a3b2495] | 125 | DelphesBranchElement<TEveElementList>* item_v2 = dynamic_cast<DelphesBranchElement<TEveElementList>*>(*element);
|
---|
[84dd1c8] | 126 | if(item_v1) gEve->AddElement(item_v1->GetContainer());
|
---|
| 127 | if(item_v2) gEve->AddElement(item_v2->GetContainer());
|
---|
| 128 | }
|
---|
[cfc3160] | 129 |
|
---|
| 130 | // viewers and scenes
|
---|
[fafc433] | 131 | delphesDisplay_ = new DelphesDisplay;
|
---|
[cfc3160] | 132 | gEve->AddGlobalElement(geometry);
|
---|
[fafc433] | 133 | delphesDisplay_->ImportGeomRPhi(geometry);
|
---|
| 134 | delphesDisplay_->ImportGeomRhoZ(geometry);
|
---|
[cfc3160] | 135 | // find the first calo data and use that to initialize the calo display
|
---|
[fafc433] | 136 | for(std::vector<DelphesBranchBase*>::iterator data=elements_.begin();data<elements_.end();++data) {
|
---|
[4fd37d4] | 137 | if(TString((*data)->GetType())=="Tower") { // we could also use GetClassName()=="DelphesCaloData"
|
---|
[cfc3160] | 138 | DelphesCaloData* container = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>((*data))->GetContainer();
|
---|
| 139 | assert(container);
|
---|
| 140 | TEveCalo3D *calo3d = new TEveCalo3D(container);
|
---|
| 141 | calo3d->SetBarrelRadius(tkRadius_);
|
---|
| 142 | calo3d->SetEndCapPos(tkHalfLength_);
|
---|
| 143 | gEve->AddGlobalElement(calo3d);
|
---|
[fafc433] | 144 | delphesDisplay_->ImportCaloRPhi(calo3d);
|
---|
| 145 | delphesDisplay_->ImportCaloRhoZ(calo3d);
|
---|
[cfc3160] | 146 | TEveCaloLego *lego = new TEveCaloLego(container);
|
---|
| 147 | lego->InitMainTrans();
|
---|
| 148 | lego->RefMainTrans().SetScale(TMath::TwoPi(), TMath::TwoPi(), TMath::Pi());
|
---|
| 149 | lego->SetAutoRebin(kFALSE);
|
---|
| 150 | lego->Set2DMode(TEveCaloLego::kValSizeOutline);
|
---|
[fafc433] | 151 | delphesDisplay_->ImportCaloLego(lego);
|
---|
[cfc3160] | 152 | break;
|
---|
| 153 | }
|
---|
| 154 | }
|
---|
| 155 |
|
---|
[5fbcfe8] | 156 | // the GUI: control panel, summary tab
|
---|
[fafc433] | 157 | make_gui();
|
---|
[5fbcfe8] | 158 |
|
---|
| 159 | //ready...
|
---|
[2ca23b5] | 160 | fStatusBar_->SetText("Ready.", 1);
|
---|
[6301e02] | 161 | gSystem->ProcessEvents();
|
---|
[ad015db] | 162 | load_event();
|
---|
[cfc3160] | 163 | gEve->Redraw3D(kTRUE);
|
---|
| 164 |
|
---|
| 165 | }
|
---|
[30bb83a] | 166 |
|
---|
[cfc3160] | 167 | // function that parses the config to extract the branches of interest and prepare containers
|
---|
[4fd37d4] | 168 | void DelphesEventDisplay::readConfig(const char *configFile, std::vector<DelphesBranchBase*>& elements) {
|
---|
[cfc3160] | 169 | ExRootConfReader *confReader = new ExRootConfReader;
|
---|
| 170 | confReader->ReadFile(configFile);
|
---|
| 171 | ExRootConfParam branches = confReader->GetParam("TreeWriter::Branch");
|
---|
| 172 | Int_t nBranches = branches.GetSize()/3;
|
---|
| 173 | DelphesBranchElement<TEveTrackList>* tlist;
|
---|
| 174 | DelphesBranchElement<DelphesCaloData>* clist;
|
---|
| 175 | DelphesBranchElement<TEveElementList>* elist;
|
---|
[a3b2495] | 176 | // first loop with all but tracks
|
---|
[cfc3160] | 177 | for(Int_t b = 0; b<nBranches; ++b) {
|
---|
| 178 | TString input = branches[b*3].GetString();
|
---|
| 179 | TString name = branches[b*3+1].GetString();
|
---|
| 180 | TString className = branches[b*3+2].GetString();
|
---|
[a3b2495] | 181 | if(className=="Tower") {
|
---|
[cfc3160] | 182 | if(input.Contains("eflow",TString::kIgnoreCase) || name.Contains("eflow",TString::kIgnoreCase)) continue; //no eflow
|
---|
[4fd37d4] | 183 | clist = new DelphesBranchElement<DelphesCaloData>(name,treeReader_->UseBranch(name),kBlack);
|
---|
| 184 | clist->GetContainer()->SetEtaBins(etaAxis_);
|
---|
| 185 | clist->GetContainer()->SetPhiBins(phiAxis_);
|
---|
[cfc3160] | 186 | elements.push_back(clist);
|
---|
| 187 | } else if(className=="Jet") {
|
---|
| 188 | if(input.Contains("GenJetFinder")) {
|
---|
[4fd37d4] | 189 | elist = new DelphesBranchElement<TEveElementList>(name,treeReader_->UseBranch(name),kCyan);
|
---|
[cfc3160] | 190 | elist->GetContainer()->SetRnrSelf(false);
|
---|
| 191 | elist->GetContainer()->SetRnrChildren(false);
|
---|
[4fd37d4] | 192 | elist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_);
|
---|
[cfc3160] | 193 | elements.push_back(elist);
|
---|
| 194 | } else {
|
---|
[4fd37d4] | 195 | elist = new DelphesBranchElement<TEveElementList>(name,treeReader_->UseBranch(name),kYellow);
|
---|
| 196 | elist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_);
|
---|
| 197 | elements.push_back(elist);
|
---|
[cfc3160] | 198 | }
|
---|
| 199 | } else if(className=="Electron") {
|
---|
[4fd37d4] | 200 | tlist = new DelphesBranchElement<TEveTrackList>(name,treeReader_->UseBranch(name),kRed);
|
---|
| 201 | tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_);
|
---|
[cfc3160] | 202 | elements.push_back(tlist);
|
---|
| 203 | } else if(className=="Photon") {
|
---|
[4fd37d4] | 204 | tlist = new DelphesBranchElement<TEveTrackList>(name,treeReader_->UseBranch(name),kYellow);
|
---|
| 205 | tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_);
|
---|
[cfc3160] | 206 | elements.push_back(tlist);
|
---|
| 207 | } else if(className=="Muon") {
|
---|
[4fd37d4] | 208 | tlist = new DelphesBranchElement<TEveTrackList>(name,treeReader_->UseBranch(name),kGreen);
|
---|
| 209 | tlist->SetTrackingVolume(totRadius_, muHalfLength_, bz_);
|
---|
[cfc3160] | 210 | elements.push_back(tlist);
|
---|
| 211 | } else if(className=="MissingET") {
|
---|
[4fd37d4] | 212 | elist = new DelphesBranchElement<TEveElementList>(name,treeReader_->UseBranch(name),kViolet);
|
---|
| 213 | elist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_);
|
---|
| 214 | elements.push_back(elist);
|
---|
[cfc3160] | 215 | } else if(className=="GenParticle") {
|
---|
[4fd37d4] | 216 | tlist = new DelphesBranchElement<TEveTrackList>(name,treeReader_->UseBranch(name),kCyan);
|
---|
| 217 | tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_);
|
---|
[cfc3160] | 218 | tlist->GetContainer()->SetRnrSelf(false);
|
---|
| 219 | tlist->GetContainer()->SetRnrChildren(false);
|
---|
[4fd37d4] | 220 | elements.push_back(tlist);
|
---|
[a3b2495] | 221 | } else {
|
---|
| 222 | continue;
|
---|
[cfc3160] | 223 | }
|
---|
| 224 | }
|
---|
[a3b2495] | 225 | // second loop for tracks
|
---|
| 226 | for(Int_t b = 0; b<nBranches; ++b) {
|
---|
| 227 | TString input = branches[b*3].GetString();
|
---|
| 228 | TString name = branches[b*3+1].GetString();
|
---|
| 229 | TString className = branches[b*3+2].GetString();
|
---|
| 230 | if(className=="Track") {
|
---|
| 231 | if(input.Contains("eflow",TString::kIgnoreCase) || name.Contains("eflow",TString::kIgnoreCase)) continue; //no eflow
|
---|
[4fd37d4] | 232 | tlist = new DelphesBranchElement<TEveTrackList>(name,treeReader_->UseBranch(name),kBlue);
|
---|
| 233 | tlist->SetTrackingVolume(tkRadius_, tkHalfLength_, bz_);
|
---|
[a3b2495] | 234 | elements.push_back(tlist);
|
---|
| 235 | }
|
---|
| 236 | }
|
---|
[cfc3160] | 237 | }
|
---|
| 238 |
|
---|
| 239 | void DelphesEventDisplay::load_event()
|
---|
| 240 | {
|
---|
[fafc433] | 241 | // Load event specified in global event_id_.
|
---|
[cfc3160] | 242 | // The contents of previous event are removed.
|
---|
| 243 |
|
---|
[30bb83a] | 244 | // safety
|
---|
| 245 | if(event_id_ >= treeReader_->GetEntries() || event_id_<0 ) return;
|
---|
| 246 |
|
---|
[2ca23b5] | 247 | // message
|
---|
| 248 | fStatusBar_->SetText(Form("Loading event %d.", event_id_), 1);
|
---|
[6301e02] | 249 | gSystem->ProcessEvents();
|
---|
[cfc3160] | 250 |
|
---|
| 251 | // clear the previous event
|
---|
| 252 | gEve->GetViewers()->DeleteAnnotations();
|
---|
[fafc433] | 253 | for(std::vector<DelphesBranchBase*>::iterator data=elements_.begin();data<elements_.end();++data) {
|
---|
[cfc3160] | 254 | (*data)->Reset();
|
---|
| 255 | }
|
---|
| 256 |
|
---|
[30bb83a] | 257 | // Load selected branches with data from specified event
|
---|
| 258 | treeReader_->ReadEntry(event_id_);
|
---|
[4fd37d4] | 259 | for(std::vector<DelphesBranchBase*>::iterator data=elements_.begin();data<elements_.end();++data) {
|
---|
| 260 | (*data)->ReadBranch();
|
---|
[30bb83a] | 261 | }
|
---|
[cfc3160] | 262 |
|
---|
| 263 | // update display
|
---|
| 264 | TEveElement* top = (TEveElement*)gEve->GetCurrentEvent();
|
---|
[fafc433] | 265 | delphesDisplay_->DestroyEventRPhi();
|
---|
| 266 | delphesDisplay_->ImportEventRPhi(top);
|
---|
| 267 | delphesDisplay_->DestroyEventRhoZ();
|
---|
| 268 | delphesDisplay_->ImportEventRhoZ(top);
|
---|
[8b04b31] | 269 | update_html_summary();
|
---|
[ad015db] | 270 | plotSummary_->FillEvent();
|
---|
| 271 | plotSummary_->Draw();
|
---|
[cfc3160] | 272 |
|
---|
[30bb83a] | 273 | gEve->Redraw3D(kFALSE, kTRUE);
|
---|
[2ca23b5] | 274 | fStatusBar_->SetText(Form("Loaded event %d.", event_id_), 1);
|
---|
[6301e02] | 275 | gSystem->ProcessEvents();
|
---|
[cfc3160] | 276 | }
|
---|
| 277 |
|
---|
[8b04b31] | 278 | void DelphesEventDisplay::update_html_summary()
|
---|
| 279 | {
|
---|
| 280 | // Update summary of current event.
|
---|
| 281 |
|
---|
| 282 | TEveElement::List_i i;
|
---|
| 283 | TEveElement::List_i j;
|
---|
| 284 | Int_t k;
|
---|
| 285 | TEveElement *el;
|
---|
| 286 | DelphesHtmlObjTable *table;
|
---|
| 287 | TEveEventManager *mgr = gEve ? gEve->GetCurrentEvent() : 0;
|
---|
| 288 | if (mgr) {
|
---|
| 289 | htmlSummary_->Clear("D");
|
---|
| 290 | for (i=mgr->BeginChildren(); i!=mgr->EndChildren(); ++i) {
|
---|
| 291 | el = ((TEveElement*)(*i));
|
---|
| 292 | if (el->IsA() == TEvePointSet::Class()) {
|
---|
| 293 | TEvePointSet *ps = (TEvePointSet *)el;
|
---|
| 294 | TString ename = ps->GetElementName();
|
---|
| 295 | TString etitle = ps->GetElementTitle();
|
---|
| 296 | if (ename.First('\'') != kNPOS)
|
---|
| 297 | ename.Remove(ename.First('\''));
|
---|
| 298 | etitle.Remove(0, 2);
|
---|
| 299 | Int_t nel = atoi(etitle.Data());
|
---|
| 300 | table = htmlSummary_->AddTable(ename, 0, nel);
|
---|
| 301 | }
|
---|
| 302 | else if (el->IsA() == TEveTrackList::Class()) {
|
---|
| 303 | TEveTrackList *tracks = (TEveTrackList *)el;
|
---|
| 304 | TString ename = tracks->GetElementName();
|
---|
| 305 | if (ename.First('\'') != kNPOS)
|
---|
| 306 | ename.Remove(ename.First('\''));
|
---|
| 307 | table = htmlSummary_->AddTable(ename.Data(), 5,
|
---|
| 308 | tracks->NumChildren(), kTRUE, "first");
|
---|
| 309 | table->SetLabel(0, "Momentum");
|
---|
| 310 | table->SetLabel(1, "P_t");
|
---|
| 311 | table->SetLabel(2, "Phi");
|
---|
| 312 | table->SetLabel(3, "Theta");
|
---|
| 313 | table->SetLabel(4, "Eta");
|
---|
| 314 | k=0;
|
---|
| 315 | for (j=tracks->BeginChildren(); j!=tracks->EndChildren(); ++j) {
|
---|
| 316 | Float_t p = ((TEveTrack*)(*j))->GetMomentum().Mag();
|
---|
| 317 | table->SetValue(0, k, p);
|
---|
| 318 | Float_t pt = ((TEveTrack*)(*j))->GetMomentum().Perp();
|
---|
| 319 | table->SetValue(1, k, pt);
|
---|
| 320 | Float_t phi = ((TEveTrack*)(*j))->GetMomentum().Phi();
|
---|
| 321 | table->SetValue(2, k, phi);
|
---|
| 322 | Float_t theta = ((TEveTrack*)(*j))->GetMomentum().Theta();
|
---|
| 323 | table->SetValue(3, k, theta);
|
---|
| 324 | Float_t eta = theta>0.0005 && theta<3.1413 ? ((TEveTrack*)(*j))->GetMomentum().Eta() : 1e10;
|
---|
| 325 | table->SetValue(4, k, eta);
|
---|
| 326 | ++k;
|
---|
| 327 | }
|
---|
| 328 | }
|
---|
| 329 | }
|
---|
| 330 | htmlSummary_->Build();
|
---|
| 331 | gHtml_->Clear();
|
---|
| 332 | gHtml_->ParseText((char*)htmlSummary_->Html().Data());
|
---|
| 333 | gHtml_->Layout();
|
---|
| 334 | }
|
---|
| 335 |
|
---|
| 336 | }
|
---|
| 337 |
|
---|
[cfc3160] | 338 | /******************************************************************************/
|
---|
| 339 | // GUI
|
---|
| 340 | /******************************************************************************/
|
---|
| 341 |
|
---|
| 342 | void DelphesEventDisplay::make_gui()
|
---|
| 343 | {
|
---|
| 344 | // Create minimal GUI for event navigation.
|
---|
| 345 |
|
---|
| 346 | // add a tab on the left
|
---|
| 347 | TEveBrowser* browser = gEve->GetBrowser();
|
---|
[6301e02] | 348 | browser->SetWindowName("Delphes Event Display");
|
---|
[cfc3160] | 349 | browser->StartEmbedding(TRootBrowser::kLeft);
|
---|
| 350 |
|
---|
| 351 | // set the main title
|
---|
| 352 | TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
|
---|
| 353 | frmMain->SetWindowName("Delphes Event Display");
|
---|
| 354 | frmMain->SetCleanup(kDeepCleanup);
|
---|
| 355 |
|
---|
| 356 | // build the navigation menu
|
---|
[6301e02] | 357 | TString icondir;
|
---|
| 358 | if(gSystem->Getenv("ROOTSYS"))
|
---|
| 359 | icondir = Form("%s/icons/", gSystem->Getenv("ROOTSYS"));
|
---|
| 360 | if(!gSystem->OpenDirectory(icondir))
|
---|
| 361 | icondir = Form("%s/icons/", (const char*)gSystem->GetFromPipe("root-config --etcdir") );
|
---|
| 362 | TGGroupFrame* vf = new TGGroupFrame(frmMain,"Event navigation",kVerticalFrame | kFitWidth );
|
---|
[cfc3160] | 363 | {
|
---|
[6301e02] | 364 | TGHorizontalFrame* hf = new TGHorizontalFrame(frmMain);
|
---|
| 365 | {
|
---|
| 366 | TGPictureButton* b = 0;
|
---|
| 367 |
|
---|
| 368 | b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoBack.gif"));
|
---|
| 369 | hf->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 10, 2, 10, 10));
|
---|
| 370 | b->Connect("Clicked()", "DelphesEventDisplay", this, "Bck()");
|
---|
| 371 |
|
---|
| 372 | numberEntry_ = new TGNumberEntry(hf,0,9,-1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, treeReader_->GetEntries());
|
---|
| 373 | hf->AddFrame(numberEntry_, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 2, 0, 10, 10));
|
---|
| 374 | numberEntry_->Connect("ValueSet(Long_t)", "DelphesEventDisplay", this, "GoTo(Long_t)");
|
---|
| 375 |
|
---|
| 376 | b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoForward.gif"));
|
---|
| 377 | hf->AddFrame(b, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 2, 10, 10, 10));
|
---|
| 378 | b->Connect("Clicked()", "DelphesEventDisplay", this, "Fwd()");
|
---|
| 379 |
|
---|
| 380 | }
|
---|
| 381 | vf->AddFrame(hf, new TGLayoutHints(kLHintsExpandX , 2, 2, 2, 2));
|
---|
| 382 |
|
---|
| 383 | progress_ = new TGHProgressBar(frmMain, TGProgressBar::kFancy, 100);
|
---|
| 384 | progress_->SetMax( treeReader_->GetEntries());
|
---|
| 385 | progress_->ShowPosition(kTRUE, kFALSE, "Event %.0f");
|
---|
| 386 | progress_->SetBarColor("green");
|
---|
| 387 | vf->AddFrame(progress_, new TGLayoutHints(kLHintsExpandX, 10, 10, 5, 5));
|
---|
[cfc3160] | 388 | }
|
---|
[6301e02] | 389 | frmMain->AddFrame(vf, new TGLayoutHints(kLHintsExpandX , 5, 5, 5, 5));
|
---|
| 390 | vf = new TGGroupFrame(frmMain,"Batch operations",kVerticalFrame | kFitWidth );
|
---|
| 391 | {
|
---|
| 392 | TGTextButton *b = new TGTextButton(vf, "Initialize Summary Plots");
|
---|
| 393 | vf->AddFrame(b, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY | kLHintsExpandX, 10, 10, 10, 10));
|
---|
| 394 | b->Connect("Clicked()", "DelphesEventDisplay", this, "InitSummaryPlots()");
|
---|
| 395 | }
|
---|
| 396 | frmMain->AddFrame(vf, new TGLayoutHints(kLHintsExpandX , 5, 5, 5, 5));
|
---|
| 397 |
|
---|
[cfc3160] | 398 | frmMain->MapSubwindows();
|
---|
| 399 | frmMain->Resize();
|
---|
| 400 | frmMain->MapWindow();
|
---|
| 401 | browser->StopEmbedding();
|
---|
| 402 | browser->SetTabTitle("Event Control", 0);
|
---|
[5fbcfe8] | 403 |
|
---|
| 404 | // the summary tab
|
---|
| 405 | htmlSummary_ = new DelphesHtmlSummary("Delphes Event Display Summary Table");
|
---|
| 406 | TEveWindowSlot* slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
|
---|
| 407 | gHtml_ = new TGHtml(0, 100, 100);
|
---|
| 408 | TEveWindowFrame *wf = slot->MakeFrame(gHtml_);
|
---|
| 409 | gHtml_->MapSubwindows();
|
---|
[2ca23b5] | 410 | wf->SetElementName("Summary tables");
|
---|
| 411 |
|
---|
| 412 | // plot tab
|
---|
| 413 | slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
|
---|
| 414 | TEveWindowTab* tab = slot->MakeTab();
|
---|
| 415 | tab->SetElementName("Summary plots");
|
---|
| 416 | tab->SetShowTitleBar(kFALSE);
|
---|
| 417 | plotSummary_ = new DelphesPlotSummary(tab);
|
---|
| 418 | plotSummary_->Init(elements_);
|
---|
[cfc3160] | 419 | }
|
---|
| 420 |
|
---|