Changeset 30bb83a in git
- Timestamp:
- Oct 16, 2014, 10:11:54 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 369744d
- Parents:
- fafc433
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
display/DelphesBranchElement.cc
rfafc433 r30bb83a 43 43 template<> void DelphesBranchElement<TEveElementList>::Reset() { data_->DestroyElements(); } 44 44 45 //TODO: does the type really make sense?46 45 // special case for track lists 47 46 template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color):DelphesBranchBase(name, type, color) { 48 if(TString(type)=="track") {49 47 data_ = new TEveTrackList(name); 50 48 data_->SetMainColor(color_); … … 52 50 data_->SetMarkerStyle(kCircle); 53 51 data_->SetMarkerSize(0.5); 54 } else if(TString(type)=="photon") {55 data_ = new TEveTrackList(name);56 data_->SetMainColor(color_);57 data_->SetMarkerColor(color_);58 data_->SetMarkerStyle(kCircle);59 data_->SetMarkerSize(0.5);60 } else {61 data_ = new TEveTrackList(name);62 data_->SetMainColor(color_);63 data_->SetMarkerColor(color_);64 data_->SetMarkerStyle(kCircle);65 data_->SetMarkerSize(0.5);66 //throw std::exception();67 }68 52 } 69 53 template<> void DelphesBranchElement<TEveTrackList>::Reset() { data_->DestroyElements(); } -
display/DelphesEventDisplay.cc
rfafc433 r30bb83a 66 66 tkHalfLength_ = det3D.getTrackerHalfLength(); 67 67 bz_ = det3D.getBField(); 68 69 //TODO specific to some classical detector... could use better the det3D70 68 TGeoVolume* top = det3D.getDetector(false); 71 69 geom->SetTopVolume(top); 72 70 TEveElementList *geometry = new TEveElementList("Geometry"); 73 TEveGeoTopNode* trk = new TEveGeoTopNode(gGeoManager, top->FindNode("tracker_1")); 74 trk->SetVisLevel(6); 75 geometry->AddElement(trk); 76 TEveGeoTopNode* calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_barrel_1")); 77 calo->SetVisLevel(3); 78 geometry->AddElement(calo); 79 calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_endcap_1")); 80 calo->SetVisLevel(3); 81 calo->UseNodeTrans(); 82 geometry->AddElement(calo); 83 calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_endcap_2")); 84 calo->SetVisLevel(3); 85 calo->UseNodeTrans(); 86 geometry->AddElement(calo); 87 TEveGeoTopNode* muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_barrel_1")); 88 muon->SetVisLevel(4); 89 geometry->AddElement(muon); 90 muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_endcap_1")); 91 muon->SetVisLevel(4); 92 muon->UseNodeTrans(); 93 geometry->AddElement(muon); 94 muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_endcap_2")); 95 muon->SetVisLevel(4); 96 muon->UseNodeTrans(); 97 geometry->AddElement(muon); 98 //gGeoManager->DefaultColors(); 71 TObjArray* nodes = top->GetNodes(); 72 TIter itNodes(nodes); 73 TGeoNode* nodeobj; 74 TEveGeoTopNode* node; 75 while((nodeobj = (TGeoNode*)itNodes.Next())) { 76 node = new TEveGeoTopNode(gGeoManager,nodeobj); 77 node->UseNodeTrans(); 78 geometry->AddElement(node); 79 } 99 80 100 81 // Create chain of root trees … … 145 126 146 127 } 128 147 129 // function that parses the config to extract the branches of interest and prepare containers 148 130 void DelphesEventDisplay::readConfig(const char *configFile, Delphes3DGeometry& det3D, std::vector<DelphesBranchBase*>& elements, std::vector<TClonesArray*>& arrays) { … … 216 198 continue; 217 199 } 218 //TODO one possible simplification could be to add the array to the element class.219 200 arrays.push_back(treeReader_->UseBranch(name)); 220 201 } … … 237 218 } 238 219 239 240 //______________________________________________________________________________241 220 void DelphesEventDisplay::load_event() 242 221 { … … 244 223 // The contents of previous event are removed. 245 224 225 // safety 226 if(event_id_ >= treeReader_->GetEntries() || event_id_<0 ) return; 227 246 228 //TODO move this to the status bar ??? 247 229 printf("Loading event %d.\n", event_id_); 248 249 230 250 231 // clear the previous event … … 254 235 } 255 236 256 // read the new event 257 delphes_read(); 237 // Load selected branches with data from specified event 238 treeReader_->ReadEntry(event_id_); 239 240 // loop over selected branches, and apply the proper recipe to fill the collections. 241 // this is basically to loop on arrays_ to fill elements_. 242 std::vector<TClonesArray*>::iterator data = arrays_.begin(); 243 std::vector<DelphesBranchBase*>::iterator element = elements_.begin(); 244 for(; data<arrays_.end() && element<elements_.end(); ++data, ++element) { 245 TString type = (*element)->GetType(); 246 // branch on the element type 247 if(type=="tower") delphes_read_towers(*data,*element); 248 else if(type=="track" || type=="photon" || type=="electron" || type=="muon" || type=="genparticle") delphes_read_tracks(*data,*element); 249 else if(type=="jet") delphes_read_jets(*data,*element); 250 else if(type=="vector") delphes_read_vectors(*data,*element); 251 } 258 252 259 253 // update display … … 264 258 delphesDisplay_->ImportEventRhoZ(top); 265 259 //update_html_summary(); 260 266 261 gEve->Redraw3D(kFALSE, kTRUE); 267 }268 269 void DelphesEventDisplay::delphes_read()270 {271 272 // safety273 if(event_id_ >= treeReader_->GetEntries() || event_id_<0 ) return;274 275 // Load selected branches with data from specified event276 treeReader_->ReadEntry(event_id_);277 278 // loop over selected branches, and apply the proper recipe to fill the collections.279 // this is basically to loop on arrays_ to fill elements_.280 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 = arrays_.begin();283 std::vector<DelphesBranchBase*>::iterator element = elements_.begin();284 for(; data<arrays_.end() && element<elements_.end(); ++data, ++element) {285 TString type = (*element)->GetType();286 // branch on the element type287 if(type=="tower") delphes_read_towers(*data,*element);288 else if(type=="track" || type=="photon" || type=="electron" || type=="muon" || type=="genparticle") delphes_read_tracks(*data,*element);289 else if(type=="jet") delphes_read_jets(*data,*element);290 else if(type=="vector") delphes_read_vectors(*data,*element);291 }292 262 } 293 263 -
display/DelphesEventDisplay.h
rfafc433 r30bb83a 45 45 void make_gui(); 46 46 void load_event(); 47 void delphes_read();48 47 void delphes_read_towers(TClonesArray* data, DelphesBranchBase* element); 49 48 void delphes_read_tracks(TClonesArray* data, DelphesBranchBase* element);
Note:
See TracChangeset
for help on using the changeset viewer.