Fork me on GitHub

Changes in / [d38348d:1d9974e] in git


Ignore:
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • cards/delphes_card_ATLAS.tcl

    rd38348d r1d9974e  
    295295
    296296module Efficiency PhotonEfficiency {
    297   set InputArray Calorimeter/eflowPhotons
     297  set InputArray Calorimeter/photons
    298298  set OutputArray photons
    299299
  • classes/DelphesFormula.cc

    rd38348d r1d9974e  
    2323
    2424#include <stdexcept>
     25#include <string>
    2526
    2627using namespace std;
     
    5051Int_t DelphesFormula::Compile(const char *expression)
    5152{
    52   TString buffer;
     53  string buffer;
    5354  const char *it;
    5455  for(it = expression; *it; ++it)
    5556  {
    5657    if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;
    57     buffer.Append(*it);
     58    buffer.push_back(*it);
    5859  }
    59   buffer.ReplaceAll("pt", "x");
    60   buffer.ReplaceAll("eta", "y");
    61   buffer.ReplaceAll("phi", "z");
    62   buffer.ReplaceAll("energy", "t");
    63   if(TFormula::Compile(buffer) != 0)
     60  if(TFormula::Compile(buffer.c_str()) != 0)
    6461  {
    6562    throw runtime_error("Invalid formula.");
     
    7774
    7875//------------------------------------------------------------------------------
     76
     77Int_t DelphesFormula::DefinedVariable(TString &chaine, Int_t &action)
     78{
     79  action = kVariable;
     80  if(chaine == "pt")
     81  {
     82    if(fNdim < 1) fNdim = 1;
     83    return 0;
     84  }
     85  else if(chaine == "eta")
     86  {
     87    if(fNdim < 2) fNdim = 2;
     88    return 1;
     89  }
     90  else if(chaine == "phi")
     91  {
     92    if(fNdim < 3) fNdim = 3;
     93    return 2;
     94  }
     95  else if(chaine == "energy")
     96  {
     97    if(fNdim < 4) fNdim = 4;
     98    return 3;
     99  }
     100  return -1;
     101}
     102
     103//------------------------------------------------------------------------------
  • classes/DelphesFormula.h

    rd38348d r1d9974e  
    3535
    3636  Double_t Eval(Double_t pt, Double_t eta = 0, Double_t phi = 0, Double_t energy = 0);
     37
     38  Int_t DefinedVariable(TString &variable, Int_t &action);
    3739};
    3840
  • classes/DelphesTF2.cc

    rd38348d r1d9974e  
    1818
    1919#include "classes/DelphesTF2.h"
    20 
    21 #include "RVersion.h"
    2220#include "TString.h"
    23 
    2421#include <stdexcept>
     22#include <string>
    2523
    2624using namespace std;
     
    3634
    3735DelphesTF2::DelphesTF2(const char *name, const char *expression) :
    38   TF2(name, expression)
     36  TF2(name,expression)
    3937{
    4038}
     
    4846//------------------------------------------------------------------------------
    4947
    50 Int_t DelphesTF2::Compile(const char *expression)
     48Int_t DelphesTF2::DefinedVariable(TString &chaine, Int_t &action)
    5149{
    52   TString buffer;
    53   const char *it;
    54   for(it = expression; *it; ++it)
     50  action = kVariable;
     51  if(chaine == "z")
    5552  {
    56     if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;
    57     buffer.Append(*it);
     53    if(fNdim < 1) fNdim = 1;
     54    return 0;
    5855  }
    59   buffer.ReplaceAll("z", "x");
    60   buffer.ReplaceAll("t", "y");
    61 #if  ROOT_VERSION_CODE < ROOT_VERSION(6,04,00)
    62   if(TF2::Compile(buffer) != 0)
    63 #else
    64   if(TF2::GetFormula()->Compile(buffer) != 0)
    65 #endif
     56  else if(chaine == "t")
    6657  {
    67     throw runtime_error("Invalid formula.");
     58    if(fNdim < 2) fNdim = 2;
     59    return 1;
    6860  }
    69   return 0;
     61  return -1;
    7062}
    7163
  • classes/DelphesTF2.h

    rd38348d r1d9974e  
    2121
    2222#include "TF2.h"
     23#include "TFormula.h"
     24
     25#include <string>
    2326
    2427class DelphesTF2: public TF2
     
    3235  ~DelphesTF2();
    3336
    34   Int_t Compile(const char *expression);
     37  Int_t DefinedVariable(TString &variable, Int_t &action);
     38
    3539};
    3640
    3741#endif /* DelphesTF2_h */
     42
  • display/Delphes3DGeometry.cc

    rd38348d r1d9974e  
    1717 */
    1818
     19#include "display/Delphes3DGeometry.h"
    1920#include <set>
    2021#include <map>
     22#include <string>
    2123#include <utility>
    2224#include <vector>
     
    2426#include <sstream>
    2527#include <cassert>
    26 
    27 #include "TAxis.h"
    2828#include "TGeoManager.h"
    2929#include "TGeoVolume.h"
     
    3535#include "TGeoCone.h"
    3636#include "TGeoArb8.h"
     37#include "external/ExRootAnalysis/ExRootConfReader.h"
     38#include "classes/DelphesClasses.h"
    3739#include "TF2.h"
    3840#include "TFormula.h"
    3941#include "TH1F.h"
    4042#include "TMath.h"
    41 #include "TString.h"
    42 
    43 #include "display/Delphes3DGeometry.h"
    44 
    45 #include "classes/DelphesClasses.h"
    46 #include "external/ExRootAnalysis/ExRootConfReader.h"
    4743
    4844using namespace std;
     
    9793   tk_Bz_     = confReader->GetDouble("ParticlePropagator::Bz", 0.0);                           // tk_Bz
    9894   
    99    TString buffer;
     95   string buffer;
    10096   const char *it;
    10197 
     
    107103   tkEffFormula.ReplaceAll("phi","0.");
    108104 
    109    buffer.Clear();
    110105   for(it = tkEffFormula.Data(); *it; ++it)
    111106   {
    112107     if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;
    113      buffer.Append(*it);
    114    }
    115 
    116    TF2* tkEffFunction = new TF2("tkEff",buffer,0,1000,-10,10);
     108     buffer.push_back(*it);
     109   }
     110
     111   TF2* tkEffFunction = new TF2("tkEff",buffer.c_str(),0,1000,-10,10);
    117112   TH1F etaHisto("eta","eta",100,5.,-5.);
    118113   Double_t pt,eta;
     
    137132   muonEffFormula.ReplaceAll("phi","0.");
    138133   
    139    buffer.Clear();
     134   buffer.clear();
    140135   for(it = muonEffFormula.Data(); *it; ++it)
    141136   {
    142137     if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;
    143      buffer.Append(*it);
    144    }
    145 
    146    TF2* muEffFunction = new TF2("muEff",buffer,0,1000,-10,10);
     138     buffer.push_back(*it);
     139   }
     140
     141   TF2* muEffFunction = new TF2("muEff",buffer.c_str(),0,1000,-10,10);
    147142   TH1F etaHisto("eta2","eta2",100,5.,-5.);
    148143   Double_t pt,eta;
  • display/Delphes3DGeometry.h

    rd38348d r1d9974e  
    11/*
    2   * Delphes: a framework for fast simulation of a generic collider experiment
    3   * Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
     2 * Delphes: a framework for fast simulation of a generic collider experiment
     3 * Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
    44 *
    5   * This program is free software: you can redistribute it and/or modify
    6   * it under the terms of the GNU General Public License as published by
    7   * the Free Software Foundation, either version 3 of the License, or
    8   * (at your option) any later version.
     5 * This program is free software: you can redistribute it and/or modify
     6 * it under the terms of the GNU General Public License as published by
     7 * the Free Software Foundation, either version 3 of the License, or
     8 * (at your option) any later version.
    99 *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
     10 * This program is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 * GNU General Public License for more details.
    1414 *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15 * You should have received a copy of the GNU General Public License
     16 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1717 */
    1818
     
    2222#include <set>
    2323#include <map>
     24#include <utility>
    2425#include <vector>
    25 
    26 #include "Rtypes.h"
    27 
    28 class TAxis;
    29 class TGeoManager;
    30 class TGeoVolume;
    31 class TGeoMedium;
     26#include <algorithm>
     27#include <sstream>
     28#include "TAxis.h"
     29#include "TGeoManager.h"
     30#include "TGeoVolume.h"
     31#include "TGeoMedium.h"
    3232
    3333// TODO: asymmetric detector
     
    3838     ~Delphes3DGeometry() {}
    3939
    40      void readFile(const char *filename, const char *ParticlePropagator="ParticlePropagator",
    41                                          const char *TrackingEfficiency="ChargedHadronTrackingEfficiency",
    42                                          const char *MuonEfficiency="MuonEfficiency",
    43                                          const char *Calorimeters="Calorimeter");
     40     void readFile(const char* filename, const char* ParticlePropagator="ParticlePropagator",
     41                                         const char* TrackingEfficiency="ChargedHadronTrackingEfficiency",
     42                                         const char* MuonEfficiency="MuonEfficiency",
     43                                         const char* Calorimeters="Calorimeter");
    4444
    4545     void setContingency(Double_t contingency) { contingency_ = contingency; }
     
    4848     void setMuonSystemThickness(Double_t thickness) { muonSystem_thickn_ = thickness; }
    4949
    50      TGeoVolume *getDetector(bool withTowers = true);
     50     TGeoVolume* getDetector(bool withTowers = true);
    5151
    5252     Double_t getTrackerRadius() const { return tk_radius_; }
     
    5959   private:
    6060     std::pair<Double_t, Double_t> addTracker(TGeoVolume *top);
    61      std::pair<Double_t, Double_t> addCalorimeter(TGeoVolume *top, const char *name, Double_t innerBarrelRadius, Double_t innerBarrelLength, std::set< std::pair<Double_t, Int_t> >& caloBinning);
    62      std::pair<Double_t, Double_t> addMuonDets(TGeoVolume *top, const char *name, Double_t innerBarrelRadius, Double_t innerBarrelLength);
    63      void addCaloTowers(TGeoVolume *top, const char *name, Double_t innerBarrelRadius, Double_t innerBarrelLength, std::set< std::pair<Double_t, Int_t> >& caloBinning);
     61     std::pair<Double_t, Double_t> addCalorimeter(TGeoVolume *top, const char* name, Double_t innerBarrelRadius, Double_t innerBarrelLength, std::set< std::pair<Double_t, Int_t> >& caloBinning);
     62     std::pair<Double_t, Double_t> addMuonDets(TGeoVolume *top, const char* name, Double_t innerBarrelRadius, Double_t innerBarrelLength);
     63     void addCaloTowers(TGeoVolume *top, const char* name, Double_t innerBarrelRadius, Double_t innerBarrelLength, std::set< std::pair<Double_t, Int_t> >& caloBinning);
    6464
    6565   private:
     
    7272     TGeoMedium *mudetmed_;
    7373
    74      TAxis *etaAxis_;
    75      TAxis *phiAxis_;
     74     TAxis* etaAxis_;
     75     TAxis* phiAxis_;
    7676
    7777     Double_t contingency_;
     
    9191     std::map<std::string, Double_t> muonSystem_etamax_;
    9292     std::map<std::string, std::set< std::pair<Double_t, Int_t> > > caloBinning_;
    93 
     93     
    9494};
    9595
  • display/DelphesEventDisplay.cc

    rd38348d r1d9974e  
    11/*
    2   * Delphes: a framework for fast simulation of a generic collider experiment
    3   * Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
     2 * Delphes: a framework for fast simulation of a generic collider experiment
     3 * Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
    44 *
    5   * This program is free software: you can redistribute it and/or modify
    6   * it under the terms of the GNU General Public License as published by
    7   * the Free Software Foundation, either version 3 of the License, or
    8   * (at your option) any later version.
     5 * This program is free software: you can redistribute it and/or modify
     6 * it under the terms of the GNU General Public License as published by
     7 * the Free Software Foundation, either version 3 of the License, or
     8 * (at your option) any later version.
    99 *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
     10 * This program is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 * GNU General Public License for more details.
    1414 *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15 * You should have received a copy of the GNU General Public License
     16 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1717 */
    1818
     
    2121#include <utility>
    2222#include <algorithm>
    23 
    2423#include "TGeoManager.h"
    2524#include "TGeoVolume.h"
     25#include "external/ExRootAnalysis/ExRootConfReader.h"
     26#include "external/ExRootAnalysis/ExRootTreeReader.h"
     27#include "display/DelphesCaloData.h"
     28#include "display/DelphesBranchElement.h"
     29#include "display/Delphes3DGeometry.h"
     30#include "display/DelphesEventDisplay.h"
     31#include "classes/DelphesClasses.h"
    2632#include "TEveElement.h"
    2733#include "TEveJetCone.h"
     
    4753#include "TCanvas.h"
    4854#include "TH1F.h"
    49 #include "TAxis.h"
    50 #include "TChain.h"
    51 #include "TGHtml.h"
    52 #include "TGStatusBar.h"
    53 
    54 #include "display/DelphesCaloData.h"
    55 #include "display/DelphesBranchElement.h"
    56 #include "display/Delphes3DGeometry.h"
    57 #include "display/DelphesEventDisplay.h"
    58 #include "display/DelphesDisplay.h"
    59 #include "display/Delphes3DGeometry.h"
    60 #include "display/DelphesHtmlSummary.h"
    61 #include "display/DelphesPlotSummary.h"
    62 
    63 #include "classes/DelphesClasses.h"
    64 #include "external/ExRootAnalysis/ExRootConfReader.h"
    65 #include "external/ExRootAnalysis/ExRootTreeReader.h"
    6655
    6756DelphesEventDisplay::DelphesEventDisplay()
     
    10998   TEveManager::Create(kTRUE, "IV");
    11099   fStatusBar_ = gEve->GetBrowser()->GetStatusBar();
    111    TGeoManager *geom = gGeoManager;
     100   TGeoManager* geom = gGeoManager;
    112101
    113102   // build the detector
     
    119108   etaAxis_ = det3D.getCaloAxes().first;
    120109   phiAxis_ = det3D.getCaloAxes().second;
    121    TGeoVolume *top = det3D.getDetector(false);
     110   TGeoVolume* top = det3D.getDetector(false);
    122111   geom->SetTopVolume(top);
    123112   TEveElementList *geometry = new TEveElementList("Geometry");
    124    TObjArray *nodes = top->GetNodes();
     113   TObjArray* nodes = top->GetNodes();
    125114   TIter itNodes(nodes);
    126    TGeoNode *nodeobj;
    127    TEveGeoTopNode *node;
     115   TGeoNode* nodeobj;
     116   TEveGeoTopNode* node;
    128117   while((nodeobj = (TGeoNode*)itNodes.Next())) {
    129118     node = new TEveGeoTopNode(gGeoManager,nodeobj);
     
    142131   // prepare data collections
    143132   readConfig(configFile, elements_);
    144    for(std::vector<DelphesBranchBase *>::iterator element = elements_.begin(); element<elements_.end(); ++element) {
    145      DelphesBranchElement<TEveTrackList> *item_v1 = dynamic_cast<DelphesBranchElement<TEveTrackList>*>(*element);
    146      DelphesBranchElement<TEveElementList> *item_v2 = dynamic_cast<DelphesBranchElement<TEveElementList>*>(*element);
     133   for(std::vector<DelphesBranchBase*>::iterator element = elements_.begin(); element<elements_.end(); ++element) {
     134     DelphesBranchElement<TEveTrackList>*   item_v1 = dynamic_cast<DelphesBranchElement<TEveTrackList>*>(*element);
     135     DelphesBranchElement<TEveElementList>* item_v2 = dynamic_cast<DelphesBranchElement<TEveElementList>*>(*element);
    147136     if(item_v1) gEve->AddElement(item_v1->GetContainer());
    148137     if(item_v2) gEve->AddElement(item_v2->GetContainer());
     
    155144   delphesDisplay_->ImportGeomRhoZ(geometry);
    156145   // find the first calo data and use that to initialize the calo display
    157    for(std::vector<DelphesBranchBase *>::iterator data=elements_.begin();data<elements_.end();++data) {
     146   for(std::vector<DelphesBranchBase*>::iterator data=elements_.begin();data<elements_.end();++data) {
    158147     if(TString((*data)->GetType())=="Tower") { // we could also use GetClassName()=="DelphesCaloData"
    159        DelphesCaloData *container = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>((*data))->GetContainer();
     148       DelphesCaloData* container = dynamic_cast<DelphesBranchElement<DelphesCaloData>*>((*data))->GetContainer();
    160149       assert(container);
    161150       TEveCalo3D *calo3d = new TEveCalo3D(container);
     
    193182   ExRootConfParam branches = confReader->GetParam("TreeWriter::Branch");
    194183   Int_t nBranches = branches.GetSize()/3;
    195    DelphesBranchElement<TEveTrackList> *tlist;
    196    DelphesBranchElement<DelphesCaloData> *clist;
    197    DelphesBranchElement<TEveElementList> *elist;
     184   DelphesBranchElement<TEveTrackList>* tlist;
     185   DelphesBranchElement<DelphesCaloData>* clist;
     186   DelphesBranchElement<TEveElementList>* elist;
    198187   // first loop with all but tracks
    199188   for(Int_t b = 0; b<nBranches; ++b) {
     
    284273
    285274   // update display
    286    TEveElement *top = (TEveElement*)gEve->GetCurrentEvent();
     275   TEveElement* top = (TEveElement*)gEve->GetCurrentEvent();
    287276   delphesDisplay_->DestroyEventRPhi();
    288277   delphesDisplay_->ImportEventRPhi(top);
     
    367356
    368357   // add a tab on the left
    369    TEveBrowser *browser = gEve->GetBrowser();
     358   TEveBrowser* browser = gEve->GetBrowser();
    370359   browser->SetWindowName("Delphes Event Display");
    371360   browser->StartEmbedding(TRootBrowser::kLeft);
    372361
    373362   // set the main title
    374    TGMainFrame *frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
     363   TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
    375364   frmMain->SetWindowName("Delphes Event Display");
    376365   frmMain->SetCleanup(kDeepCleanup);
     
    382371   if(!gSystem->OpenDirectory(icondir))
    383372     icondir = Form("%s/icons/", (const char*)gSystem->GetFromPipe("root-config --etcdir") );
    384    TGGroupFrame *vf = new TGGroupFrame(frmMain,"Event navigation",kVerticalFrame | kFitWidth );
     373   TGGroupFrame* vf = new TGGroupFrame(frmMain,"Event navigation",kVerticalFrame | kFitWidth );
    385374   {
    386      TGHorizontalFrame *hf = new TGHorizontalFrame(frmMain);
     375     TGHorizontalFrame* hf = new TGHorizontalFrame(frmMain);
    387376     {
    388         TGPictureButton *b = 0;
     377        TGPictureButton* b = 0;
    389378
    390379        b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoBack.gif"));
     
    392381        b->Connect("Clicked()", "DelphesEventDisplay", this, "Bck()");
    393382
    394         TGNumberEntry *numberEntry = new TGNumberEntry(hf,0,9,-1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, treeReader_->GetEntries());
     383        TGNumberEntry* numberEntry = new TGNumberEntry(hf,0,9,-1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, treeReader_->GetEntries());
    395384        hf->AddFrame(numberEntry, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 2, 0, 10, 10));
    396385        this->Connect("EventChanged(Int_t)","TGNumberEntry",numberEntry,"SetIntNumber(Long_t)");
     
    405394     vf->AddFrame(hf, new TGLayoutHints(kLHintsExpandX , 2, 2, 2, 2));
    406395
    407      TGHProgressBar *progress = new TGHProgressBar(frmMain, TGProgressBar::kFancy, 100);
     396     TGHProgressBar* progress = new TGHProgressBar(frmMain, TGProgressBar::kFancy, 100);
    408397     progress->SetMax( treeReader_->GetEntries());
    409398     progress->ShowPosition(kTRUE, kFALSE, "Event %.0f");
     
    429418   // the summary tab
    430419   htmlSummary_ = new DelphesHtmlSummary("Delphes Event Display Summary Table");
    431    TEveWindowSlot *slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
     420   TEveWindowSlot* slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
    432421   gHtml_ = new TGHtml(0, 100, 100);
    433422   TEveWindowFrame *wf = slot->MakeFrame(gHtml_);
     
    437426   // plot tab
    438427   slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
    439    TEveWindowTab *tab = slot->MakeTab();
     428   TEveWindowTab* tab = slot->MakeTab();
    440429   tab->SetElementName("Summary plots");
    441430   tab->SetShowTitleBar(kFALSE);
     
    446435}
    447436
    448 void DelphesEventDisplay::Fwd() { 
    449   if (event_id_ < treeReader_->GetEntries() - 2) {
    450      EventChanged(event_id_+1);
    451   } else {
    452      printf("Already at last event.\n");
    453   }
    454 }
    455 
    456 void DelphesEventDisplay::Bck() {
    457   if (event_id_ > 0) {
    458      EventChanged(event_id_-1);
    459   } else {
    460      printf("Already at first event.\n");
    461   }
    462 }
    463 
    464 void DelphesEventDisplay::PreSetEv(char *ev) {
    465   event_id_tmp_ = Int_t(atoi(ev));
    466 }
    467 
    468 void DelphesEventDisplay::GoTo() {
    469   if (event_id_tmp_>=0 && event_id_tmp_ < treeReader_->GetEntries()-1) {
    470     EventChanged(event_id_tmp_);
    471   } else {
    472     printf("Error: no such event.\n");
    473   }
    474 }
    475 
    476 void DelphesEventDisplay::InitSummaryPlots() {
    477   plotSummary_->FillSample(treeReader_, event_id_);
    478   plotSummary_->FillEvent();
    479   plotSummary_->Draw();
    480 }
    481 
    482 void DelphesEventDisplay::DisplayProgress(Int_t p) {
    483   fStatusBar_->SetText(Form("Processing... %d %%",p), 1);
    484   gSystem->ProcessEvents();
    485 }
     437
  • display/DelphesEventDisplay.h

    rd38348d r1d9974e  
    11/*
    2   * Delphes: a framework for fast simulation of a generic collider experiment
    3   * Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
     2 * Delphes: a framework for fast simulation of a generic collider experiment
     3 * Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
    44 *
    5   * This program is free software: you can redistribute it and/or modify
    6   * it under the terms of the GNU General Public License as published by
    7   * the Free Software Foundation, either version 3 of the License, or
    8   * (at your option) any later version.
     5 * This program is free software: you can redistribute it and/or modify
     6 * it under the terms of the GNU General Public License as published by
     7 * the Free Software Foundation, either version 3 of the License, or
     8 * (at your option) any later version.
    99 *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
     10 * This program is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 * GNU General Public License for more details.
    1414 *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15 * You should have received a copy of the GNU General Public License
     16 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1717 */
    1818
     
    2121
    2222#include <vector>
     23#include <iostream>
     24#include "external/ExRootAnalysis/ExRootTreeReader.h"
     25#include "display/DelphesDisplay.h"
     26#include "display/Delphes3DGeometry.h"
     27#include "display/DelphesHtmlSummary.h"
     28#include "display/DelphesPlotSummary.h"
     29#include "TSystem.h"
     30#include "TChain.h"
     31#include "TAxis.h"
     32#include "TGHtml.h"
     33#include "TClonesArray.h"
     34#include "TGStatusBar.h"
     35#include "TGNumberEntry.h"
     36#include "TGProgressBar.h"
     37#include <RQ_OBJECT.h>
    2338
    24 #include "Rtypes.h"
    25 #include "RQ_OBJECT.h"
    2639
    27 class TAxis;
    28 class TChain;
    29 class TGHtml;
    30 class TGStatusBar;
    31 class DelphesDisplay;
    32 class Delphes3DGeometry;
    33 class DelphesBranchBase;
    34 class DelphesHtmlSummary;
    35 class DelphesPlotSummary;
    36 class ExRootTreeReader;
    3740
    3841/*
    39   *assembly.C: sauvegarde as shape-extract -> implement in the geometry class (read/write)
    40   *histobrowser.C: intégration d'histogrammes dans le display (on pourrait avoir Pt, eta, phi pour les principales collections)
    41   *also from alice_esd: summary html table
    42   *
     42 * assembly.C: sauvegarde as shape-extract -> implement in the geometry class (read/write)
     43 * histobrowser.C: intégration d'histogrammes dans le display (on pourrait avoir Pt, eta, phi pour les principales collections)
     44 * also from alice_esd: summary html table
     45 *
    4346 */
    4447
     
    5659    void make_gui();
    5760    void load_event();
    58     void readConfig(const char *configFile, std::vector<DelphesBranchBase *>& elements);
     61    void readConfig(const char *configFile, std::vector<DelphesBranchBase*>& elements);
    5962
    6063    // Configuration and global variables.
     
    6467    Double_t tkRadius_, totRadius_, tkHalfLength_, muHalfLength_, bz_;
    6568    TAxis *etaAxis_, *phiAxis_;
    66     TChain *chain_;
    67     std::vector<DelphesBranchBase *> elements_;
     69    TChain* chain_;
     70    std::vector<DelphesBranchBase*> elements_;
    6871    DelphesDisplay *delphesDisplay_;
    6972    DelphesHtmlSummary *htmlSummary_;
    7073    TGHtml *gHtml_;
    7174    DelphesPlotSummary *plotSummary_;
    72     TGStatusBar *fStatusBar_;
     75    TGStatusBar* fStatusBar_;
    7376   
    7477    // gui controls
    7578  public:
    76      void Fwd();
     79     void Fwd() { 
     80        if (event_id_ < treeReader_->GetEntries() - 2) {
     81           EventChanged(event_id_+1);
     82        } else {
     83           printf("Already at last event.\n");
     84        }
     85     }
    7786
    78      void Bck();
     87     void Bck() {
     88        if (event_id_ > 0) {
     89           EventChanged(event_id_-1);
     90        } else {
     91           printf("Already at first event.\n");
     92        }
     93     }
    7994
    80     void PreSetEv(char *ev);
     95    void PreSetEv(char* ev) {
     96      event_id_tmp_ = Int_t(atoi(ev));
     97    }
    8198
    82     void GoTo();
     99    void GoTo() {
     100      if (event_id_tmp_>=0 && event_id_tmp_ < treeReader_->GetEntries()-1) {
     101        EventChanged(event_id_tmp_);
     102      } else {
     103        printf("Error: no such event.\n");
     104      }
     105    }
    83106
    84     void InitSummaryPlots();
     107    void InitSummaryPlots() {
     108      plotSummary_->FillSample(treeReader_, event_id_);
     109      plotSummary_->FillEvent();
     110      plotSummary_->Draw();
     111    }
    85112
    86     void DisplayProgress(Int_t p);
     113    void DisplayProgress(Int_t p) {
     114         fStatusBar_->SetText(Form("Processing... %d %%",p), 1);
     115         gSystem->ProcessEvents();
     116    }
    87117};
    88118
  • examples/EventDisplay.C

    rd38348d r1d9974e  
    33 * root -l examples/EventDisplay.C'("cards/delphes_card_FCC_basic.tcl","delphes_output.root","ParticlePropagator","ChargedHadronTrackingEfficiency","MuonTrackingEfficiency","Ecal,Hcal")'
    44 */
    5 
    6 #ifdef __CLING__
    7 R__LOAD_LIBRARY(libEve)
    8 R__LOAD_LIBRARY(libDelphesDisplay)
    9 #include "display/DelphesEventDisplay.h"
    10 #include "display/Delphes3DGeometry.h"
    11 #endif
    125
    136void EventDisplay(const char *configfile = "delphes_card_CMS.tcl",
     
    4033
    4134    // create the application
    42     DelphesEventDisplay *display = new DelphesEventDisplay(configfile, datafile, det3D);
     35    DelphesEventDisplay* display = new DelphesEventDisplay(configfile, datafile, det3D);
    4336  }
    4437}
  • examples/Example1.C

    rd38348d r1d9974e  
    66root -l examples/Example1.C'("delphes_output.root")'
    77*/
    8 
    9 #ifdef __CLING__
    10 R__LOAD_LIBRARY(libDelphes)
    11 #include "classes/DelphesClasses.h"
    12 #include "external/ExRootAnalysis/ExRootTreeReader.h"
    13 #endif
    148
    159//------------------------------------------------------------------------------
  • examples/Example2.C

    rd38348d r1d9974e  
    88#include "TH1.h"
    99#include "TSystem.h"
    10 
    11 #ifdef __CLING__
    12 R__LOAD_LIBRARY(libDelphes)
    13 #include "classes/DelphesClasses.h"
    14 #include "external/ExRootAnalysis/ExRootTreeReader.h"
    15 #include "external/ExRootAnalysis/ExRootResult.h"
    16 #endif
    1710
    1811//------------------------------------------------------------------------------
  • examples/Example3.C

    rd38348d r1d9974e  
    66*/
    77
    8 #ifdef __CLING__
    9 R__LOAD_LIBRARY(libDelphes)
    10 #include "classes/DelphesClasses.h"
    11 #include "external/ExRootAnalysis/ExRootTreeReader.h"
    12 #include "external/ExRootAnalysis/ExRootResult.h"
    13 #else
    14 class ExRootTreeReader;
    15 class ExRootResult;
    16 #endif
    17 
    188//------------------------------------------------------------------------------
    199
     
    3525  TH1 *fJetDeltaPT;
    3626};
     27
     28//------------------------------------------------------------------------------
     29
     30class ExRootResult;
     31class ExRootTreeReader;
    3732
    3833//------------------------------------------------------------------------------
  • examples/Example4.C

    rd38348d r1d9974e  
    11/*
     2
    23This macro shows how to compute jet energy scale.
    34root -l examples/Example4.C'("delphes_output.root", "plots.root")'
    45
    5 The output ROOT file contains the pT(MC)/pT(Reco) distributions for
    6 various pT(Reco) and |eta| bins. The peak value of such distribution is
    7 interpreted as the jet energy correction to be applied for that
    8 given pT(Reco), |eta| bin.
    9 
    10 This can be done by modifying the "ScaleFormula" input parameter to
    11 the JetEnergyScale module in the delphes_card_XXX.tcl
     6The output ROOT file contains the pT(MC)/pT(Reco) distributions for various pT(Reco) and |eta| bins.
     7The peak value of such distribution is interpreted as the jet energy correction to be applied for that given pT(Reco), |eta| bin.
     8
     9This can be done by modifying the "ScaleFormula" input parameter to the JetEnergyScale module in the delphes_card_XXX.tcl
     10
     11
    1212
    1313e.g  a smooth function:
    1414
    15   set ScaleFormula { sqrt(3.0 - 0.1*(abs(eta)))^2 / pt + 1.0) }
     15
     16  set ScaleFormula { sqrt(3.0 - 0.1*(abs(eta)))^2 / pt + 1.0 ) }
     17
    1618
    1719or a binned function:
     20
    1821
    1922  set ScaleFormula {(abs(eta) > 0.0 && abs(eta) <= 2.5) * (pt > 20.0 && pt <= 50.0)  * (1.10) +
     
    2427                    (abs(eta) > 2.5 && abs(eta) <= 5.0) * (pt > 100.0)               * (1.00)}
    2528
    26 Be aware that a binned jet energy scale can produce "steps" in the corrected
    27 jet pt distribution ...
     29
     30Be aware that a binned jet energy scale can produce "steps" in the corrected jet pt distribution ...
     31
     32
     33
    2834*/
    29 
    30 #ifdef __CLING__
    31 R__LOAD_LIBRARY(libDelphes)
    32 #include "classes/DelphesClasses.h"
    33 #include "external/ExRootAnalysis/ExRootTreeReader.h"
    34 #include "external/ExRootAnalysis/ExRootResult.h"
    35 #else
    36 class ExRootTreeReader;
    37 class ExRootResult;
    38 #endif
    3935
    4036//------------------------------------------------------------------------------
     
    165161
    166162  Jet *jet, *genjet;
    167   GenParticle *particle;
     163  GenParticle *part;
    168164  TObject *object;
    169165
    170   TLorentzVector jetMomentum, genJetMomentum, bestGenJetMomentum;
    171 
    172   Float_t deltaR;
     166  TLorentzVector JetMom, GenJetMom, BestGenJetMom;
     167
     168  Float_t Dr;
    173169  Float_t pt, eta;
    174170  Long64_t entry;
     
    181177    // Load selected branches with data from specified event
    182178    treeReader->ReadEntry(entry);
     179    //  cout<<"--  New event -- "<<endl;
    183180
    184181    if(entry%500 == 0) cout << "Event number: "<< entry <<endl;
     
    189186
    190187      jet = (Jet*) branchJet->At(i);
    191       jetMomentum = jet->P4();
    192 
    193       plots->fJetPT->Fill(jetMomentum.Pt());
    194 
    195       deltaR = 999;
     188      JetMom = jet-> P4();
     189
     190      plots->fJetPT->Fill(JetMom.Pt());
     191
     192      Dr = 999;
    196193
    197194     // Loop over all hard partons in event
    198195     for(j = 0; j < branchParticle->GetEntriesFast(); ++j)
    199196     {
    200         particle = (GenParticle*) branchParticle->At(j);
    201 
    202         genJetMomentum = particle->P4();
    203 
    204         // this is simply to avoid warnings from initial state particle
    205         // having infite rapidity ...
    206         if(genJetMomentum.Px() == 0 && genJetMomentum.Py() == 0) continue;
    207 
    208         // take the closest parton candidate
    209         if(genJetMomentum.DeltaR(jetMomentum) < deltaR)
     197
     198        part = (GenParticle*) branchParticle->At(j);
     199
     200        GenJetMom = part -> P4();
     201
     202        //this is simply to avoid warnings from initial state particle having infite rapidity ...
     203        if(GenJetMom.Px() == 0 && GenJetMom.Py() == 0) continue;
     204
     205        //take the closest parton candidate
     206        if( GenJetMom.DeltaR(JetMom) < Dr )
    210207        {
    211            deltaR = genJetMomentum.DeltaR(jetMomentum);
    212            bestGenJetMomentum = genJetMomentum;
     208           Dr = GenJetMom.DeltaR(JetMom);
     209           BestGenJetMom = GenJetMom;
    213210        }
     211
    214212      }
    215213
    216       if(deltaR < 0.3)
    217       {
    218         pt  = jetMomentum.Pt();
    219         eta = TMath::Abs(jetMomentum.Eta());
    220 
    221 
    222         if(pt > 20.0 && pt < 50.0 && eta > 0.0 && eta < 2.5) plots -> fJetRes_Pt_20_50_Eta_0_25->Fill(bestGenJetMomentum.Pt()/jetMomentum.Pt());
    223         if(pt > 20.0 && pt < 50.0 && eta > 2.5 && eta < 5.0) plots -> fJetRes_Pt_20_50_Eta_25_5->Fill(bestGenJetMomentum.Pt()/jetMomentum.Pt());
    224 
    225         if(pt > 50.0 && pt < 100.0 && eta > 0.0 && eta < 2.5) plots -> fJetRes_Pt_50_100_Eta_0_25->Fill(bestGenJetMomentum.Pt()/jetMomentum.Pt());
    226         if(pt > 50.0 && pt < 100.0 && eta > 2.5 && eta < 5.0) plots -> fJetRes_Pt_50_100_Eta_25_5->Fill(bestGenJetMomentum.Pt()/jetMomentum.Pt());
    227 
    228         if(pt > 100.0 && pt < 200.0 && eta > 0.0 && eta < 2.5) plots -> fJetRes_Pt_100_200_Eta_0_25->Fill(bestGenJetMomentum.Pt()/jetMomentum.Pt());
    229         if(pt > 100.0 && pt < 200.0 && eta > 2.5 && eta < 5.0) plots -> fJetRes_Pt_100_200_Eta_25_5->Fill(bestGenJetMomentum.Pt()/jetMomentum.Pt());
    230 
    231         if(pt > 200.0 && pt < 500.0 && eta > 0.0 && eta < 2.5) plots -> fJetRes_Pt_200_500_Eta_0_25->Fill(bestGenJetMomentum.Pt()/jetMomentum.Pt());
    232         if(pt > 200.0 && pt < 500.0 && eta > 2.5 && eta < 5.0) plots -> fJetRes_Pt_200_500_Eta_25_5->Fill(bestGenJetMomentum.Pt()/jetMomentum.Pt());
    233 
    234         if(pt > 500.0               && eta > 0.0 && eta < 2.5) plots -> fJetRes_Pt_500_inf_Eta_0_25->Fill(bestGenJetMomentum.Pt()/jetMomentum.Pt());
    235         if(pt > 500.0               && eta > 2.5 && eta < 5.0) plots -> fJetRes_Pt_500_inf_Eta_25_5->Fill(bestGenJetMomentum.Pt()/jetMomentum.Pt());
    236 
    237       }
     214     if(Dr < 0.3)
     215     {
     216       pt  = JetMom.Pt();
     217       eta = TMath::Abs(JetMom.Eta());
     218
     219
     220       if( pt > 20.0 && pt < 50.0 && eta > 0.0 && eta < 2.5 ) plots -> fJetRes_Pt_20_50_Eta_0_25->Fill(BestGenJetMom.Pt()/JetMom.Pt());
     221       if( pt > 20.0 && pt < 50.0 && eta > 2.5 && eta < 5.0 ) plots -> fJetRes_Pt_20_50_Eta_25_5->Fill(BestGenJetMom.Pt()/JetMom.Pt());
     222
     223       if( pt > 50.0 && pt < 100.0 && eta > 0.0 && eta < 2.5 ) plots -> fJetRes_Pt_50_100_Eta_0_25->Fill(BestGenJetMom.Pt()/JetMom.Pt());
     224       if( pt > 50.0 && pt < 100.0 && eta > 2.5 && eta < 5.0 ) plots -> fJetRes_Pt_50_100_Eta_25_5->Fill(BestGenJetMom.Pt()/JetMom.Pt());
     225
     226       if( pt > 100.0 && pt < 200.0 && eta > 0.0 && eta < 2.5 ) plots -> fJetRes_Pt_100_200_Eta_0_25->Fill(BestGenJetMom.Pt()/JetMom.Pt());
     227       if( pt > 100.0 && pt < 200.0 && eta > 2.5 && eta < 5.0 ) plots -> fJetRes_Pt_100_200_Eta_25_5->Fill(BestGenJetMom.Pt()/JetMom.Pt());
     228
     229       if( pt > 200.0 && pt < 500.0 && eta > 0.0 && eta < 2.5 ) plots -> fJetRes_Pt_200_500_Eta_0_25->Fill(BestGenJetMom.Pt()/JetMom.Pt());
     230       if( pt > 200.0 && pt < 500.0 && eta > 2.5 && eta < 5.0 ) plots -> fJetRes_Pt_200_500_Eta_25_5->Fill(BestGenJetMom.Pt()/JetMom.Pt());
     231
     232       if( pt > 500.0               && eta > 0.0 && eta < 2.5 ) plots -> fJetRes_Pt_500_inf_Eta_0_25->Fill(BestGenJetMom.Pt()/JetMom.Pt());
     233       if( pt > 500.0               && eta > 2.5 && eta < 5.0 ) plots -> fJetRes_Pt_500_inf_Eta_25_5->Fill(BestGenJetMom.Pt()/JetMom.Pt());
     234
     235
     236     }
     237
     238
    238239    }
    239240  }
    240241}
     242
    241243
    242244//------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.