Changeset a844c07 in git
- Timestamp:
- Oct 13, 2014, 10:18:02 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- ffd01cb
- Parents:
- b4cd1e7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/geometry.C
rb4cd1e7 ra844c07 61 61 Int_t event_id = 0; // Current event id. 62 62 Double_t gRadius = 1.29; 63 Double_t gTotRadius = 2.0; 63 64 Double_t gHalfLength = 3.0; 64 65 Double_t gBz = 3.8; … … 73 74 TClonesArray *gBranchTower = 0; 74 75 TClonesArray *gBranchTrack = 0; 76 TClonesArray *gBranchEle = 0; 77 TClonesArray *gBranchMuon = 0; 78 TClonesArray *gBranchPhoton = 0; 75 79 TClonesArray *gBranchJet = 0; 80 TClonesArray *gBranchGenJet = 0; 76 81 TClonesArray *gBranchMet = 0; 77 82 78 83 DelphesCaloData *gCaloData = 0; 79 84 TEveElementList *gJetList = 0; 85 TEveElementList *gGenJetList = 0; 80 86 TEveArrow *gMet = 0; 81 87 TEveTrackList *gTrackList = 0; 88 TEveTrackList *gElectronList = 0; 89 TEveTrackList *gMuonList = 0; 90 TEveTrackList *gPhotonList = 0; 82 91 83 92 DelphesDisplay *gDelphesDisplay = 0; … … 110 119 111 120 Double_t getTrackerRadius() const { return tk_radius_; } 121 Double_t getDetectorRadius() const { return muonSystem_radius_; } 112 122 Double_t getTrackerHalfLength() const { return tk_length_; } 113 123 Double_t getBField() const { return tk_Bz_; } … … 136 146 Double_t calo_endcap_thickness_; 137 147 Double_t muonSystem_thickn_; 148 Double_t muonSystem_radius_; 138 149 Double_t tk_radius_; 139 150 Double_t tk_length_; … … 183 194 tk_etamax_ = 3.0; 184 195 tk_Bz_ = 1.; 196 muonSystem_radius_ = 200.; 185 197 } 186 198 … … 268 280 etaAxis_ = new TAxis(caloBinning.size() - 1, etaBins); 269 281 phiAxis_ = new TAxis(72, -TMath::Pi(), TMath::Pi()); // note that this is fixed while #phibins could vary, also with eta, which doesn't seem possible in ROOT 282 283 muonSystem_radius_ = tk_radius_ + contingency_ + (contingency_+calo_barrel_thickness_)*calorimeters_.size() + muonSystem_thickn_; 270 284 271 285 delete confReader; … … 485 499 // build the detector 486 500 gRadius = det3D.getTrackerRadius(); 501 gTotRadius = det3D.getDetectorRadius(); 487 502 gHalfLength = det3D.getTrackerHalfLength(); 488 503 gBz = det3D.getBField(); … … 528 543 529 544 // Get pointers to branches 530 gBranchTower = gTreeReader->UseBranch("Tower");531 gBranchTrack = gTreeReader->UseBranch("Track");532 gBranchJet = gTreeReader->UseBranch("Jet");533 gBranchMet = gTreeReader->UseBranch("MissingET");534 535 545 //TODO make it configurable, for more objects (or can we guess from the config?) 536 // idea: for pf objects, we could use the TEveCompound to show track + cluster ??? (nice display but little meaning) 537 // for MET and SHT, show an arrow (tooltip = title) 538 // for electrons and muons, create additional track collections 539 // for photons, use TEveStraightLineSet 540 541 /* 542 add Branch Calorimeter/eflowTracks EFlowTrack Track 543 add Branch Calorimeter/eflowPhotons EFlowPhoton Tower 544 add Branch Calorimeter/eflowNeutralHadrons EFlowNeutralHadron Tower 545 546 add Branch GenJetFinder/jets GenJet Jet 547 548 add Branch UniqueObjectFinder/jets Jet Jet 549 550 add Branch UniqueObjectFinder/electrons Electron Electron 551 add Branch UniqueObjectFinder/photons Photon Photon 552 add Branch UniqueObjectFinder/muons Muon Muon 553 554 add Branch MissingET/momentum MissingET MissingET 555 add Branch ScalarHT/energy ScalarHT ScalarHT 556 */ 546 gBranchTower = gTreeReader->UseBranch("Tower"); 547 gBranchTrack = gTreeReader->UseBranch("Track"); 548 gBranchEle = gTreeReader->UseBranch("Electron"); 549 gBranchMuon = gTreeReader->UseBranch("Muon"); 550 gBranchPhoton = gTreeReader->UseBranch("Photon"); 551 gBranchJet = gTreeReader->UseBranch("Jet"); 552 gBranchGenJet = gTreeReader->UseBranch("GenJet"); 553 gBranchMet = gTreeReader->UseBranch("MissingET"); 557 554 558 555 // data … … 565 562 566 563 gJetList = new TEveElementList("Jets"); 564 gJetList->SetMainColor(kYellow); 567 565 gEve->AddElement(gJetList); 566 567 gGenJetList = new TEveElementList("GenJets"); 568 gGenJetList->SetMainColor(kCyan); 569 gGenJetList->SetRnrSelf(false); 570 gGenJetList->SetRnrChildren(false); 571 gEve->AddElement(gGenJetList); 568 572 569 573 gMet = new TEveArrow(1., 0., 0., 0., 0., 0.); … … 574 578 gEve->GetCurrentEvent()->AddElement(gMet); 575 579 580 TEveTrackPropagator *trkProp; 581 582 gElectronList = new TEveTrackList("Electrons"); 583 gElectronList->SetMainColor(kRed); 584 gElectronList->SetMarkerColor(kViolet); 585 gElectronList->SetMarkerStyle(kCircle); 586 gElectronList->SetMarkerSize(0.5); 587 gEve->AddElement(gElectronList); 588 trkProp = gElectronList->GetPropagator(); 589 trkProp->SetMagField(0.0, 0.0, -gBz); 590 trkProp->SetMaxR(gRadius); 591 trkProp->SetMaxZ(gHalfLength); 592 593 gMuonList = new TEveTrackList("Muons"); 594 gMuonList->SetMainColor(kGreen); 595 gMuonList->SetMarkerColor(kViolet); 596 gMuonList->SetMarkerStyle(kCircle); 597 gMuonList->SetMarkerSize(0.5); 598 gEve->AddElement(gMuonList); 599 trkProp = gMuonList->GetPropagator(); 600 trkProp->SetMagField(0.0, 0.0, -gBz); 601 trkProp->SetMaxR(gTotRadius); 602 trkProp->SetMaxZ(gHalfLength); 603 576 604 gTrackList = new TEveTrackList("Tracks"); 577 605 gTrackList->SetMainColor(kBlue); … … 580 608 gTrackList->SetMarkerSize(0.5); 581 609 gEve->AddElement(gTrackList); 582 583 TEveTrackPropagator *trkProp = gTrackList->GetPropagator(); 610 trkProp = gTrackList->GetPropagator(); 584 611 trkProp->SetMagField(0.0, 0.0, -gBz); 612 trkProp->SetMaxR(gRadius); 613 trkProp->SetMaxZ(gHalfLength); 614 615 gPhotonList= new TEveTrackList("Photons"); 616 gPhotonList->SetMainColor(kYellow); 617 gPhotonList->SetLineStyle(7); 618 gPhotonList->SetMarkerColor(kViolet); 619 gPhotonList->SetMarkerStyle(kCircle); 620 gPhotonList->SetMarkerSize(0.5); 621 gEve->AddElement(gPhotonList); 622 trkProp = gPhotonList->GetPropagator(); 623 trkProp->SetMagField(0.0, 0.0, 0.0); 585 624 trkProp->SetMaxR(gRadius); 586 625 trkProp->SetMaxZ(gHalfLength); … … 623 662 if(gCaloData) gCaloData->ClearTowers(); 624 663 if(gJetList) gJetList->DestroyElements(); 664 if(gGenJetList) gGenJetList->DestroyElements(); 625 665 if(gTrackList) gTrackList->DestroyElements(); 666 if(gElectronList) gElectronList->DestroyElements(); 667 if(gMuonList) gMuonList->DestroyElements(); 668 if(gPhotonList) gPhotonList->DestroyElements(); 626 669 627 670 delphes_read(); … … 643 686 TIter itTower(gBranchTower); 644 687 TIter itTrack(gBranchTrack); 688 TIter itElectron(gBranchEle); 689 TIter itPhoton(gBranchPhoton); 690 TIter itMuon(gBranchMuon); 645 691 TIter itJet(gBranchJet); 692 TIter itGenJet(gBranchGenJet); 646 693 TIter itMet(gBranchMet); 647 694 648 695 Tower *tower; 649 696 Track *track; 697 Electron *electron; 698 Muon *muon; 699 Photon *photon; 650 700 Jet *jet; 651 701 MissingET *MET; … … 658 708 659 709 TEveTrackPropagator *trkProp = gTrackList->GetPropagator(); 710 TEveTrackPropagator *photProp = gPhotonList->GetPropagator(); 660 711 if(event_id >= gTreeReader->GetEntries()) return; 661 712 662 713 // Load selected branches with data from specified event 663 714 gTreeReader->ReadEntry(event_id); 715 664 716 // Loop over all towers 665 717 itTower.Reset(); … … 671 723 } 672 724 gCaloData->DataChanged(); 725 673 726 // Loop over all tracks 674 727 itTrack.Reset(); 675 728 counter = 0; 676 while((track = (Track *) itTrack.Next())) 677 { 729 while((track = (Track *) itTrack.Next())) { 678 730 TParticle pb(track->PID, 1, 0, 0, 0, 0, 679 731 track->P4().Px(), track->P4().Py(), … … 685 737 eveTrack->SetStdTitle(); 686 738 eveTrack->SetAttLineAttMarker(gTrackList); 687 688 switch(TMath::Abs(track->PID))689 {690 case 11:691 eveTrack->SetLineColor(kRed);692 break;693 case 13:694 eveTrack->SetLineColor(kGreen);695 break;696 default:697 eveTrack->SetLineColor(kBlue);698 }699 739 gTrackList->AddElement(eveTrack); 740 eveTrack->SetLineColor(kBlue); 700 741 eveTrack->MakeTrack(); 701 742 maxPt = maxPt > track->PT ? maxPt : track->PT; 702 743 } 744 745 // Loop over all electrons 746 itElectron.Reset(); 747 counter = 0; 748 while((electron = (Electron *) itElectron.Next())) { 749 TParticle pb(electron->Charge<0?11:-11, 1, 0, 0, 0, 0, 750 electron->P4().Px(), electron->P4().Py(), 751 electron->P4().Pz(), electron->P4().E(), 752 0., 0., 0., 0.); 753 754 eveTrack = new TEveTrack(&pb, counter, trkProp); 755 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 756 eveTrack->SetStdTitle(); 757 eveTrack->SetAttLineAttMarker(gElectronList); 758 gElectronList->AddElement(eveTrack); 759 eveTrack->SetLineColor(kRed); 760 eveTrack->MakeTrack(); 761 maxPt = maxPt > electron->PT ? maxPt : electron->PT; 762 } 763 764 // Loop over all photons 765 itPhoton.Reset(); 766 counter = 0; 767 while((photon = (Photon *) itPhoton.Next())) { 768 TParticle pb(22, 1, 0, 0, 0, 0, 769 photon->P4().Px(), photon->P4().Py(), 770 photon->P4().Pz(), photon->P4().E(), 771 0., 0., 0., 0.); 772 773 eveTrack = new TEveTrack(&pb, counter, photProp); 774 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 775 eveTrack->SetStdTitle(); 776 eveTrack->SetAttLineAttMarker(gPhotonList); 777 gPhotonList->AddElement(eveTrack); 778 eveTrack->SetLineColor(kYellow); 779 eveTrack->MakeTrack(); 780 maxPt = maxPt > photon->PT ? maxPt : photon->PT; 781 } 782 783 // Loop over all muons 784 itMuon.Reset(); 785 counter = 0; 786 while((muon = (Muon *) itMuon.Next())) { 787 TParticle pb(muon->Charge<0?13:-13, 1, 0, 0, 0, 0, 788 muon->P4().Px(), muon->P4().Py(), 789 muon->P4().Pz(), muon->P4().E(), 790 0., 0., 0., 0.); 791 792 eveTrack = new TEveTrack(&pb, counter, trkProp); 793 eveTrack->SetName(Form("%s [%d]", pb.GetName(), counter++)); 794 eveTrack->SetStdTitle(); 795 eveTrack->SetAttLineAttMarker(gMuonList); 796 gMuonList->AddElement(eveTrack); 797 eveTrack->SetLineColor(kGreen); 798 eveTrack->MakeTrack(); 799 maxPt = maxPt > muon->PT ? maxPt : muon->PT; 800 } 801 703 802 // Loop over all jets 704 803 itJet.Reset(); … … 707 806 { 708 807 eveJetCone = new TEveJetCone(); 808 eveJetCone->SetTitle(Form("jet [%d]: Pt=%f, Eta=%f, \nPhi=%f, M=%f",counter,jet->PT, jet->Eta, jet->Phi, jet->Mass)); 709 809 eveJetCone->SetName(Form("jet [%d]", counter++)); 710 810 eveJetCone->SetMainTransparency(60); 711 811 eveJetCone->SetLineColor(kYellow); 812 eveJetCone->SetFillColor(kYellow); 712 813 eveJetCone->SetCylinder(gRadius - 10, gHalfLength - 10); 713 814 eveJetCone->SetPickable(kTRUE); … … 715 816 gJetList->AddElement(eveJetCone); 716 817 maxPt = maxPt > jet->PT ? maxPt : jet->PT; 818 } 819 820 // Loop over all genjets 821 itJet.Reset(); 822 counter = 0; 823 while((jet = (Jet *) itGenJet.Next())) 824 { 825 eveJetCone = new TEveJetCone(); 826 eveJetCone->SetTitle(Form("jet [%d]: Pt=%f, Eta=%f, \nPhi=%f, M=%f",counter,jet->PT, jet->Eta, jet->Phi, jet->Mass)); 827 eveJetCone->SetName(Form("jet [%d]", counter++)); 828 eveJetCone->SetMainTransparency(60); 829 eveJetCone->SetLineColor(kCyan); 830 eveJetCone->SetFillColor(kCyan); 831 eveJetCone->SetCylinder(gRadius - 10, gHalfLength - 10); 832 eveJetCone->SetPickable(kTRUE); 833 eveJetCone->AddEllipticCone(jet->Eta, jet->Phi, jet->DeltaEta, jet->DeltaPhi); 834 gGenJetList->AddElement(eveJetCone); 717 835 } 718 836 … … 724 842 gMet = new TEveArrow((gRadius * MET->MET/maxPt)*cos(MET->Phi), (gRadius * MET->MET/maxPt)*sin(MET->Phi), 0., 0., 0., 0.); 725 843 gMet->SetMainColor(kViolet); 726 // gMet->SetTubeR(0.04); 844 gMet->SetTubeR(0.04); 845 gMet->SetConeR(0.08); 846 gMet->SetConeL(0.10); 727 847 gMet->SetPickable(kTRUE); 728 848 gMet->SetName("Missing Et");
Note:
See TracChangeset
for help on using the changeset viewer.