Fork me on GitHub

Changeset c4d879d in git for examples/geometry.C


Ignore:
Timestamp:
Oct 11, 2014, 10:54:58 AM (10 years ago)
Author:
Christophe Delaere <christophe.delaere@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
b4cd1e7
Parents:
493aa9b
Message:

Small cleaning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/geometry.C

    r493aa9b rc4d879d  
    4242
    4343/*
    44  * alice_esd.C : GUI complete
    4544 * assembly.C: sauvegarde as shape-extract -> implement in the geometry class (read/write)
    4645 * histobrowser.C: intégration d'histogrammes dans le display (on pourrait avoir Pt, eta, phi pour les principales collections)
     
    157156   TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
    158157   TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7); // placeholder
     158   //TODO: create different materials for different subdetectors???
    159159   matVacuum->SetTransparency(85); //TODO: tune
    160160   matAl->SetTransparency(85); //TODO: tune
     
    474474/******************************************************************************/
    475475
    476 void delphes_event_display(const char *configFile, const char *inputFile)
     476void delphes_event_display(const char *configFile, const char *inputFile, const Delphes3DGeometry& det3D)
    477477{
    478    // to be the main function...
    479478
    480479   // initialize the application
    481    gSystem->Load("../libDelphesDisplay");
    482    TGeoManager *geom = new TGeoManager("delphes", "Delphes geometry");
    483480   TEveManager::Create(kTRUE, "IV");
     481   TGeoManager* geom = gGeoManager;
    484482
    485483   // build the detector
    486    Delphes3DGeometry det3D;
    487    //det3D.readFile(configFile,ParticlePropagator, TrackingEfficiency, MuonEfficiency, Calorimeters);
    488    det3D.readFile(configFile);//TODO fix this
    489    //top->AddNode(det3D.getDetector(true),1);
    490484   gRadius = det3D.getTrackerRadius();
    491485   gHalfLength = det3D.getTrackerHalfLength();
     
    494488   gPhiAxis = det3D.getCaloAxes().second;
    495489
    496 
    497 /*
    498    // make the top container volume -> designed to contain a "big" detector (ATLAS)
    499    TGeoVolume *top = geom->MakeBox("TOP", 0, 1500, 1500, 2300);
    500    geom->SetTopVolume(top);
    501 
    502    // build the detector
    503    top->AddNode(det3D.getDetector(true),1);
    504    geom->CloseGeometry();
    505 
    506    gGeoManager->DefaultColors();
    507 
    508    TGeoVolume* top = gGeoManager->GetTopVolume()->FindNode("Delphes3DGeometry_1")->GetVolume();
    509 
    510    TEveGeoTopNode* trk = new TEveGeoTopNode(gGeoManager, top->FindNode("tracker_1"));
    511    trk->SetVisLevel(6);
    512    gEve->AddGlobalElement(trk);
    513 
    514    TEveGeoTopNode* calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_barrel_1"));
    515    calo->SetVisLevel(3);
    516    gEve->AddGlobalElement(calo);
    517    calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_endcap_1"));
    518    calo->SetVisLevel(3);
    519    calo->UseNodeTrans();
    520    gEve->AddGlobalElement(calo);
    521    calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_endcap_2"));
    522    calo->SetVisLevel(3);
    523    calo->UseNodeTrans();
    524    gEve->AddGlobalElement(calo);
    525 
    526    TEveGeoTopNode* muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_barrel_1"));
    527    muon->SetVisLevel(4);
    528    gEve->AddGlobalElement(muon);
    529    muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_endcap_1"));
    530    muon->SetVisLevel(4);
    531    muon->UseNodeTrans();
    532    gEve->AddGlobalElement(muon);
    533    muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_endcap_2"));
    534    muon->SetVisLevel(4);
    535    muon->UseNodeTrans();
    536    gEve->AddGlobalElement(muon);
    537 
    538 */
    539 
    540 
    541    //TGeoVolume* top = gGeoManager->GetTopVolume()->FindNode("Delphes3DGeometry_1")->GetVolume();
    542    //TGeoVolume* top = det3D.getDetector(true);
    543490   TGeoVolume* top = det3D.getDetector(false); //TODO: can this be set in the GUI?
    544491   geom->SetTopVolume(top);
     
    840787{
    841788
    842 
     789   // load the libraries
    843790   gSystem->Load("libGeom");
    844791   gSystem->Load("../libDelphes");
    845 
    846    delphes_event_display("delphes_card_CMS.tcl", "../delphes_output.root"); //TODO propagate parameters
     792   gSystem->Load("../libDelphesDisplay");
     793
     794   // create the detector representation
     795   Delphes3DGeometry det3D(new TGeoManager("delphes", "Delphes geometry"));
     796   det3D.readFile(filename, ParticlePropagator, TrackingEfficiency, MuonEfficiency, Calorimeters);
     797
     798   // create the application items
     799   delphes_event_display("delphes_card_CMS.tcl", "../delphes_output.root", det3D);
    847800   make_gui();
    848801   load_event();
     
    861814   v->DoDraw();
    862815
    863 /*
    864    TGeoManager *geom = new TGeoManager("delphes", "Delphes geometry");
    865 
    866    // make the top container volume -> designed to contain a "big" detector (ATLAS)
    867    TGeoVolume *top = geom->MakeBox("TOP", 0, 1500, 1500, 2300);
    868    geom->SetTopVolume(top);
    869 
    870    // build the detector
    871    Delphes3DGeometry det3D;
    872    det3D.readFile(filename,ParticlePropagator, TrackingEfficiency, MuonEfficiency, Calorimeters);
    873    top->AddNode(det3D.getDetector(true),1);
    874 
    875    // draw it
    876    geom->CloseGeometry();
    877    //top->Draw();
    878    //TFile* file = new TFile("DelpheGeom.root","RECREATE");
    879    //top->Write("DelphesGeometry");
    880    //file->Close();
    881 
    882    TEveManager::Create(kTRUE, "IV");
    883 
    884 
    885    //TFile::SetCacheFileDir(".");
    886    //gGeoManager = gEve->GetGeometry("DelpheGeom.root");
    887    gGeoManager->DefaultColors();
    888 
    889    TGeoVolume* top = gGeoManager->GetTopVolume()->FindNode("Delphes3DGeometry_1")->GetVolume();
    890 
    891    TEveGeoTopNode* trk = new TEveGeoTopNode(gGeoManager, top->FindNode("tracker_1"));
    892    trk->SetVisLevel(6);
    893    gEve->AddGlobalElement(trk);
    894 
    895    TEveGeoTopNode* calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_barrel_1"));
    896    calo->SetVisLevel(3);
    897    gEve->AddGlobalElement(calo);
    898    calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_endcap_1"));
    899    calo->SetVisLevel(3);
    900    calo->UseNodeTrans();
    901    gEve->AddGlobalElement(calo);
    902    calo = new TEveGeoTopNode(gGeoManager, top->FindNode("Calorimeter_endcap_2"));
    903    calo->SetVisLevel(3);
    904    calo->UseNodeTrans();
    905    gEve->AddGlobalElement(calo);
    906 
    907    TEveGeoTopNode* muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_barrel_1"));
    908    muon->SetVisLevel(4);
    909    gEve->AddGlobalElement(muon);
    910    muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_endcap_1"));
    911    muon->SetVisLevel(4);
    912    muon->UseNodeTrans();
    913    gEve->AddGlobalElement(muon);
    914    muon = new TEveGeoTopNode(gGeoManager, top->FindNode("muons_endcap_2"));
    915    muon->SetVisLevel(4);
    916    muon->UseNodeTrans();
    917    gEve->AddGlobalElement(muon);
    918 
    919    gEve->FullRedraw3D(kTRUE);
    920 
    921    // EClipType not exported to CINT (see TGLUtil.h):
    922    // 0 - no clip, 1 - clip plane, 2 - clip box
    923    TGLViewer *v = gEve->GetDefaultGLViewer();
    924    v->GetClipSet()->SetClipType(1);
    925    v->ColorSet().Background().SetColor(kMagenta+4);
    926    v->SetGuideState(TGLUtil::kAxesEdge, kTRUE, kFALSE, 0);
    927    v->RefreshPadEditor(v);
    928 
    929    v->CurrentCamera().RotateRad(-1.2, 0.5);
    930    v->DoDraw();
    931 */
    932 }
    933 
     816}
     817
Note: See TracChangeset for help on using the changeset viewer.