Changeset fafc433 in git for display/DelphesEventDisplay.cc
- Timestamp:
- Oct 16, 2014, 2:19:17 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 30bb83a
- Parents:
- a3b2495
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
display/DelphesEventDisplay.cc
ra3b2495 rfafc433 31 31 DelphesEventDisplay::DelphesEventDisplay() 32 32 { 33 event_id = 0;33 event_id_ = 0; 34 34 tkRadius_ = 1.29; 35 35 totRadius_ = 2.0; … … 37 37 bz_ = 3.8; 38 38 chain_ = new TChain("Delphes"); 39 gTreeReader= 0;40 gDelphesDisplay= 0;39 treeReader_ = 0; 40 delphesDisplay_ = 0; 41 41 } 42 42 … … 48 48 DelphesEventDisplay::DelphesEventDisplay(const char *configFile, const char *inputFile, Delphes3DGeometry& det3D) 49 49 { 50 event_id = 0;50 event_id_ = 0; 51 51 tkRadius_ = 1.29; 52 52 totRadius_ = 2.0; … … 54 54 bz_ = 3.8; 55 55 chain_ = new TChain("Delphes"); 56 gTreeReader= 0;57 gDelphesDisplay= 0;56 treeReader_ = 0; 57 delphesDisplay_ = 0; 58 58 59 59 // initialize the application … … 103 103 // Create object of class ExRootTreeReader 104 104 printf("*** Opening Delphes data file ***\n"); 105 gTreeReader= new ExRootTreeReader(chain_);105 treeReader_ = new ExRootTreeReader(chain_); 106 106 107 107 // prepare data collections 108 readConfig(configFile, det3D, gElements, gArrays);109 for(std::vector<DelphesBranchBase*>::iterator element = gElements.begin(); element<gElements.end(); ++element) {108 readConfig(configFile, det3D, elements_, arrays_); 109 for(std::vector<DelphesBranchBase*>::iterator element = elements_.begin(); element<elements_.end(); ++element) { 110 110 DelphesBranchElement<TEveTrackList>* item_v1 = dynamic_cast<DelphesBranchElement<TEveTrackList>*>(*element); 111 111 DelphesBranchElement<TEveElementList>* item_v2 = dynamic_cast<DelphesBranchElement<TEveElementList>*>(*element); … … 115 115 116 116 // viewers and scenes 117 gDelphesDisplay= new DelphesDisplay;117 delphesDisplay_ = new DelphesDisplay; 118 118 gEve->AddGlobalElement(geometry); 119 gDelphesDisplay->ImportGeomRPhi(geometry);120 gDelphesDisplay->ImportGeomRhoZ(geometry);119 delphesDisplay_->ImportGeomRPhi(geometry); 120 delphesDisplay_->ImportGeomRhoZ(geometry); 121 121 // find the first calo data and use that to initialize the calo display 122 for(std::vector<DelphesBranchBase*>::iterator data= gElements.begin();data<gElements.end();++data) {122 for(std::vector<DelphesBranchBase*>::iterator data=elements_.begin();data<elements_.end();++data) { 123 123 if(TString((*data)->GetType())=="tower") { // we could also use GetClassName()=="DelphesCaloData" 124 124 DelphesCaloData* container = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>((*data))->GetContainer(); … … 128 128 calo3d->SetEndCapPos(tkHalfLength_); 129 129 gEve->AddGlobalElement(calo3d); 130 gDelphesDisplay->ImportCaloRPhi(calo3d);131 gDelphesDisplay->ImportCaloRhoZ(calo3d);130 delphesDisplay_->ImportCaloRPhi(calo3d); 131 delphesDisplay_->ImportCaloRhoZ(calo3d); 132 132 TEveCaloLego *lego = new TEveCaloLego(container); 133 133 lego->InitMainTrans(); … … 135 135 lego->SetAutoRebin(kFALSE); 136 136 lego->Set2DMode(TEveCaloLego::kValSizeOutline); 137 gDelphesDisplay->ImportCaloLego(lego);137 delphesDisplay_->ImportCaloLego(lego); 138 138 break; 139 139 } 140 140 } 141 141 142 //make_gui(); //TODO put back!143 //load_event(); //TODO put back!142 make_gui(); 143 load_event(); 144 144 gEve->Redraw3D(kTRUE); 145 145 … … 217 217 } 218 218 //TODO one possible simplification could be to add the array to the element class. 219 arrays.push_back( gTreeReader->UseBranch(name));219 arrays.push_back(treeReader_->UseBranch(name)); 220 220 } 221 221 // second loop for tracks … … 232 232 trkProp->SetMaxR(tk_radius); 233 233 trkProp->SetMaxZ(tk_length); 234 arrays.push_back( gTreeReader->UseBranch(name));234 arrays.push_back(treeReader_->UseBranch(name)); 235 235 } 236 236 } … … 241 241 void DelphesEventDisplay::load_event() 242 242 { 243 // Load event specified in global event_id .243 // Load event specified in global event_id_. 244 244 // The contents of previous event are removed. 245 245 246 246 //TODO move this to the status bar ??? 247 printf("Loading event %d.\n", event_id );247 printf("Loading event %d.\n", event_id_); 248 248 249 249 250 250 // clear the previous event 251 251 gEve->GetViewers()->DeleteAnnotations(); 252 for(std::vector<DelphesBranchBase*>::iterator data= gElements.begin();data<gElements.end();++data) {252 for(std::vector<DelphesBranchBase*>::iterator data=elements_.begin();data<elements_.end();++data) { 253 253 (*data)->Reset(); 254 254 } … … 259 259 // update display 260 260 TEveElement* top = (TEveElement*)gEve->GetCurrentEvent(); 261 gDelphesDisplay->DestroyEventRPhi();262 gDelphesDisplay->ImportEventRPhi(top);263 gDelphesDisplay->DestroyEventRhoZ();264 gDelphesDisplay->ImportEventRhoZ(top);261 delphesDisplay_->DestroyEventRPhi(); 262 delphesDisplay_->ImportEventRPhi(top); 263 delphesDisplay_->DestroyEventRhoZ(); 264 delphesDisplay_->ImportEventRhoZ(top); 265 265 //update_html_summary(); 266 266 gEve->Redraw3D(kFALSE, kTRUE); … … 271 271 272 272 // safety 273 if(event_id >= gTreeReader->GetEntries() || event_id<0 ) return;273 if(event_id_ >= treeReader_->GetEntries() || event_id_<0 ) return; 274 274 275 275 // Load selected branches with data from specified event 276 gTreeReader->ReadEntry(event_id);276 treeReader_->ReadEntry(event_id_); 277 277 278 278 // loop over selected branches, and apply the proper recipe to fill the collections. 279 // this is basically to loop on gArrays to fill gElements.279 // this is basically to loop on arrays_ to fill elements_. 280 280 281 281 //TODO: one option would be to have templated methods in the element classes. We could simply call "element.fill()" 282 std::vector<TClonesArray*>::iterator data = gArrays.begin();283 std::vector<DelphesBranchBase*>::iterator element = gElements.begin();284 for(; data< gArrays.end() && element<gElements.end(); ++data, ++element) {282 std::vector<TClonesArray*>::iterator data = arrays_.begin(); 283 std::vector<DelphesBranchBase*>::iterator element = elements_.begin(); 284 for(; data<arrays_.end() && element<elements_.end(); ++data, ++element) { 285 285 TString type = (*element)->GetType(); 286 286 // branch on the element type … … 474 474 icondir = Form("%s/icons/", (const char*)gSystem->GetFromPipe("root-config --etcdir") ); 475 475 TGPictureButton* b = 0; 476 EvNavHandler *fh = new EvNavHandler(this);477 476 478 477 b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoBack.gif")); 479 478 hf->AddFrame(b); 480 b->Connect("Clicked()", " EvNavHandler", fh, "Bck()");479 b->Connect("Clicked()", "DelphesEventDisplay", this, "Bck()"); 481 480 482 481 b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoForward.gif")); 483 482 hf->AddFrame(b); 484 b->Connect("Clicked()", " EvNavHandler", fh, "Fwd()");483 b->Connect("Clicked()", "DelphesEventDisplay", this, "Fwd()"); 485 484 } 486 485 frmMain->AddFrame(hf);
Note:
See TracChangeset
for help on using the changeset viewer.