コード例 #1
0
ファイル: IDDecoder.cpp プロジェクト: vvolkl/DD4hep
/**
 * Returns the global position from a given cell ID
 */
Position IDDecoder::position(const CellID& cell) const {
	double l[3];
	double g[3];
	DetElement det = this->detectorElement(cell);
	Position local = this->findReadout(det).segmentation().position(cell);
	local.GetCoordinates(l);
	// FIXME: direct lookup of transformations seems to be broken
	//const TGeoMatrix& localToGlobal = _volumeManager.worldTransformation(cell);
	const TGeoMatrix& localToGlobal = det.worldTransformation();
	localToGlobal.LocalToMaster(l, g);
	return Position(g[0], g[1], g[2]);
}
コード例 #2
0
ファイル: IDDecoder.cpp プロジェクト: vvolkl/DD4hep
/**
 * Returns the cell ID from the local position in the given volume ID.
 */
CellID IDDecoder::cellIDFromLocal(const Position& local, const VolumeID volID) const {
	double l[3];
	double g[3];
	local.GetCoordinates(l);
	// FIXME: direct lookup of transformations seems to be broken
	//const TGeoMatrix& localToGlobal = _volumeManager.worldTransformation(volID);
	DetElement det = this->detectorElement(volID);
	const TGeoMatrix& localToGlobal = det.worldTransformation();
	localToGlobal.LocalToMaster(l, g);
	Position global(g[0], g[1], g[2]);
	return this->findReadout(det).segmentation().cellID(local, global, volID);
}