#include "Geometry/CellUniqueId.h"
#include <iostream>
#include "TGeoNode.h"
Go to the source code of this file.
Namespaces | |
| namespace | geo |
Functions | |
| CellUniqueId | NodesToUniqueId (const std::vector< const TGeoNode * > &n, unsigned int depth) |
| CellUniqueId | PathToUniqueId (const char *path) |
| CellUniqueId | IdsToUniqueId (const std::vector< int > &ids) |
| void | GetNodeNumbers (const char *nm, std::vector< int > &id) |
Definition in file CellUniqueId.cxx.
|
||||||||||||
|
Definition at line 65 of file CellUniqueId.cxx. Referenced by geo::NodesToUniqueId(), geo::PathToUniqueId(), and testUniqueId(). 00066 {
00067 char buff[8];
00068 const char* c;
00069 const char* start = nm;
00070 const char* end;
00071 int indx;
00072 while (1) {
00073 start = strchr(start, '_');
00074 if (start == NULL) break;
00075 ++start;
00076 end = strchr(start, '/');
00077 if (end==NULL) end = strchr(start, '\0');
00078 if (end==NULL) abort();
00079
00080 for (indx=0, c=start; c<end; ++indx, ++c) buff[indx] = *c;
00081 buff[indx] = '\0';
00082 id.push_back(atoi(buff));
00083 }
00084 }
|
|
|
Definition at line 40 of file CellUniqueId.cxx. References geo::CellUniqueId. Referenced by geo::NodesToUniqueId(), and geo::PathToUniqueId(). 00041 {
00042 // Experience has shown that only depths below this "depth0"
00043 // contribute to a cell's 'uniqueness'.
00044 static const unsigned int depth0 = 3;
00045
00046 // Now construct the id
00047 CellUniqueId id = 0ULL;
00048 for (unsigned int i=depth0; i<ids.size(); ++i) {
00049 // The following check is useful, although not really
00050 // required. The code in Geometry.cxx checks that the ID's are
00051 // unique which is all that really matters. Even if we happen to
00052 // overflow the storage limits of the CellUniqueId, the result
00053 // will always be the same for the same cell. So, as long as the
00054 // overflow is unique, all is OK. BTW, I've checked that as of
00055 // at least v1.6 2008/08/17 the CellUniqueID's do not overflow
00056 //
00057 // if (id>0 && ULLONG_MAX/id < 1000) abort();
00058 id = 1000*id + ids[i];
00059 }
00060 return id;
00061 }
|
|
||||||||||||
|
Definition at line 17 of file CellUniqueId.cxx. References geo::CellUniqueId, geo::GetNodeNumbers(), and geo::IdsToUniqueId(). Referenced by geo::CellGeo::CellGeo(). 00019 {
00020 static std::vector<int> ids;
00021 ids.clear();
00022 for (unsigned int i=0; i<=depth; ++i) {
00023 GetNodeNumbers(n[i]->GetName(), ids);
00024 }
00025 return IdsToUniqueId(ids);
00026 }
|
|
|
Definition at line 30 of file CellUniqueId.cxx. References geo::CellUniqueId, geo::GetNodeNumbers(), and geo::IdsToUniqueId(). Referenced by geo::Geometry::CurrentCellId(), novamc::MCApplication::Stepping(), and testUniqueId(). 00031 {
00032 static std::vector<int> ids;
00033 ids.clear();
00034 GetNodeNumbers(path, ids);
00035 return IdsToUniqueId(ids);
00036 }
|
1.3.9.1