- Timestamp:
- Oct 15, 2014, 2:27:37 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- cfc3160
- Parents:
- b3c42d3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/geometry.C
rb3c42d3 r4d999a57 19 19 //#include "display/DelphesCaloData.h" 20 20 //#include "display/DelphesDisplay.h" 21 //#include "display/DelphesBranchElement.h"21 #include "../display/DelphesBranchElement.h" 22 22 //#include "classes/DelphesClasses.h" 23 23 #include "TF2.h" … … 62 62 void load_event(); 63 63 void delphes_read(); 64 void delphes_read_towers(TClonesArray* data, DelphesBranchBase* element); 65 void delphes_read_tracks(TClonesArray* data, DelphesBranchBase* element); 66 void delphes_read_jets(TClonesArray* data, DelphesBranchBase* element); 67 void delphes_read_vectors(TClonesArray* data, DelphesBranchBase* element); 64 68 void readConfig(const char *configFile, const Delphes3DGeometry& det3D, std::vector<DelphesBranchBase*>& elements, std::vector<TClonesArray*>& arrays); 65 69 … … 496 500 DelphesBranchElement<TEveTrackList>* tlist; 497 501 DelphesBranchElement<DelphesCaloData>* clist; 498 DelphesBranchElement<TEve TrackList>* elist;502 DelphesBranchElement<TEveElementList>* elist; 499 503 for(Int_t b = 0; b<nBranches; ++b) { 500 504 TString input = branches[b*3].GetString(); … … 503 507 if(className=="Track") { 504 508 if(input.Contains("eflow",TString::kIgnoreCase) || name.Contains("eflow",TString::kIgnoreCase)) continue; //no eflow 505 elist = new DelphesBranchElement<TEveTrackList>(name,"track",kBlue);506 elements.push_back( elist);507 TEveTrackPropagator *trkProp = elist->GetContainer()->GetPropagator();509 tlist = new DelphesBranchElement<TEveTrackList>(name,"track",kBlue); 510 elements.push_back(tlist); 511 TEveTrackPropagator *trkProp = tlist->GetContainer()->GetPropagator(); 508 512 trkProp->SetMagField(0., 0., -tk_Bz); 509 513 trkProp->SetMaxR(tk_radius); … … 622 626 gDelphesDisplay->ImportGeomRhoZ(geometry); 623 627 // find the first calo data and use that to initialize the calo display 624 for(std::vector<DelphesBranchBase*>::iterator data=gElements.begin();data<gElements.end();++ Data) {628 for(std::vector<DelphesBranchBase*>::iterator data=gElements.begin();data<gElements.end();++data) { 625 629 if(TString((*data)->GetType())=="tower") { 626 TEveCalo3D *calo3d = new TEveCalo3D((*data)->GetContainer()); 630 //TODO: why do I have to split this in two lines??? seems a cint bug? 631 DelphesBranchElement<DelphesCaloData>* data_tmp = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>(*data); 632 DelphesCaloData* container = data_tmp->GetContainer(); 633 // DelphesCaloData* container = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>((*data))->GetContainer(); 634 assert(container); 635 TEveCalo3D *calo3d = new TEveCalo3D(container); 627 636 calo3d->SetBarrelRadius(gRadius); 628 637 calo3d->SetEndCapPos(gHalfLength); … … 630 639 gDelphesDisplay->ImportCaloRPhi(calo3d); 631 640 gDelphesDisplay->ImportCaloRhoZ(calo3d); 632 TEveCaloLego *lego = new TEveCaloLego( (*data)->GetContainer());641 TEveCaloLego *lego = new TEveCaloLego(container); 633 642 lego->InitMainTrans(); 634 643 lego->RefMainTrans().SetScale(TMath::TwoPi(), TMath::TwoPi(), TMath::Pi()); … … 653 662 // clear the previous event 654 663 gEve->GetViewers()->DeleteAnnotations(); 655 for(std::vector<DelphesBranchBase*>::iterator data=gElements.begin();data<gElements.end();++ Data) {656 (*data)->Reset() 664 for(std::vector<DelphesBranchBase*>::iterator data=gElements.begin();data<gElements.end();++data) { 665 (*data)->Reset(); 657 666 } 658 667 … … 691 700 TString type = (*element)->GetType(); 692 701 // keep the most generic track collection for the end 693 if(type=="track" && (*element)->GetClassName()=="Track" && nTracks=0) {702 if(type=="track" && TString((*element)->GetClassName())=="Track" && nTracks==0) { 694 703 data_tracks = data; 695 704 element_tracks = element; … … 698 707 } 699 708 // branch on the element type 700 // TODO : I understand that we will have to cast the elements.701 709 if(type=="tower") delphes_read_towers(*data,*element); 702 710 else if(type=="track" || type=="photon") delphes_read_tracks(*data,*element); … … 705 713 } 706 714 // finish whith what we consider to be the main track collection 707 if(nTracks>0) delphes_read_tracks(*data,(*element)->GetContainer()); 708 } 709 710 void delphes_read_towers(TClonesArray* data, DelphesBranchElement<TEveElementList>* element) { 711 DelphesCaloData* container = element->GetContainer(); 715 if(nTracks>0) delphes_read_tracks(*data,*element); 716 } 717 718 void delphes_read_towers(TClonesArray* data, DelphesBranchBase* element) { 719 DelphesCaloData* container = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>(element)->GetContainer(); 720 assert(container); 712 721 // Loop over all towers 713 722 TIter itTower(data); … … 722 731 } 723 732 724 void delphes_read_tracks(TClonesArray* data, DelphesBranchElement<TEveTrackList>* element) { 725 TEveTrackList* container = element->GetContainer(); 733 void delphes_read_tracks(TClonesArray* data, DelphesBranchBase* element) { 734 TEveTrackList* container = dynamic_cast<DelphesBranchElement<TEveTrackList>*>(element)->GetContainer(); 735 assert(container); 726 736 TString className = element->GetClassName(); 727 737 TIter itTrack(data); … … 741 751 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 742 752 eveTrack->SetStdTitle(); 743 eveTrack->SetAttLineAttMarker( gTrackList);753 eveTrack->SetAttLineAttMarker(container); 744 754 container->AddElement(eveTrack); 745 755 eveTrack->SetLineColor(element->GetColor()); … … 749 759 // Loop over all electrons 750 760 Electron *electron; 751 while((electron = (Electron *) it Electron.Next())) {761 while((electron = (Electron *) itTrack.Next())) { 752 762 TParticle pb(electron->Charge<0?11:-11, 1, 0, 0, 0, 0, 753 763 electron->P4().Px(), electron->P4().Py(), … … 758 768 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 759 769 eveTrack->SetStdTitle(); 760 eveTrack->SetAttLineAttMarker( gElectronList);770 eveTrack->SetAttLineAttMarker(container); 761 771 container->AddElement(eveTrack); 762 772 eveTrack->SetLineColor(element->GetColor()); … … 766 776 // Loop over all muons 767 777 Muon *muon; 768 while((muon = (Muon *) it Muon.Next())) {778 while((muon = (Muon *) itTrack.Next())) { 769 779 TParticle pb(muon->Charge<0?13:-13, 1, 0, 0, 0, 0, 770 780 muon->P4().Px(), muon->P4().Py(), … … 775 785 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 776 786 eveTrack->SetStdTitle(); 777 eveTrack->SetAttLineAttMarker( gMuonList);787 eveTrack->SetAttLineAttMarker(container); 778 788 container->AddElement(eveTrack); 779 789 eveTrack->SetLineColor(element->GetColor()); … … 783 793 // Loop over all photons 784 794 Photon *photon; 785 while((photon = (Photon *) it Photon.Next())) {795 while((photon = (Photon *) itTrack.Next())) { 786 796 TParticle pb(22, 1, 0, 0, 0, 0, 787 797 photon->P4().Px(), photon->P4().Py(), … … 792 802 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 793 803 eveTrack->SetStdTitle(); 794 eveTrack->SetAttLineAttMarker( gPhotonList);804 eveTrack->SetAttLineAttMarker(container); 795 805 container->AddElement(eveTrack); 796 806 eveTrack->SetLineColor(element->GetColor()); … … 800 810 } 801 811 802 void delphes_read_jets(TClonesArray* data, DelphesBranchElement<TEveElementList>* element) { 803 TEveElementList* container = element->GetContainer(); 812 void delphes_read_jets(TClonesArray* data, DelphesBranchBase* element) { 813 TEveElementList* container = dynamic_cast<DelphesBranchElement<TEveElementList>*>(element)->GetContainer(); 814 assert(container); 804 815 TIter itJet(data); 805 816 Jet *jet; … … 822 833 } 823 834 824 void delphes_read_vectors(TClonesArray* data, DelphesBranchElement<TEveElementList>* element) { 825 TEveElementList* container = element->GetContainer(); 835 void delphes_read_vectors(TClonesArray* data, DelphesBranchBase* element) { 836 TEveElementList* container = dynamic_cast<DelphesBranchElement<TEveElementList>*>(element)->GetContainer(); 837 assert(container); 826 838 TIter itMet(data); 827 839 MissingET *MET;
Note:
See TracChangeset
for help on using the changeset viewer.