Fork me on GitHub

Changeset ad015db in git for display/DelphesPlotSummary.cc


Ignore:
Timestamp:
Oct 26, 2014, 12:16:21 AM (10 years ago)
Author:
Christophe Delaere <christophe.delaere@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
2695ae1
Parents:
3f51314
Message:

Small fixes for the summary plots

The plots are now correct, even if few things can be fixed (errors for
empty plots, and integration with the GUI)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • display/DelphesPlotSummary.cc

    r3f51314 rad015db  
    11#include "display/DelphesPlotSummary.h"
    22#include "TRootEmbeddedCanvas.h"
     3#include <algorithm>
    34
     5bool vecsorter (TLorentzVector i,TLorentzVector j) { return (i.Pt()>j.Pt()); }
    46
    57DelphesPlotSummary::DelphesPlotSummary(TEveWindowTab* tab):tab_(tab) {}
    68
    79DelphesPlotSummary::~DelphesPlotSummary() {}
     10
     11//TODO: sort the vectors before filling.
    812
    913void DelphesPlotSummary::Init(std::vector<DelphesBranchBase*>& elements) {
     
    5054    for(std::vector<DelphesBranchBase*>::iterator element = elements_->begin();element<elements_->end();++element) {
    5155      std::vector<TLorentzVector> vectors = (*element)->GetVectors();
     56      std::sort(vectors.begin(), vectors.end(), vecsorter);
    5257      std::vector<TH1F*> histograms = histograms_[(*element)->GetName()];
    5358      for(std::vector<TLorentzVector>::iterator it=vectors.begin(); it<vectors.end();++it) {
     
    8085      c->cd(i+1);
    8186      histograms[i]->Draw();
    82       if(i<3)
     87      if(i<3) {
    8388        eventProfiles[i]->Draw("same");
    84       else
    85         eventMarkers[i-3]->Draw("same");
     89      } else {
     90        if(eventMarkers.size()>(unsigned int)(i-3)) {
     91          eventMarkers[i-3]->Draw("same");
     92        }
     93      }
    8694    }
     95    c->Update();
    8796  }
    8897}
     
    104113  // loop over the elements and fill markers with event data
    105114  TMarker *m;
    106   std::vector<TMarker*> mv;
    107115  for(std::vector<DelphesBranchBase*>::iterator element = elements_->begin();element<elements_->end();++element) {
     116    std::vector<TMarker*> mv;
    108117    std::vector<TLorentzVector> vectors = (*element)->GetVectors();
     118    std::sort(vectors.begin(), vectors.end(), vecsorter);
    109119    std::vector<TH1F*> histograms = histograms_[(*element)->GetName()];
    110120    TH1F* h1 = (TH1F*)histograms[0]->Clone(); h1->Reset(); h1->SetLineColor(kBlue);
     
    116126      h3->Fill(it->Phi());
    117127      if(it==vectors.begin()) {
    118         m = new TMarker(it->Pt(),0,29); m->SetMarkerColor(kBlue);
     128        m = new TMarker(it->Pt(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3);
    119129        mv.push_back(m);
    120         m = new TMarker(it->Eta(),0,29); m->SetMarkerColor(kBlue);
     130        m = new TMarker(it->Eta(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3);
    121131        mv.push_back(m);
    122         m = new TMarker(it->Phi(),0,29); m->SetMarkerColor(kBlue);
     132        m = new TMarker(it->Phi(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3);
    123133        mv.push_back(m);
    124134      }
    125135      if(it==vectors.begin()+1) {
    126         m = new TMarker(it->Pt(),0,29); m->SetMarkerColor(kBlue);
     136        m = new TMarker(it->Pt(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3);
    127137        mv.push_back(m);
    128         m = new TMarker(it->Eta(),0,29); m->SetMarkerColor(kBlue);
     138        m = new TMarker(it->Eta(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3);
    129139        mv.push_back(m);
    130         m = new TMarker(it->Phi(),0,29); m->SetMarkerColor(kBlue);
     140        m = new TMarker(it->Phi(),0,29); m->SetMarkerColor(kBlue); m->SetMarkerSize(3);
    131141        mv.push_back(m);
    132142      }
Note: See TracChangeset for help on using the changeset viewer.