Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches

Detailed Description

Shows CMS geometry.

#include <sstream>
#include <iostream>
#include "TGeoManager.h"
#include "TGeoVolume.h"
#include "TGeoMaterial.h"
#include "TGeoMatrix.h"
#include "TSystem.h"
#include "TFile.h"
namespace REX = ROOT::Experimental;
{
auto gss = n->GetVolume()->GetShape();
auto b1s = new REX::REveGeoShape(n->GetName());
b1s->InitMainTrans();
b1s->RefMainTrans().SetFrom(trans.Array());
b1s->SetShape(gss);
b1s->SetMainColor(kCyan);
holder->AddElement(b1s);
}
int level)
{
++level;
if (level > maxlevel)
return;
for (int i = 0; i < pn->GetNdaughters(); ++i) {
TGeoNode *n = pn->GetDaughter(i);
TGeoMaterial *material = n->GetVolume()->GetMaterial();
ctrans.SetFrom(trans.Array());
{
TGeoMatrix *gm = n->GetMatrix();
const Double_t *rm = gm->GetRotationMatrix();
const Double_t *tv = gm->GetTranslation();
t(1, 1) = rm[0];
t(1, 2) = rm[1];
t(1, 3) = rm[2];
t(2, 1) = rm[3];
t(2, 2) = rm[4];
t(2, 3) = rm[5];
t(3, 1) = rm[6];
t(3, 2) = rm[7];
t(3, 3) = rm[8];
t(1, 4) = tv[0];
t(2, 4) = tv[1];
t(3, 4) = tv[2];
ctrans *= t;
}
std::string mn = material->GetName();
if (mn == mat) {
n->ls();
}
}
}
TGeoNode *getNodeFromPath(TGeoNode *top, std::string path)
{
TGeoNode *node = top;
istringstream f(path);
string s;
while (getline(f, s, '/'))
node = node->GetVolume()->FindNode(s.c_str());
return node;
}
void geom_cms()
{
auto eveMng = REX::REveManager::Create();
auto geoManager = eveMng->GetGeometry("http://root.cern/files/cms.root");
TGeoNode *top = geoManager->GetTopVolume()->FindNode("CMSE_1");
// tracker
{
auto holder = new REX::REveElement("Tracker");
eveMng->GetGlobalScene()->AddElement(holder);
TGeoNode *n = getNodeFromPath(top, "TRAK_1/SVTX_1/TGBX_1/GAW1_1");
std::string material = "TOB_Silicon";
filterChildNodes(n, trans, holder, material, 6, 0);
}
// muon
{
auto holder = new REX::REveElement("MUON");
eveMng->GetGlobalScene()->AddElement(holder);
auto n = getNodeFromPath(top, "MUON_1/MB_1");
std::string material = "M_B_Air";
filterChildNodes(n, trans, holder, material, 1, 0);
auto bv = n->GetVolume();
for (int i = 1; i < 5; ++i) {
auto n = bv->FindNode(Form("MBXC_%d", i));
auto gss = n->GetVolume()->GetShape();
auto b1s = new REX::REveGeoShape(Form("Arc %d", i));
b1s->InitMainTrans();
const double *move = n->GetMatrix()->GetTranslation();
b1s->RefMainTrans().SetFrom(*(n->GetMatrix()));
b1s->SetShape(gss);
b1s->SetMainColor(kBlue);
holder->AddElement(b1s);
}
}
eveMng->Show();
}
#define f(i)
Definition RSha256.hxx:104
double Double_t
Double 8 bytes.
Definition RtypesCore.h:74
@ kCyan
Definition Rtypes.h:67
@ kBlue
Definition Rtypes.h:67
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2570
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
Base class describing materials.
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
TGeoNode * FindNode(const char *name) const
search a daughter inside the list of nodes
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const Int_t n
Definition legend1.C:16
Namespace for ROOT features in testing.
Definition TROOT.h:100
Author
Matevz Tadel

Definition in file geom_cms.C.