FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndHypGeoHandling Class Reference

Class to access the naming information of the MVD. More...

#include <PndHypGeoHandling.h>

Public Member Functions

 PndHypGeoHandling ()
 
 PndHypGeoHandling (TString fileName)
 
 PndHypGeoHandling (TGeoManager *aGeoMan)
 
virtual ~PndHypGeoHandling ()
 
TString GetCurrentID ()
 returns the ID of the current node More...
 
TString GetID (TString path)
 for a given TGeoManager-path the ID is returned More...
 
TString GetPath (TString id)
 for a given ID the path is returned More...
 
TString GetVolumeID (TString name)
 returns the volume ID for a given volume name More...
 
std::vector< TStringGetNamesLevel (Int_t level, TString startPath="", bool fullPath=false)
 
void GetOUVPath (TString path, TVector3 &o, TVector3 &u, TVector3 &v)
 for a volume given by its path the o, u, v vectors for the plane are returned More...
 
void GetOUVId (TString id, TVector3 &o, TVector3 &u, TVector3 &v)
 for a volume given by its ID the o, u, v vectors for the plane are returned More...
 
TVector3 GetSensorDimensionsID (TString id)
 
TVector3 GetSensorDimensionsPath (TString path)
 
TVector3 MasterToLocalId (const TVector3 &master, const TString &id)
 
TVector3 MasterToLocalPath (const TVector3 &master, const TString &id)
 
TVector3 LocalToMasterId (const TVector3 &local, const TString &id)
 
TVector3 LocalToMasterPath (const TVector3 &local, const TString &id)
 
TVector3 MasterToLocalErrorsId (const TVector3 &master, const TString &id)
 
TVector3 MasterToLocalErrorsPath (const TVector3 &master, const TString &id)
 
TVector3 LocalToMasterErrorsId (const TVector3 &local, const TString &id)
 
TVector3 LocalToMasterErrorsPath (const TVector3 &local, const TString &id)
 
void SetVerbose (Int_t v)
 
Bool_t cd (TString id)
 as the cd command of TGeoManager just with the ID More...
 
void FillLevelNames ()
 fills vector<TString> fLevelNames with the names (or the paths) of the volumes down to the level given by fLevel More...
 

Private Member Functions

 ClassDef (PndHypGeoHandling, 3)
 

Private Attributes

TGeoManager * fGeoMan
 
std::vector< TStringfLevelNames
 
Int_t fVerbose
 
Int_t fLevel
 
bool fFullPath
 

Detailed Description

Class to access the naming information of the MVD.

PndGeoHandling.h

Author
: t.stockmanns t.sto.nosp@m.ckma.nosp@m.ns@fz.nosp@m.-jue.nosp@m.lich..nosp@m.de

To save memory not anylonger the full path of a volume is stored in each hit but an encrypted form of it (f.e. /1_1/34_2/101_1/). The first number is the volumeID comming from the GeoManager and the second number is the copy number. This class helps you converting the encrypted ID into the path information and vice versa. It needs the informations of the GeoManager. Therefore one has to ensure that either an initialized TGeoManager pointer is given in the constructor with the correct goemetry or a filename with the correct geoemetry ("FAIRGeom")

Definition at line 29 of file PndHypGeoHandling.h.

Constructor & Destructor Documentation

PndHypGeoHandling::PndHypGeoHandling ( )

Definition at line 27 of file PndHypGeoHandling.cxx.

References fGeoMan, fVerbose, and gGeoManager.

28 {
29  if (gROOT->FindObjectAny("FAIRGeom") == 0){
30  std::cout << " -E- PndHypGeoHandling: No Geometry existing!" << std::endl;
31  return;
32  }
34 }
TGeoManager * gGeoManager
TGeoManager * fGeoMan
PndHypGeoHandling::PndHypGeoHandling ( TString  fileName)

Definition at line 36 of file PndHypGeoHandling.cxx.

References fGeoMan, fVerbose, and gGeoManager.

37 {
38  if (gROOT->FindObjectAny("FAIRGeom") == 0){
39  fGeoMan = new TGeoManager("geoMan","geoMan");
40  fGeoMan->Import(fileName.Data());
41  }
43 }
TGeoManager * gGeoManager
TGeoManager * fGeoMan
PndHypGeoHandling::PndHypGeoHandling ( TGeoManager *  aGeoMan)
inline

Definition at line 35 of file PndHypGeoHandling.h.

References fGeoMan.

36  {if (aGeoMan == 0) std::cout << "-E- not a valid GeoManager" << std::endl;
37  fGeoMan = aGeoMan;};
TGeoManager * fGeoMan
virtual PndHypGeoHandling::~PndHypGeoHandling ( )
inlinevirtual

Definition at line 39 of file PndHypGeoHandling.h.

39 {};

Member Function Documentation

Bool_t PndHypGeoHandling::cd ( TString  id)

as the cd command of TGeoManager just with the ID

Definition at line 94 of file PndHypGeoHandling.cxx.

References fGeoMan, and GetPath().

95 {
96  return fGeoMan->cd(GetPath(id).Data());
97 }
TString GetPath(TString id)
for a given ID the path is returned
TGeoManager * fGeoMan
PndHypGeoHandling::ClassDef ( PndHypGeoHandling  ,
 
)
private
void PndHypGeoHandling::FillLevelNames ( )

fills vector<TString> fLevelNames with the names (or the paths) of the volumes down to the level given by fLevel

Definition at line 129 of file PndHypGeoHandling.cxx.

References fFullPath, fGeoMan, fLevel, fLevelNames, and i.

Referenced by GetNamesLevel().

130 {
131  TGeoNode* myNode = fGeoMan->GetCurrentNode();
132  if (fLevel == fGeoMan->GetLevel()){
133  if (fFullPath)
134  fLevelNames.push_back(fGeoMan->GetPath());
135  else
136  fLevelNames.push_back(myNode->GetName());
137  }
138  else {
139  Int_t nDaughters = myNode->GetNdaughters();
140  for (Int_t i = 0; i < nDaughters; i++){
141  fGeoMan->CdDown(i);
142  FillLevelNames();
143  fGeoMan->CdUp();
144  }
145  }
146 }
Int_t i
Definition: run_full.C:25
std::vector< TString > fLevelNames
void FillLevelNames()
fills vector fLevelNames with the names (or the paths) of the volumes down to the level give...
TGeoManager * fGeoMan
TString PndHypGeoHandling::GetCurrentID ( )

returns the ID of the current node

Definition at line 45 of file PndHypGeoHandling.cxx.

References fGeoMan, i, and TString.

Referenced by GetID().

46 {
47  Int_t level;
48  Int_t copyNr[100];
49  Int_t volNr[100];
50  TString result;
51 
52  level = fGeoMan->GetLevel();
53  level++;
54 
55  fGeoMan->GetBranchNumbers(copyNr, volNr);
56  for (int i=0; i<level; i++){
57  result += volNr[i];
58  result += "_";
59  result += copyNr[i];
60  result += "/";
61  }
62  return result;
63 }
Int_t i
Definition: run_full.C:25
TGeoManager * fGeoMan
TString PndHypGeoHandling::GetID ( TString  path)

for a given TGeoManager-path the ID is returned

Definition at line 65 of file PndHypGeoHandling.cxx.

References fGeoMan, GetCurrentID(), and TString.

Referenced by PndHyp::ProcessHits().

66 {
67  TString result;
68  TString currentPath = fGeoMan->GetPath();
69  fGeoMan->cd(path.Data());
70  result = GetCurrentID();
71  fGeoMan->cd(currentPath.Data());
72  return result;
73 }
TString GetCurrentID()
returns the ID of the current node
TGeoManager * fGeoMan
std::vector< TString > PndHypGeoHandling::GetNamesLevel ( Int_t  level,
TString  startPath = "",
bool  fullPath = false 
)

Definition at line 109 of file PndHypGeoHandling.cxx.

References fGeoMan, FillLevelNames(), fLevel, fLevelNames, and TString.

110 {
111  TString actPath = fGeoMan->GetPath();
112  fLevelNames.clear();
113 
114  if (startPath == ""){
115  fGeoMan->CdTop();
116  fLevel = level;
117  }
118  else{
119  if (fGeoMan->cd(startPath.Data())== 0)
120  return fLevelNames;
121  else {
122  fLevel = fGeoMan->GetLevel() + level;
123  }
124  }
125  FillLevelNames();
126  return fLevelNames;
127 }
std::vector< TString > fLevelNames
void FillLevelNames()
fills vector fLevelNames with the names (or the paths) of the volumes down to the level give...
TGeoManager * fGeoMan
void PndHypGeoHandling::GetOUVId ( TString  id,
TVector3 &  o,
TVector3 &  u,
TVector3 &  v 
)

for a volume given by its ID the o, u, v vectors for the plane are returned

Definition at line 173 of file PndHypGeoHandling.cxx.

References GetOUVPath(), and GetPath().

Referenced by PndHypRecoHit::PndHypRecoHit().

174 {
175  GetOUVPath(GetPath(id),o,u,v);
176 }
void GetOUVPath(TString path, TVector3 &o, TVector3 &u, TVector3 &v)
for a volume given by its path the o, u, v vectors for the plane are returned
__m128 v
Definition: P4_F32vec4.h:4
TString GetPath(TString id)
for a given ID the path is returned
void PndHypGeoHandling::GetOUVPath ( TString  path,
TVector3 &  o,
TVector3 &  u,
TVector3 &  v 
)

for a volume given by its path the o, u, v vectors for the plane are returned

Definition at line 148 of file PndHypGeoHandling.cxx.

References Double_t, fGeoMan, and TString.

Referenced by GetOUVId().

149 {
150  Double_t result[3];
151  Double_t* temp;
152  TString actPath = fGeoMan->GetPath();
153  fGeoMan->cd(path);
154 
155  TGeoHMatrix* currMatrix = fGeoMan->GetCurrentMatrix();
156  temp = currMatrix->GetTranslation();
157  o.SetXYZ(temp[0], temp[1], temp[2]);
158 
159  temp[0] = 1;
160  temp[1] = 0;
161  temp[2] = 0;
162  fGeoMan->LocalToMasterVect(temp, result);
163  u.SetXYZ(result[0], result[1], result[2]);
164 
165  temp[0] = 0;
166  temp[1] = 1;
167  temp[2] = 0;
168  fGeoMan->LocalToMasterVect(temp, result);
169  v.SetXYZ(result[0], result[1], result[2]);
170  if(actPath!="" && actPath!=" ") fGeoMan->cd(actPath);
171 }
__m128 v
Definition: P4_F32vec4.h:4
Double_t
TGeoManager * fGeoMan
TString PndHypGeoHandling::GetPath ( TString  id)

for a given ID the path is returned

Definition at line 76 of file PndHypGeoHandling.cxx.

References fGeoMan, PndStringVector::GetStringVector(), i, and TString.

Referenced by cd(), PndHypStripHitProducer::Exec(), GetOUVId(), GetSensorDimensionsID(), PndHypIdealRecoTask::InitTransMat(), PndSciTAnaIdeal::InitTransMat(), LocalToMasterErrorsId(), LocalToMasterId(), MasterToLocalErrorsId(), and MasterToLocalId().

77 {
78  TString result;
79  std::vector<std::string> idVector;
80  PndStringVector pathAna(id.Data(), "/_");
81  idVector = pathAna.GetStringVector();
82 
83  for(Int_t i = 0; i < (int)idVector.size(); i+=2){
84  result += "/";
85  Int_t VolId = atoi(idVector[i].c_str());
86  Int_t CopyNr = atoi(idVector[i+1].c_str());
87  result += fGeoMan->GetVolume(VolId)->GetName();
88  result += "_";
89  result += CopyNr;
90  }
91  return result;
92 }
Int_t i
Definition: run_full.C:25
TGeoManager * fGeoMan
TVector3 PndHypGeoHandling::GetSensorDimensionsID ( TString  id)

Definition at line 196 of file PndHypGeoHandling.cxx.

References GetPath(), and GetSensorDimensionsPath().

197 {
198  return GetSensorDimensionsPath(GetPath(id));
199 }
TVector3 GetSensorDimensionsPath(TString path)
TString GetPath(TString id)
for a given ID the path is returned
TVector3 PndHypGeoHandling::GetSensorDimensionsPath ( TString  path)

Definition at line 179 of file PndHypGeoHandling.cxx.

References fGeoMan, gGeoManager, and TString.

Referenced by GetSensorDimensionsID().

180 {
181  TVector3 dim;
182  TString actPath = fGeoMan->GetPath();
183  fGeoMan->cd(path);
184 
185  TGeoVolume* actVolume = gGeoManager->GetCurrentVolume();
186  TGeoBBox* actBox = (TGeoBBox*)(actVolume->GetShape());
187  dim.SetX(actBox->GetDX());
188  dim.SetY(actBox->GetDY());
189  dim.SetZ(actBox->GetDZ());
190 
191  if(actPath!="" && actPath!=" ") fGeoMan->cd(actPath);
192  return dim;
193 }
TGeoManager * gGeoManager
TGeoManager * fGeoMan
TString PndHypGeoHandling::GetVolumeID ( TString  name)

returns the volume ID for a given volume name

Definition at line 99 of file PndHypGeoHandling.cxx.

References fGeoMan, and TString.

100 {
101  TString result;
102  TGeoVolume* vol = fGeoMan->FindVolumeFast(name);
103  if (vol == 0)
104  return result;
105  result += vol->GetNumber();
106  return result;
107 }
TString name
TGeoManager * fGeoMan
TVector3 PndHypGeoHandling::LocalToMasterErrorsId ( const TVector3 &  local,
const TString id 
)

Definition at line 277 of file PndHypGeoHandling.cxx.

References GetPath(), and LocalToMasterErrorsPath().

Referenced by PndHypStripClusterTask::Exec().

278 { return LocalToMasterErrorsPath(local, GetPath(id) ); }
TString GetPath(TString id)
for a given ID the path is returned
TVector3 LocalToMasterErrorsPath(const TVector3 &local, const TString &id)
TVector3 PndHypGeoHandling::LocalToMasterErrorsPath ( const TVector3 &  local,
const TString id 
)

Definition at line 280 of file PndHypGeoHandling.cxx.

References Double_t, fabs(), fGeoMan, i, and TString.

Referenced by LocalToMasterErrorsId().

281 {
282  Double_t result[3];
283  Double_t tmp[3];
284  TString actPath = fGeoMan->GetPath();
285  fGeoMan->cd(path);
286 
287 
288  tmp[0] = local.X();
289  tmp[1] = local.Y();
290  tmp[2] = local.Z();
291 
292  // rotate "error vector"
293  fGeoMan->LocalToMasterVect(tmp,result);
294  // positive error values
295  for(Int_t i=0;i<3;i++) result[i]=fabs(result[i]);
296 
297  if(actPath != "" && actPath != " ") fGeoMan->cd(actPath);
298  return TVector3(result[0],result[1],result[2]);
299 
300 }
Int_t i
Definition: run_full.C:25
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TGeoManager * fGeoMan
TVector3 PndHypGeoHandling::LocalToMasterId ( const TVector3 &  local,
const TString id 
)

Definition at line 225 of file PndHypGeoHandling.cxx.

References GetPath(), and LocalToMasterPath().

Referenced by PndHypStripClusterTask::Exec().

226 { return LocalToMasterPath(local, GetPath(id) ); }
TString GetPath(TString id)
for a given ID the path is returned
TVector3 LocalToMasterPath(const TVector3 &local, const TString &id)
TVector3 PndHypGeoHandling::LocalToMasterPath ( const TVector3 &  local,
const TString id 
)

Definition at line 228 of file PndHypGeoHandling.cxx.

References Double_t, fGeoMan, and TString.

Referenced by LocalToMasterId().

229 {
230  Double_t result[3];
231  Double_t temp[3];
232 
233  temp[0] = local.X();
234  temp[1] = local.Y();
235  temp[2] = local.Z();
236 
237  TString actPath = fGeoMan->GetPath();
238  fGeoMan->cd(path);
239  fGeoMan->LocalToMaster(temp, result);
240  fGeoMan->cd(actPath);
241  if(actPath != "" && actPath != " ") fGeoMan->cd(actPath);
242  return TVector3(result[0],result[1],result[2]);
243 }
Double_t
TGeoManager * fGeoMan
TVector3 PndHypGeoHandling::MasterToLocalErrorsId ( const TVector3 &  master,
const TString id 
)

Definition at line 247 of file PndHypGeoHandling.cxx.

References GetPath(), and MasterToLocalErrorsPath().

248 { return MasterToLocalErrorsPath(master, GetPath(id) ); }
TVector3 MasterToLocalErrorsPath(const TVector3 &master, const TString &id)
TString GetPath(TString id)
for a given ID the path is returned
TVector3 PndHypGeoHandling::MasterToLocalErrorsPath ( const TVector3 &  master,
const TString id 
)

Definition at line 250 of file PndHypGeoHandling.cxx.

References Double_t, fabs(), fGeoMan, i, and TString.

Referenced by MasterToLocalErrorsId().

251 {
252  Double_t result[3];
253  Double_t temp[3];
254  TString actPath = fGeoMan->GetPath();
255  fGeoMan->cd(path);
256 
257 
258  temp[0] = master.X();
259  temp[1] = master.Y();
260  temp[2] = master.Z();
261 
262  // rotate "error vector"
263  fGeoMan->MasterToLocalVect(temp,result);
264  // positive error values
265  for(Int_t i=0;i<3;i++) result[i]=fabs(result[i]);
266 
267 
268 
269  if(actPath != "" && actPath != " ") fGeoMan->cd(actPath);
270  return TVector3(result[0],result[1],result[2]);
271 
272 
273 }
Int_t i
Definition: run_full.C:25
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TGeoManager * fGeoMan
TVector3 PndHypGeoHandling::MasterToLocalId ( const TVector3 &  master,
const TString id 
)

Definition at line 202 of file PndHypGeoHandling.cxx.

References GetPath(), and MasterToLocalPath().

Referenced by PndHypStripHitProducer::Exec(), and PndHypRecoHit::PndHypRecoHit().

203 { return MasterToLocalPath(master, GetPath(id) ); }
TString GetPath(TString id)
for a given ID the path is returned
TVector3 MasterToLocalPath(const TVector3 &master, const TString &id)
TVector3 PndHypGeoHandling::MasterToLocalPath ( const TVector3 &  master,
const TString id 
)

Definition at line 205 of file PndHypGeoHandling.cxx.

References Double_t, fGeoMan, and TString.

Referenced by MasterToLocalId().

206 {
207  // if(fVerbose>1) std::cout<<" -I- PndHypGeoHandling::MasterToLocalPath"<<std::endl;
208  Double_t result[3];
209  Double_t temp[3];
210 
211  temp[0] = master.X();
212  temp[1] = master.Y();
213  temp[2] = master.Z();
214 
215  TString actPath = fGeoMan->GetPath();
216  fGeoMan->cd(path);
217  fGeoMan->MasterToLocal(temp, result);
218  // fGeoMan->cd(actPath);
219  if(actPath != "" && actPath != " ") fGeoMan->cd(actPath);
220  return TVector3(result[0],result[1],result[2]);
221 }
Double_t
TGeoManager * fGeoMan
void PndHypGeoHandling::SetVerbose ( Int_t  v)
inline

Definition at line 61 of file PndHypGeoHandling.h.

References fVerbose, and v.

61 { fVerbose = v; }
__m128 v
Definition: P4_F32vec4.h:4

Member Data Documentation

bool PndHypGeoHandling::fFullPath
private

Definition at line 70 of file PndHypGeoHandling.h.

Referenced by FillLevelNames().

TGeoManager* PndHypGeoHandling::fGeoMan
private
Int_t PndHypGeoHandling::fLevel
private

Definition at line 69 of file PndHypGeoHandling.h.

Referenced by FillLevelNames(), and GetNamesLevel().

std::vector<TString> PndHypGeoHandling::fLevelNames
private

Definition at line 68 of file PndHypGeoHandling.h.

Referenced by FillLevelNames(), and GetNamesLevel().

Int_t PndHypGeoHandling::fVerbose
private

Definition at line 68 of file PndHypGeoHandling.h.

Referenced by PndHypGeoHandling(), and SetVerbose().


The documentation for this class was generated from the following files: