// $Id$ // // Class AliMUONGeometryTransformStore // ------------------------------------ // The class provides the array of transformations of the detection elements // from a defined reference frame to the detection element frame. // (See more in the header file.) // // Author: Ivana Hrivnacova, IPN Orsay #include #include #include #include "AliMUONGeometryTransformStore.h" #include "AliLog.h" ClassImp(AliMUONGeometryTransformStore) const Int_t AliMUONGeometryTransformStore::fgkHemisphere = 50; //______________________________________________________________________________ AliMUONGeometryTransformStore::AliMUONGeometryTransformStore( Int_t firstDetElemId, Int_t nofDetElems, AliMUONGeometrySVMap* svMap) : TObject(), fFirstDetElemId(firstDetElemId), fNofDetElems(nofDetElems), fDETransforms(100), fSVMap(svMap) { // Standard constructor fDETransforms.SetOwner(true); for (Int_t i=0; i= fgkHemisphere) index -= fgkHemisphere - fNofDetElems/2; return index; } //______________________________________________________________________________ Int_t AliMUONGeometryTransformStore::GetDetElementId(Int_t detElemIndex) const { // Returns the ID of detector element specified by index // --- Int_t detElemId = detElemIndex; if (detElemIndex >= fNofDetElems/2) detElemId += fgkHemisphere - fNofDetElems/2; detElemId += fFirstDetElemId; return detElemId; } // // public methods // //______________________________________________________________________________ void AliMUONGeometryTransformStore::Add(Int_t detElemId, const TString& alignedVolume, const TGeoCombiTrans& transform) { // Add transformation specified by alignedVolume in the array // if this alignedVolume is not yet present. // --- TGeoCombiTrans* newTransform = new TGeoCombiTrans(transform); newTransform->SetName(alignedVolume); //cout << ".. adding " << detElemId // << " index: " << GetDetElementIndex(detElemId) << endl; // Add to the map if ( !Get(detElemId)) { newTransform->SetUniqueID(detElemId); // Set detector element id as unique id fDETransforms.AddAt(newTransform, GetDetElementIndex(detElemId)); } else AliWarning(Form("The aligned volume %s is already present", alignedVolume.Data())); } //______________________________________________________________________________ void AliMUONGeometryTransformStore::Print(Option_t* /*option*/) const { // Prints the detector elements transformations // --- for (Int_t i=0; iGetName() << endl; const double* translation = matrix->GetTranslation(); cout << " translation: " #if defined (__DECCXX) << translation[0] << ", " << translation[1] << ", " << translation[2] << endl; #else << std::fixed << std::setw(7) << std::setprecision(4) << translation[0] << ", " << std::setw(7) << std::setprecision(4) << translation[1] << ", " << std::setw(7) << std::setprecision(4) << translation[2] << endl; #endif const double* rotation = matrix->GetRotationMatrix(); cout << " rotation matrix: " #if defined (__DECCXX) << rotation[0] << ", " << rotation[1] << ", " << rotation[2] << endl << " " << rotation[3] << ", " << rotation[4] << ", " << rotation[5] << endl << " " << rotation[6] << ", " << rotation[7] << ", " << rotation[8] << endl; #else << std::fixed << std::setw(7) << std::setprecision(4) << rotation[0] << ", " << rotation[1] << ", " << rotation[2] << endl << " " << rotation[3] << ", " << rotation[4] << ", " << rotation[5] << endl << " " << rotation[6] << ", " << rotation[7] << ", " << rotation[8] << endl; #endif } } //______________________________________________________________________________ const TGeoCombiTrans* AliMUONGeometryTransformStore::Get(Int_t detElemId) const { // Returns transformation for the specified detector element Id // --- Int_t index = GetDetElementIndex(detElemId); if ( index >= 0 && index < fNofDetElems ) return (const TGeoCombiTrans*)fDETransforms.At(index); else { AliWarning(Form("Index %d out of limits", index)); return 0; } } //______________________________________________________________________________ const TGeoCombiTrans* AliMUONGeometryTransformStore::FindBySensitiveVolume(const TString& sensVolume) const { // Finds TGeoCombiTrans for the detector element Id specified by aligned volume // --- Int_t detElemId = fSVMap->GetDetElemId(sensVolume); if (!detElemId) return 0; // The specified sensitive volume is not in the map return Get(detElemId); }