Fork me on GitHub

Changeset e0c1ff0 in git for examples/geometry.C


Ignore:
Timestamp:
Oct 9, 2014, 6:59:37 PM (10 years ago)
Author:
Christophe Delaere <christophe.delaere@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
493aa9b
Parents:
7513718
Message:

Mostly in place but crashing

Just debugged the obvious typos and other things. It compiles.
Still, crash at runtime in TGeoManager::SetTopVolume(TGeoVolume*)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/geometry.C

    r7513718 re0c1ff0  
    1414#include "TGeoCone.h"
    1515#include "TGeoArb8.h"
    16 //#include "../external/ExRootAnalysis/ExRootConfReader.h"
     16//#include "external/ExRootAnalysis/ExRootConfReader.h"
     17//#include "external/ExRootAnalysis/ExRootTreeReader.h"
     18//#include "display/DelphesCaloData.h"
     19//#include "display/DelphesDisplay.h"
     20//#include "classes/DelphesClasses.h"
    1721#include "TF2.h"
    1822#include "TH1F.h"
     23#include "TChain.h"
     24#include "TEveElement.h"
     25#include "TEveJetCone.h"
     26#include "TEveTrack.h"
     27#include "TEveTrackPropagator.h"
     28#include "TEveCalo.h"
    1929#include "TMath.h"
    2030#include "TSystem.h"
     31#include "TEveManager.h"
     32#include "TEveGeoNode.h"
     33#include "TEveTrans.h"
     34#include "TEveViewer.h"
     35#include "TEveBrowser.h"
     36#include "TRootBrowser.h"
     37#include "TGLViewer.h"
     38#include "TGButton.h"
     39#include "TCollection.h"
     40#include "TClonesArray.h"
     41#include "TGLClip.h"
    2142
    2243/*
     
    131152   //--- the geometry manager
    132153   geom_ = geom==NULL? gGeoManager : geom;
    133    gGeoManager->DefaultColors();
     154   //gGeoManager->DefaultColors();
    134155
    135156   //--- define some materials
     
    237258   set< pair<Double_t, Int_t> > caloBinning = caloBinning_[*calorimeters_.begin()];
    238259   Double_t *etaBins = new Double_t[caloBinning.size()]; // note that this is the eta binning of the first calo
    239    unsigned int i = 0;
     260   unsigned int ii = 0;
    240261   for(set< pair<Double_t, Int_t> >::const_iterator itEtaSet = caloBinning.begin(); itEtaSet != caloBinning.end(); ++itEtaSet) {
    241      etaBins[i++] = itEtaSet.first;
     262     etaBins[ii++] = itEtaSet->first;
    242263   }
    243264   etaAxis_ = new TAxis(caloBinning.size() - 1, etaBins);
     
    456477
    457478   // initialize the application
    458    gSystem->Load("libDelphesDisplay");
     479   gSystem->Load("../libDelphesDisplay");
     480   TGeoManager *geom = new TGeoManager("delphes", "Delphes geometry");
    459481   TEveManager::Create(kTRUE, "IV");
    460482
    461483   // build the detector
    462484   Delphes3DGeometry det3D;
    463    det3D.readFile(filename,ParticlePropagator, TrackingEfficiency, MuonEfficiency, Calorimeters);
     485   //det3D.readFile(configFile,ParticlePropagator, TrackingEfficiency, MuonEfficiency, Calorimeters);
     486   det3D.readFile(configFile);//TODO fix this
     487   //top->AddNode(det3D.getDetector(true),1);
    464488   gRadius = det3D.getTrackerRadius();
    465489   gHalfLength = det3D.getTrackerHalfLength();
     
    467491   gEtaAxis = det3D.getCaloAxes().first;
    468492   gPhiAxis = det3D.getCaloAxes().second;
    469    TGeoVolume* top = gGeoManager->GetTopVolume()->FindNode("Delphes3DGeometry_1")->GetVolume();
     493   //TGeoVolume* top = gGeoManager->GetTopVolume()->FindNode("Delphes3DGeometry_1")->GetVolume();
     494   TGeoVolume* top = det3D.getDetector(true);
    470495   TEveElementList *geometry = new TEveElementList("Geometry");
    471496   TEveGeoTopNode* trk = new TEveGeoTopNode(gGeoManager, top->FindNode("tracker_1"));
     
    494519   muon->UseNodeTrans();
    495520   geometry->AddElement(muon);
     521   gGeoManager->DefaultColors();
    496522
    497523   // Create chain of root trees
     
    555581   // viewers and scenes
    556582
    557    TEveCalo3D *calo = new TEveCalo3D(gCaloData);
    558    calo->SetBarrelRadius(gRadius*100.0);
    559    calo->SetEndCapPos(gHalfLength*100.0);
    560 
    561    gStyle->SetPalette(1, 0);
     583   TEveCalo3D *calo3d = new TEveCalo3D(gCaloData);
     584   calo3d->SetBarrelRadius(gRadius*100.0);
     585   calo3d->SetEndCapPos(gHalfLength*100.0);
     586
     587   //gStyle->SetPalette(1, 0);
    562588   TEveCaloLego *lego = new TEveCaloLego(gCaloData);
    563589   lego->InitMainTrans();
     
    568594   gDelphesDisplay = new DelphesDisplay;
    569595   gEve->AddGlobalElement(geometry);
    570    gEve->AddGlobalElement(calo);
     596   gEve->AddGlobalElement(calo3d);
    571597   gDelphesDisplay->ImportGeomRPhi(geometry);
    572    gDelphesDisplay->ImportCaloRPhi(calo);
     598   gDelphesDisplay->ImportCaloRPhi(calo3d);
    573599   gDelphesDisplay->ImportGeomRhoZ(geometry);
    574    gDelphesDisplay->ImportCaloRhoZ(calo);
     600   gDelphesDisplay->ImportCaloRhoZ(calo3d);
    575601   gDelphesDisplay->ImportCaloLego(lego);
    576602   gEve->Redraw3D(kTRUE);
     
    594620   delphes_read();
    595621
    596    TEveElement* top = gEve->GetCurrentEvent();
     622   TEveElement* top = (TEveElement*)gEve->GetCurrentEvent();
    597623   gDelphesDisplay->DestroyEventRPhi();
    598624   gDelphesDisplay->ImportEventRPhi(top);
     
    622648
    623649  TEveTrackPropagator *trkProp = gTrackList->GetPropagator();
    624   if(event >= gTreeReader->GetEntries()) return;
     650  if(event_id >= gTreeReader->GetEntries()) return;
    625651
    626652  // Load selected branches with data from specified event
     
    694720   void Fwd()
    695721   { 
    696       if (event_id < tree->GetEntries() - 1) {
     722      if (event_id < gTreeReader->GetEntries() - 1) {
    697723         ++event_id;
    698724         load_event();
     
    763789                                                             const char* Calorimeters="Calorimeter")
    764790{
     791
     792
    765793   gSystem->Load("libGeom");
    766794   gSystem->Load("../libDelphes");
     795   delphes_event_display("delphes_card_CMS.tcl", "../delphes_output.root"); //TODO propagate parameters
     796   return;
     797/*
    767798   TGeoManager *geom = new TGeoManager("delphes", "Delphes geometry");
    768799
     
    836867   // load_event();
    837868   // gEve->Redraw3D(kTRUE); // Reset camera after the first event has been shown.
    838 }
    839 
     869   */
     870}
     871
Note: See TracChangeset for help on using the changeset viewer.