Skip to content
Snippets Groups Projects
Commit e00ca011 authored by Eoin Clerkin's avatar Eoin Clerkin
Browse files

Provide GDML to ROOT macro

parent 75900671
No related branches found
No related tags found
1 merge request!1338CAD conversion tools and procedure
/* Copyright (C) 2023 Facility for AntiProton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Eoin Clerkin [committer] */
/* Macro converts a gdml script to root binary */
#include "TROOT.h"
#include "TSystem.h"
#include "TGeoVolume.h"
//#include "TGeoVolumeAssembly.h"
#include "TGeoManager.h"
#include "TGeoSystemOfUnits.h"
#include "TGeoTube.h"
#include "TFile.h"
#include "TGeoCompositeShape.h"
#include "TGeoMaterial.h"
#include "TGeoMatrix.h"
#include "TGeoMedium.h"
#include "TGeoPgon.h"
#include "TList.h"
#include "TROOT.h"
#include "TString.h"
#include "TSystem.h"
#include <iostream>
#include <sstream>
#include <strings.h>
void make_TGeoVolumeAssembly(const char* gdml_file){
char vol_file[200];
char basename[200];
strcpy(basename,gdml_file);
char* c = strstr(basename,".gdml");
*c='\0';
strcpy(vol_file,gdml_file);
strcpy(strstr(vol_file,".gdml"),".root");
TGeoManager::Import(gdml_file);
TGeoVolumeAssembly* top = (TGeoVolumeAssembly *) gGeoManager->GetTopVolume();
TFile* output_file = TFile::Open(vol_file,"RECREATE");
top->Write();
output_file->Close();
printf("Successfully completed. \n");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment