Changeset c3c9ac5 in git for display/DelphesPlotSummary.cc
- Timestamp:
- Dec 8, 2014, 4:37:07 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 2e8de36, f6b6ee7
- Parents:
- f185c24
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
display/DelphesPlotSummary.cc
rf185c24 rc3c9ac5 49 49 histograms.push_back(h); 50 50 histograms_[(*data)->GetName()] = histograms; 51 // the event histograms 52 TH1F* h1 = (TH1F*)histograms[0]->Clone(); h1->Reset(); h1->SetLineColor(kBlue); 53 TH1F* h2 = (TH1F*)histograms[1]->Clone(); h2->Reset(); h2->SetLineColor(kBlue); 54 TH1F* h3 = (TH1F*)histograms[2]->Clone(); h3->Reset(); h3->SetLineColor(kBlue); 55 std::vector<TH1F*> hv; 56 hv.push_back(h1); 57 hv.push_back(h2); 58 hv.push_back(h3); 59 eventProfiles_[(*data)->GetName()] = hv; 60 // the event markers 61 TMarker *m; 62 std::vector<TMarker*> mv; 63 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 64 mv.push_back(m); 65 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 66 mv.push_back(m); 67 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 68 mv.push_back(m); 69 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 70 mv.push_back(m); 71 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 72 mv.push_back(m); 73 m = new TMarker(0,0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 74 mv.push_back(m); 75 eventMarkers_[(*data)->GetName()] = mv; 51 76 } 52 77 } … … 95 120 eventProfiles[i]->Draw("same"); 96 121 } else { 97 if(eventMarkers.size()>(unsigned int)(i-3)) { 98 eventMarkers[i-3]->Draw("same"); 99 } 122 eventMarkers[i-3]->Draw("same"); 100 123 } 101 124 } … … 104 127 } 105 128 106 void DelphesPlotSummary::FillEvent() { //TODO make it faster... try to reuse objects and simply change the values 107 // clear previous markers 129 void DelphesPlotSummary::FillEvent() { 130 // clear event histograms and markers 131 for(std::map< TString, std::vector<TH1F*> >::iterator hv = eventProfiles_.begin(); hv!=eventProfiles_.end();++hv) { 132 for(std::vector<TH1F*>::iterator h = hv->second.begin(); h<hv->second.end();++h) { 133 (*h)->Reset(); 134 } 135 } 108 136 for(std::map< TString, std::vector<TMarker*> >::iterator mv = eventMarkers_.begin(); mv!=eventMarkers_.end();++mv) { 109 137 for(std::vector<TMarker*>::iterator m = mv->second.begin(); m<mv->second.end();++m) { 110 delete *m;138 (*m)->SetMarkerSize(0); 111 139 } 112 140 } 113 eventMarkers_.clear();114 for(std::map< TString, std::vector<TH1F*> >::iterator hv = eventProfiles_.begin(); hv!=eventProfiles_.end();++hv) {115 for(std::vector<TH1F*>::iterator h = hv->second.begin(); h<hv->second.end();++h) {116 delete *h;117 }118 }119 eventProfiles_.clear();120 141 // loop over the elements and fill markers with event data 121 TMarker *m;122 142 for(std::vector<DelphesBranchBase*>::iterator element = elements_->begin();element<elements_->end();++element) { 123 std::vector<TMarker*> mv;124 143 std::vector<TLorentzVector> vectors = (*element)->GetVectors(); 125 144 std::sort(vectors.begin(), vectors.end(), vecsorter); 126 std::vector<TH1F*> histograms = histograms_[(*element)->GetName()]; 127 TH1F* h1 = (TH1F*)histograms[0]->Clone(); h1->Reset(); h1->SetLineColor(kBlue); 128 TH1F* h2 = (TH1F*)histograms[1]->Clone(); h2->Reset(); h2->SetLineColor(kBlue); 129 TH1F* h3 = (TH1F*)histograms[2]->Clone(); h3->Reset(); h3->SetLineColor(kBlue); 145 std::vector<TH1F*> hv = eventProfiles_[(*element)->GetName()]; 146 TH1F* h1 = hv[0]; h1->Reset(); 147 TH1F* h2 = hv[1]; h1->Reset(); 148 TH1F* h3 = hv[2]; h1->Reset(); 149 std::vector<TMarker*> mv = eventMarkers_[(*element)->GetName()]; 130 150 for(std::vector<TLorentzVector>::iterator it=vectors.begin(); it<vectors.end();++it) { 131 151 h1->Fill(it->Pt()); … … 133 153 h3->Fill(it->Phi()); 134 154 if(it==vectors.begin()) { 135 m = new TMarker(it->Pt(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 136 mv.push_back(m); 137 m = new TMarker(it->Eta(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 138 mv.push_back(m); 139 m = new TMarker(it->Phi(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 140 mv.push_back(m); 155 mv[0]->SetX(it->Pt()); mv[0]->SetMarkerSize(3); 156 mv[1]->SetX(it->Eta()); mv[1]->SetMarkerSize(3); 157 mv[2]->SetX(it->Phi()); mv[2]->SetMarkerSize(3); 141 158 } 142 159 if(it==vectors.begin()+1) { 143 m = new TMarker(it->Pt(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 144 mv.push_back(m); 145 m = new TMarker(it->Eta(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 146 mv.push_back(m); 147 m = new TMarker(it->Phi(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3); 148 mv.push_back(m); 160 mv[3]->SetX(it->Pt()); mv[3]->SetMarkerSize(3); 161 mv[4]->SetX(it->Eta()); mv[4]->SetMarkerSize(3); 162 mv[5]->SetX(it->Phi()); mv[5]->SetMarkerSize(3); 149 163 } 150 164 } 151 std::vector<TH1F*> hv;152 hv.push_back(h1);153 hv.push_back(h2);154 hv.push_back(h3);155 eventProfiles_[(*element)->GetName()] = hv;156 eventMarkers_[(*element)->GetName()] = mv;157 165 } 158 166 }
Note:
See TracChangeset
for help on using the changeset viewer.