Fork me on GitHub

Changes in / [f6b6ee7:fcdb8bc] in git


Ignore:
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • display/Delphes3DGeometry.cc

    rf6b6ee7 rfcdb8bc  
    4242using namespace std;
    4343
    44 Delphes3DGeometry::Delphes3DGeometry(TGeoManager *geom, bool transp) {
     44Delphes3DGeometry::Delphes3DGeometry(TGeoManager *geom) {
    4545
    4646   //--- the geometry manager
     
    5151   TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
    5252   TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7); // placeholder
    53    if(transp) {
    54      matVacuum->SetTransparency(85);
    55      matAl->SetTransparency(85);
    56    }
     53   matVacuum->SetTransparency(85);
     54   matAl->SetTransparency(85);
    5755
    5856   //--- define some media
  • display/Delphes3DGeometry.h

    rf6b6ee7 rfcdb8bc  
    3535class Delphes3DGeometry {
    3636   public:
    37      Delphes3DGeometry(TGeoManager *geom = NULL, bool transp = false);
     37     Delphes3DGeometry(TGeoManager *geom = NULL);
    3838     ~Delphes3DGeometry() {}
    3939
  • display/DelphesEventDisplay.cc

    rf6b6ee7 rfcdb8bc  
    156156       TEveCaloLego *lego = new TEveCaloLego(container);
    157157       lego->InitMainTrans();
    158  //    lego->RefMainTrans().SetScale(TMath::TwoPi(), TMath::TwoPi(), TMath::Pi());
    159        lego->RefMainTrans().SetScale(100, 100, TMath::Pi());
     158       lego->RefMainTrans().SetScale(TMath::TwoPi(), TMath::TwoPi(), TMath::Pi());
    160159       lego->SetAutoRebin(kFALSE);
    161160       lego->Set2DMode(TEveCaloLego::kValSizeOutline);
  • display/DelphesEventDisplay.h

    rf6b6ee7 rfcdb8bc  
    111111    }
    112112
    113     void DisplayProgress(Int_t p) {
     113    void DisplayProgress(Int_t p) { //TODO replace by a progress bar
    114114         fStatusBar_->SetText(Form("Processing... %d %%",p), 1);
    115115         gSystem->ProcessEvents();
  • display/DelphesPlotSummary.cc

    rf6b6ee7 rfcdb8bc  
    4949    histograms.push_back(h);
    5050    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;
    7651  }
    7752}
     
    12095        eventProfiles[i]->Draw("same");
    12196      } else {
    122         eventMarkers[i-3]->Draw("same");
     97        if(eventMarkers.size()>(unsigned int)(i-3)) {
     98          eventMarkers[i-3]->Draw("same");
     99        }
    123100      }
    124101    }
     
    127104}
    128105
    129 void DelphesPlotSummary::FillEvent() {
    130   // clear event histograms and markers
     106void DelphesPlotSummary::FillEvent() { //TODO make it faster... try to reuse objects and simply change the values
     107  // clear previous markers
     108  for(std::map< TString, std::vector<TMarker*> >::iterator mv = eventMarkers_.begin(); mv!=eventMarkers_.end();++mv) {
     109    for(std::vector<TMarker*>::iterator m = mv->second.begin(); m<mv->second.end();++m) {
     110      delete *m;
     111    }
     112  }
     113  eventMarkers_.clear();
    131114  for(std::map< TString, std::vector<TH1F*> >::iterator hv = eventProfiles_.begin(); hv!=eventProfiles_.end();++hv) {
    132115    for(std::vector<TH1F*>::iterator h = hv->second.begin(); h<hv->second.end();++h) {
    133       (*h)->Reset();
     116      delete *h;
    134117    }
    135118  }
    136   for(std::map< TString, std::vector<TMarker*> >::iterator mv = eventMarkers_.begin(); mv!=eventMarkers_.end();++mv) {
    137     for(std::vector<TMarker*>::iterator m = mv->second.begin(); m<mv->second.end();++m) {
    138       (*m)->SetMarkerSize(0);
    139     }
    140   }
     119  eventProfiles_.clear();
    141120  // loop over the elements and fill markers with event data
     121  TMarker *m;
    142122  for(std::vector<DelphesBranchBase*>::iterator element = elements_->begin();element<elements_->end();++element) {
     123    std::vector<TMarker*> mv;
    143124    std::vector<TLorentzVector> vectors = (*element)->GetVectors();
    144125    std::sort(vectors.begin(), vectors.end(), vecsorter);
    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()];
     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);
    150130    for(std::vector<TLorentzVector>::iterator it=vectors.begin(); it<vectors.end();++it) {
    151131      h1->Fill(it->Pt());
     
    153133      h3->Fill(it->Phi());
    154134      if(it==vectors.begin()) {
    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);
     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);
    158141      }
    159142      if(it==vectors.begin()+1) {
    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);
     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);
    163149      }
    164150    }
     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;
    165157  }
    166158}
  • examples/EventDisplay.C

    rf6b6ee7 rfcdb8bc  
    1 /* Example:
    2  * root -l 'EventDisplay.C("delphes_card_CMS.tcl","../delphes_output.root")'
    3  * root -l 'EventDisplay.C("delphes_card_FCC_basic.tcl","../delphes_output.root","ParticlePropagator","ChargedHadronTrackingEfficiency","MuonTrackingEfficiency","Ecal,Hcal")'
    4  */
    51
    6 void EventDisplay(const char* configfile = "delphes_card_CMS.tcl", const char* datafile = "delphes_output.root",
    7                   const char* ParticlePropagator="ParticlePropagator",
    8                   const char* TrackingEfficiency="ChargedHadronTrackingEfficiency",
    9                   const char* MuonEfficiency="MuonEfficiency",
    10                   const char* Calorimeters="Calorimeter",
    11                   bool displayGeometryOnly = false)
     2void evdisplay(const char* configfile = "delphes_card_CMS.tcl", const char* datafile = "delphes_output.root",
     3               const char* ParticlePropagator="ParticlePropagator",
     4               const char* TrackingEfficiency="ChargedHadronTrackingEfficiency",
     5               const char* MuonEfficiency="MuonEfficiency",
     6               const char* Calorimeters="Calorimeter")
    127{
    138   // load the libraries
     
    1611   gSystem->Load("../libDelphesDisplay");
    1712
    18    if(displayGeometryOnly) {
    19      // create the detector representation without transparency
    20      Delphes3DGeometry det3D_geom(new TGeoManager("delphes", "Delphes geometry"), false);
    21      det3D_geom.readFile(configfile, ParticlePropagator, TrackingEfficiency, MuonEfficiency, Calorimeters);
     13   // create the detector representation
     14   Delphes3DGeometry det3D(new TGeoManager("delphes", "Delphes geometry"));
     15   det3D.readFile(configfile, ParticlePropagator, TrackingEfficiency, MuonEfficiency, Calorimeters);
    2216
    23      // display
    24      det3D_geom.getDetector()->Draw("ogl");
     17   // create the application items
     18   DelphesEventDisplay* display = new DelphesEventDisplay(configfile, datafile, det3D);
    2519
    26    } else {
    27 
    28      // create the detector representation
    29      Delphes3DGeometry det3D(new TGeoManager("delphes", "Delphes geometry"), true);
    30      det3D.readFile(configfile, ParticlePropagator, TrackingEfficiency, MuonEfficiency, Calorimeters);
    31 
    32      // create the application
    33      DelphesEventDisplay* display = new DelphesEventDisplay(configfile, datafile, det3D);
    34 
    35    }
     20/*
     21   // EClipType not exported to CINT (see TGLUtil.h):
     22   // 0 - no clip, 1 - clip plane, 2 - clip box
     23   TGLViewer *v = gEve->GetDefaultGLViewer();
     24   //Double_t plane[4] = { 0., 1., 0., 0. };
     25   //v->GetClipSet()->SetClipState(1,plane);
     26   //v->GetClipSet()->SetClipType(1);
     27   //v->ColorSet().Background().SetColor(kMagenta+4);
     28   //v->SetGuideState(TGLUtil::kAxesEdge, kTRUE, kFALSE, 0);
     29   v->RefreshPadEditor(v);
     30   v->CurrentCamera().RotateRad(-1.2, 0.5);
     31   v->DoDraw();
     32*/
    3633}
    3734
Note: See TracChangeset for help on using the changeset viewer.