Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
#include <ROOT/REveGeoTopNode.hxx>
#include <ROOT/REveGeoPolyShape.hxx>
#include <ROOT/REveManager.hxx>
#include "TFile.h"
#include <set>
#include <vector>
#include <iostream>
Include dependency graph for write_geo_extract.C:

Detailed Description

Helper script to create REveGeoShapeExtract fro TGeo geometry One can rely on GeoTable to access paths.

using namespace ROOT::Experimental;
REveGeoShape *makeShape(const std::string &targetPath, const char* name)
{
// for the moment top node is tracker at the startup
TGeoNode *currentNode;
while ((currentNode = next())) {
next.GetPath(currentPath); // Retrieves the full hierarchy path
// std::cout << "compare" << currentPath << "\n";
// Found the node via path matching
printf("Node found: %s\n", currentNode->GetName());
break;
}
}
const TGeoMatrix *mat = next.GetCurrentMatrix();
const Double_t *t = mat->GetTranslation(); // size 3
const Double_t *r = mat->GetRotationMatrix(); // size 9 (3x3)
Double_t m[16];
if (mat->IsScale()) {
const Double_t *s = mat->GetScale();
m[0] = r[0] * s[0];
m[1] = r[3] * s[0];
m[2] = r[6] * s[0];
m[3] = 0;
m[4] = r[1] * s[1];
m[5] = r[4] * s[1];
m[6] = r[7] * s[1];
m[7] = 0;
m[8] = r[2] * s[2];
m[9] = r[5] * s[2];
m[10] = r[8] * s[2];
m[11] = 0;
m[12] = t[0];
m[13] = t[1];
m[14] = t[2];
m[15] = 1;
} else {
m[0] = r[0];
m[1] = r[3];
m[2] = r[6];
m[3] = 0;
m[4] = r[1];
m[5] = r[4];
m[6] = r[7];
m[7] = 0;
m[8] = r[2];
m[9] = r[5];
m[10] = r[8];
m[11] = 0;
m[12] = t[0];
m[13] = t[1];
m[14] = t[2];
m[15] = 1;
}
TGeoShape *shape = currentNode->GetVolume()->GetShape();
shape->SetName(name);
rgs->SetShape(shape);
rgs->InitMainTrans();
rgs->RefMainTrans().SetFrom(m);
return rgs;
}
{
auto eveMng = REveManager::Create();
// eveMng->AllowMultipleRemoteConnections(false, false);
auto s_geoManager = TGeoManager::Import("http://xrd-cache-1.t2.ucsd.edu/alja/mail/geo/cmsSimGeo2026.root");
// tracker wrapper
REveGeoShape *tracker = makeShape("cms:OCMS/tracker:Tracker_1/otst:supportR1190Z1450_1", "tracker");
tracker->SetMainColor(kRed);
tracker->SetMainTransparency(50);
// tracker barrel
makeShape("cms:OCMS/tracker:Tracker_1/pixbar:Phase2OTBarrel_1/tracker:supportR212Z604_1", "barrel");
tracker->AddElement(barrel);
// front and back endcaps
REveGeoShape *e1 = makeShape("cms:OCMS/tracker:Tracker_1/pixfwd:Phase2OTForward_1", "endcap_1");
tracker->AddElement(e1);
REveGeoShape *e2 = makeShape("cms:OCMS/tracker:Tracker_1/pixfwd:Phase2OTForward_2", "endcap_2");
tracker->AddElement(e2);
// save extract on top element
tracker->SaveExtract("testShapeExtract.root", "VSDGeo");
}
double Double_t
Double 8 bytes.
Definition RtypesCore.h:74
@ kRed
Definition Rtypes.h:67
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
char name[80]
Definition TGX11.cxx:148
R__EXTERN TGeoManager * gGeoManager
Wrapper for TGeoShape with absolute positioning and color attributes allowing display of extracted TG...
virtual void AddElement(REveElement *el)
Add el to the list of children.
REveScene * GetEventScene() const
void Show(const RWebDisplayArgs &args="")
Show eve manager in specified browser.
static Bool_t SetCacheFileDir(std::string_view cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Sets the directory where to locally stage/cache remote files.
Definition TFile.cxx:4338
A geometry iterator.
Definition TGeoNode.h:249
static TGeoManager * Import(const char *filename, const char *name="", Option_t *option="")
static function Import a geometry from a gdml or ROOT file
TGeoVolume * GetTopVolume() const
Geometrical transformation package.
Definition TGeoMatrix.h:39
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:39
TGeoVolume * GetVolume() const
Definition TGeoNode.h:100
Base abstract class for all shapes.
Definition TGeoShape.h:25
TGeoShape * GetShape() const
Definition TGeoVolume.h:191
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
Basic string class.
Definition TString.h:138
ROOT::Experimental::REveManager * eveMng
Namespace for ROOT features in testing.
Definition TROOT.h:100
TMarker m
Definition textangle.C:8
Author
Alja Mrak Tadel

Definition in file write_geo_extract.C.