Changeset a3b2495 in git
- Timestamp:
- Oct 16, 2014, 10:52:47 AM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- fafc433
- Parents:
- 84dd1c8
- Location:
- display
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
display/DelphesBranchElement.cc
r84dd1c8 ra3b2495 43 43 template<> void DelphesBranchElement<TEveElementList>::Reset() { data_->DestroyElements(); } 44 44 45 //TODO: does the type really make sense? 45 46 // special case for track lists 46 47 template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color):DelphesBranchBase(name, type, color) { … … 58 59 data_->SetMarkerSize(0.5); 59 60 } else { 60 throw std::exception(); 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(); 61 67 } 62 68 } -
display/DelphesEventDisplay.cc
r84dd1c8 ra3b2495 109 109 for(std::vector<DelphesBranchBase*>::iterator element = gElements.begin(); element<gElements.end(); ++element) { 110 110 DelphesBranchElement<TEveTrackList>* item_v1 = dynamic_cast<DelphesBranchElement<TEveTrackList>*>(*element); 111 DelphesBranchElement<DelphesCaloData>* item_v2 = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>(*element); 112 DelphesBranchElement<TEveElementList>* item_v3 = dynamic_cast<DelphesBranchElement<TEveElementList>*>(*element); 111 DelphesBranchElement<TEveElementList>* item_v2 = dynamic_cast<DelphesBranchElement<TEveElementList>*>(*element); 113 112 if(item_v1) gEve->AddElement(item_v1->GetContainer()); 114 113 if(item_v2) gEve->AddElement(item_v2->GetContainer()); 115 if(item_v3) gEve->AddElement(item_v3->GetContainer());116 114 } 117 115 … … 123 121 // find the first calo data and use that to initialize the calo display 124 122 for(std::vector<DelphesBranchBase*>::iterator data=gElements.begin();data<gElements.end();++data) { 125 if(TString((*data)->GetType())=="tower") { 123 if(TString((*data)->GetType())=="tower") { // we could also use GetClassName()=="DelphesCaloData" 126 124 DelphesCaloData* container = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>((*data))->GetContainer(); 127 125 assert(container); … … 142 140 } 143 141 144 //make_gui(); 145 //load_event(); 142 //make_gui(); //TODO put back! 143 //load_event(); //TODO put back! 146 144 gEve->Redraw3D(kTRUE); 147 145 … … 163 161 DelphesBranchElement<DelphesCaloData>* clist; 164 162 DelphesBranchElement<TEveElementList>* elist; 163 // first loop with all but tracks 165 164 for(Int_t b = 0; b<nBranches; ++b) { 166 165 TString input = branches[b*3].GetString(); 167 166 TString name = branches[b*3+1].GetString(); 168 167 TString className = branches[b*3+2].GetString(); 169 if(className=="Track") { 170 if(input.Contains("eflow",TString::kIgnoreCase) || name.Contains("eflow",TString::kIgnoreCase)) continue; //no eflow 171 tlist = new DelphesBranchElement<TEveTrackList>(name,"track",kBlue); 172 elements.push_back(tlist); 173 TEveTrackPropagator *trkProp = tlist->GetContainer()->GetPropagator(); 174 trkProp->SetMagField(0., 0., -tk_Bz); 175 trkProp->SetMaxR(tk_radius); 176 trkProp->SetMaxZ(tk_length); 177 } else if(className=="Tower") { 168 if(className=="Tower") { 178 169 if(input.Contains("eflow",TString::kIgnoreCase) || name.Contains("eflow",TString::kIgnoreCase)) continue; //no eflow 179 170 clist = new DelphesBranchElement<DelphesCaloData>(name,"tower",kBlack); … … 191 182 } 192 183 } else if(className=="Electron") { 193 tlist = new DelphesBranchElement<TEveTrackList>(name," track",kRed);184 tlist = new DelphesBranchElement<TEveTrackList>(name,"electron",kRed); 194 185 elements.push_back(tlist); 195 186 TEveTrackPropagator *trkProp = tlist->GetContainer()->GetPropagator(); … … 205 196 trkProp->SetMaxZ(tk_length); 206 197 } else if(className=="Muon") { 207 tlist = new DelphesBranchElement<TEveTrackList>(name," track",kGreen);198 tlist = new DelphesBranchElement<TEveTrackList>(name,"muon",kGreen); 208 199 elements.push_back(tlist); 209 200 TEveTrackPropagator *trkProp = tlist->GetContainer()->GetPropagator(); … … 214 205 elements.push_back(new DelphesBranchElement<TEveElementList>(name,"vector",kViolet)); 215 206 } else if(className=="GenParticle") { 216 tlist = new DelphesBranchElement<TEveTrackList>(name," track",kCyan);207 tlist = new DelphesBranchElement<TEveTrackList>(name,"genparticle",kCyan); 217 208 elements.push_back(tlist); 218 209 tlist->GetContainer()->SetRnrSelf(false); … … 222 213 trkProp->SetMaxR(tk_radius); 223 214 trkProp->SetMaxZ(tk_length); 215 } else { 216 continue; 224 217 } 225 218 //TODO one possible simplification could be to add the array to the element class. 226 219 arrays.push_back(gTreeReader->UseBranch(name)); 220 } 221 // second loop for tracks 222 for(Int_t b = 0; b<nBranches; ++b) { 223 TString input = branches[b*3].GetString(); 224 TString name = branches[b*3+1].GetString(); 225 TString className = branches[b*3+2].GetString(); 226 if(className=="Track") { 227 if(input.Contains("eflow",TString::kIgnoreCase) || name.Contains("eflow",TString::kIgnoreCase)) continue; //no eflow 228 tlist = new DelphesBranchElement<TEveTrackList>(name,"track",kBlue); 229 elements.push_back(tlist); 230 TEveTrackPropagator *trkProp = tlist->GetContainer()->GetPropagator(); 231 trkProp->SetMagField(0., 0., -tk_Bz); 232 trkProp->SetMaxR(tk_radius); 233 trkProp->SetMaxZ(tk_length); 234 arrays.push_back(gTreeReader->UseBranch(name)); 235 } 227 236 } 228 237 } … … 248 257 delphes_read(); 249 258 250 //TODO: it blocks somewhere below....251 //TODO: also the event content has one weird entry "TEveCalData" -> corruption????252 //other observation: projections appear in the 3D view ! -> seems to indicate that we have a common problem there.253 //should check the content of the elements vector when filling them254 259 // update display 255 260 TEveElement* top = (TEveElement*)gEve->GetCurrentEvent(); … … 277 282 std::vector<TClonesArray*>::iterator data = gArrays.begin(); 278 283 std::vector<DelphesBranchBase*>::iterator element = gElements.begin(); 279 std::vector<TClonesArray*>::iterator data_tracks = gArrays.begin();280 std::vector<DelphesBranchBase*>::iterator element_tracks = gElements.begin();281 Int_t nTracks = 0;282 284 for(; data<gArrays.end() && element<gElements.end(); ++data, ++element) { 283 285 TString type = (*element)->GetType(); 284 // keep the most generic track collection for the end285 if(type=="track" && TString((*element)->GetClassName())=="Track" && nTracks==0) {286 data_tracks = data;287 element_tracks = element;288 nTracks = (*data_tracks)->GetEntries();289 continue;290 }291 286 // branch on the element type 292 287 if(type=="tower") delphes_read_towers(*data,*element); 293 else if(type=="track" || type=="photon" ) delphes_read_tracks(*data,*element);288 else if(type=="track" || type=="photon" || type=="electron" || type=="muon" || type=="genparticle") delphes_read_tracks(*data,*element); 294 289 else if(type=="jet") delphes_read_jets(*data,*element); 295 290 else if(type=="vector") delphes_read_vectors(*data,*element); 296 291 } 297 // finish whith what we consider to be the main track collection298 if(nTracks>0) delphes_read_tracks(*data,*element);299 292 } 300 293 … … 317 310 TEveTrackList* container = dynamic_cast<DelphesBranchElement<TEveTrackList>*>(element)->GetContainer(); 318 311 assert(container); 319 TString className = element->GetClassName();312 TString type = element->GetType(); 320 313 TIter itTrack(data); 321 314 Int_t counter = 0; 322 315 TEveTrack *eveTrack; 323 316 TEveTrackPropagator *trkProp = container->GetPropagator(); 324 if( className=="Track") {317 if(type=="track") { 325 318 // Loop over all tracks 326 319 Track *track; … … 330 323 track->P4().Pz(), track->P4().E(), 331 324 track->X, track->Y, track->Z, 0.0); 332 333 325 eveTrack = new TEveTrack(&pb, counter, trkProp); 334 326 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); … … 339 331 eveTrack->MakeTrack(); 340 332 } 341 } else if( className=="Electron") {333 } else if(type=="electron") { 342 334 // Loop over all electrons 343 335 Electron *electron; … … 346 338 electron->P4().Px(), electron->P4().Py(), 347 339 electron->P4().Pz(), electron->P4().E(), 348 0., 0., 0., 0.);349 350 eveTrack = new TEveTrack(&pb, counter, trkProp);351 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++));352 eveTrack->SetStdTitle();353 eveTrack->SetAttLineAttMarker(container);354 container->AddElement(eveTrack);355 eveTrack->SetLineColor(element->GetColor());356 eveTrack->MakeTrack();357 }358 } else if(className=="Muon") {359 // Loop over all muons360 Muon *muon;361 while((muon = (Muon *) itTrack.Next())) {362 TParticle pb(muon->Charge<0?13:-13, 1, 0, 0, 0, 0,363 muon->P4().Px(), muon->P4().Py(),364 muon->P4().Pz(), muon->P4().E(),365 340 0., 0., 0., 0.); 366 341 … … 373 348 eveTrack->MakeTrack(); 374 349 } 375 } else if(className=="Photon") { 350 } else if(type=="muon") { 351 // Loop over all muons 352 Muon *muon; 353 while((muon = (Muon *) itTrack.Next())) { 354 TParticle pb(muon->Charge<0?13:-13, 1, 0, 0, 0, 0, 355 muon->P4().Px(), muon->P4().Py(), 356 muon->P4().Pz(), muon->P4().E(), 357 0., 0., 0., 0.); 358 359 eveTrack = new TEveTrack(&pb, counter, trkProp); 360 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 361 eveTrack->SetStdTitle(); 362 eveTrack->SetAttLineAttMarker(container); 363 container->AddElement(eveTrack); 364 eveTrack->SetLineColor(element->GetColor()); 365 eveTrack->MakeTrack(); 366 } 367 } else if(type=="photon") { 376 368 // Loop over all photons 377 369 Photon *photon; … … 381 373 photon->P4().Pz(), photon->P4().E(), 382 374 0., 0., 0., 0.); 383 375 eveTrack = new TEveTrack(&pb, counter, trkProp); 376 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 377 eveTrack->SetStdTitle(); 378 eveTrack->SetAttLineAttMarker(container); 379 eveTrack->SetLineStyle(7); 380 container->AddElement(eveTrack); 381 eveTrack->SetLineColor(element->GetColor()); 382 eveTrack->MakeTrack(); 383 } 384 } else if(type=="genparticle") { 385 // Loop over all particles 386 GenParticle *particle; 387 while((particle = (GenParticle *) itTrack.Next())) { 388 TParticle pb(particle->PID, particle->Status, particle->M1, particle->M2, particle->D1, particle->D2, 389 particle->P4().Px(), particle->P4().Py(), 390 particle->P4().Pz(), particle->P4().E(), 391 particle->X, particle->Y, particle->Z, particle->T); 384 392 eveTrack = new TEveTrack(&pb, counter, trkProp); 385 393 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); … … 388 396 container->AddElement(eveTrack); 389 397 eveTrack->SetLineColor(element->GetColor()); 398 if(particle->Charge==0) eveTrack->SetLineStyle(7); 390 399 eveTrack->MakeTrack(); 391 400 }
Note:
See TracChangeset
for help on using the changeset viewer.