FairRoot/PandaRoot
Functions | Variables
Modify_root_geometry.C File Reference
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include "TGeoManager.h"

Go to the source code of this file.

Functions

bool Load_Geometry ()
 
void Get_List_of_Sensors (vector< string > &list_of_sensors, bool all_nodes=false, bool first_call=true)
 
bool Set_matrix (string path, TGeoHMatrix *matrix, string uniquename, int uniqueID)
 
int Modify_root_geometry ()
 

Variables

const string filename = "/home/jasinski/bin/pandaroot/geometry/Luminosity-Detector.root"
 

Function Documentation

void Get_List_of_Sensors ( vector< string > &  list_of_sensors,
bool  all_nodes = false,
bool  first_call = true 
)

Definition at line 36 of file Modify_root_geometry.C.

References gGeoManager, and i.

Referenced by Modify_root_geometry().

36  {
37  if (first_call){
38  gGeoManager->CdTop();
39  first_call = false;
40  }
41  //cout << gGeoManager->GetPath() << " ";
42  string nodename(gGeoManager->GetCurrentNavigator()->GetCurrentNode()->GetName());
43  //cout << "current node is " << nodename << endl;
44  //if (nodename.compare(0, volumename_without_copynumber.size(), volumename_without_copynumber) == 0){ <<< here you can compare to a specific name in the volume to be selective to it
45  int nnodes = gGeoManager->GetCurrentNode()->GetNdaughters();
46  if (nnodes == 0 || all_nodes){ // a leave is reached when no daughter volumes are accessible anymore
47  //cout << " found a sensor " << nav_paths[7] << endl;
48  list_of_sensors.push_back(gGeoManager->GetPath());
49  }
50  for (int i = 0; i < nnodes; i++){
51  //cout << " navigating into node " << i << endl;
52  gGeoManager->CdDown(i);
53  Get_List_of_Sensors(list_of_sensors, all_nodes, first_call);
54  //if (nodename == nav_paths[1] || found_lmd){ <<< this is lmd search specific and not part of this spinout
55  // cout << " found the lmd node! Aborting recursive search. " << endl;
56  // gGeoManager->CdUp();
57  // break;
58  //}
59  gGeoManager->CdUp();
60  }
61  //if (nodename.compare(0, nav_paths[0].size(), nav_paths[0]) == 0){
62  // result = gGeoManager->GetPath();
63  // cout << " top volume is " << result << endl;
64  //}
65 }
Int_t i
Definition: run_full.C:25
void Get_List_of_Sensors(vector< string > &list_of_sensors, bool all_nodes=false, bool first_call=true)
TGeoManager * gGeoManager
bool Load_Geometry ( )

Definition at line 27 of file Modify_root_geometry.C.

References filename.

Referenced by Modify_root_geometry().

27  {
28  TGeoManager::Import(filename.c_str());
29  //gGeoManager->Draw("ogl"); <- keeps breaking when not done within the context of PandaROOT
30  return true;
31 }
const string filename
int Modify_root_geometry ( )

Definition at line 135 of file Modify_root_geometry.C.

References Get_List_of_Sensors(), and Load_Geometry().

135  {
136  Load_Geometry();
137  vector <string> list_of_sensors;
138  Get_List_of_Sensors(list_of_sensors, false);
139  int uID = 0;
140  for (int inode = 0; inode = list_of_sensors.size(); inode++){
141  cout << list_of_sensors[inode] << endl;
142  stringstream uname;
143 
144  }
145  return 0;
146 }
void Get_List_of_Sensors(vector< string > &list_of_sensors, bool all_nodes=false, bool first_call=true)
bool Load_Geometry()
bool Set_matrix ( string  path,
TGeoHMatrix *  matrix,
string  uniquename,
int  uniqueID 
)

Definition at line 106 of file Modify_root_geometry.C.

References gGeoManager.

106  {
107  if (!matrix) return false;
108  if (!gGeoManager->CheckPath(path.c_str())){
109  cout << " Error in PndLmdDim::Set_matrix: path " << path << " is not valid " << endl;
110  return false;
111  }
112  TGeoPNEntry *pne;
113  TGeoPhysicalNode *node;
114  pne = gGeoManager->GetAlignableEntry(uniquename.c_str());
115  if (!pne){
116  cout << " creating alignable entry for " << path << endl;
117  pne = gGeoManager->SetAlignableEntry(uniquename.c_str(), path.c_str(), uniqueID);
118  if (pne){
119  node = new TGeoPhysicalNode(path.c_str());
120  pne->SetPhysicalNode(node);
121  }
122  }
123  if (!pne) {
124  cout << " Error: no pn entry (alignable node) at " << path << " created " << endl;
125  return false;
126  }
127  node = pne->GetPhysicalNode();
128  if (!node) {
129  cout << " no node found for pn entry (alignable node) at " << path << endl;
130  return false;
131  }
132  return node->Align(matrix);
133 }
TGeoManager * gGeoManager

Variable Documentation

const string filename = "/home/jasinski/bin/pandaroot/geometry/Luminosity-Detector.root"