From 03408ddd9e3249032d606f8d2befa090e8d29390 Mon Sep 17 00:00:00 2001 From: Grigory Nigmatkulov Date: Wed, 27 Nov 2024 12:19:09 -0600 Subject: [PATCH] Remove unused variables --- StRoot/StGmtUtil/geometry/StGmtGeom.cxx | 663 +++++++++--------------- StRoot/StGmtUtil/geometry/StGmtGeom.h | 32 +- 2 files changed, 261 insertions(+), 434 deletions(-) diff --git a/StRoot/StGmtUtil/geometry/StGmtGeom.cxx b/StRoot/StGmtUtil/geometry/StGmtGeom.cxx index 37246e64052..8a70c3c6aa1 100644 --- a/StRoot/StGmtUtil/geometry/StGmtGeom.cxx +++ b/StRoot/StGmtUtil/geometry/StGmtGeom.cxx @@ -18,189 +18,141 @@ double StGmtGeom::mPi = TMath::Pi(); double StGmtGeom::mHalfPi = TMath::PiOver2(); - -Int_t StGmtGeom::encodeGeoId //// WORKING -( +//________________ +Int_t StGmtGeom::encodeGeoId( // Int_t module, Char_t layer, Int_t strip Int_t rdo, Int_t arm, Int_t apv, Int_t channel -) -{ +) { Short_t module = getModuleIdFromElecCoord( rdo, arm, apv ); // locally map apv number into [0,1] - if ( apv <= 3 ) - { + if ( apv <= 3 ) { apv = apv % 2; } - else - { + else { apv = (apv - 12) % 2; } Char_t testS='S'; Char_t testP='P'; - if ( module < 0 || module >= kGmtNumModules ) - { - LOG_DEBUG << "Module " << module << " out of range in StGmtGeom::encodeGeoId." << endm; - return kGmtError; + if ( module < 0 || module >= kGmtNumModules ) { + LOG_DEBUG << "Module " << module << " out of range in StGmtGeom::encodeGeoId." << endm; + return kGmtError; } - else if ( apv > 1 || apv < 0 ) - { - LOG_DEBUG << "APV " << apv << " out of range in StGmtGeom::encodeGeoId." << endm; - return kGmtError; + else if ( apv > 1 || apv < 0 ) { + LOG_DEBUG << "APV " << apv << " out of range in StGmtGeom::encodeGeoId." << endm; + return kGmtError; } - else if ( channel < 0 || channel >= kGmtNumStrips ) - { - LOG_DEBUG << "Channel " << channel << " out of range in StGmtGeom::encodeGeoId." << endm; - return kGmtError; + else if ( channel < 0 || channel >= kGmtNumStrips ) { + LOG_DEBUG << "Channel " << channel << " out of range in StGmtGeom::encodeGeoId." << endm; + return kGmtError; } - - return - ( module * kGmtNumLayers + apv ) * kGmtNumStrips + channel; // from 0 to 2047 since channel is from 0-127; + return ( module * kGmtNumLayers + apv ) * kGmtNumStrips + channel; // from 0 to 2047 since channel is from 0-127; } -Int_t StGmtGeom::decodeGeoId //// WORKING -( -// Int_t geoId, Short_t & module, Char_t & layer, Short_t & strip - Int_t geoId, Short_t & module, Int_t & layer, Short_t & strip -) -{ - if ( geoId < 0 || geoId >= kGmtNumGeoIds ) - { - LOG_DEBUG << "GeoId " << geoId << " out of range in StGmtGeom::decodeGeoId." << endm; - module = kGmtError; -// layer = kGmtErrorChar; - layer = kGmtError; - strip = kGmtError; +//________________ +Int_t StGmtGeom::decodeGeoId(Int_t geoId, Short_t & module, Int_t & layer, Short_t & strip) { + if ( geoId < 0 || geoId >= kGmtNumGeoIds ) { + LOG_DEBUG << "GeoId " << geoId << " out of range in StGmtGeom::decodeGeoId." << endm; + module = kGmtError; + // layer = kGmtErrorChar; + layer = kGmtError; + strip = kGmtError; - return kGmtError; + return kGmtError; } strip = geoId % kGmtNumStrips; geoId /= kGmtNumStrips; -// layer = ( geoId % kGmtNumLayers ) ? 'P' : 'S'; + // layer = ( geoId % kGmtNumLayers ) ? 'P' : 'S'; Int_t apv = ( geoId % kGmtNumLayers ) ? 1 : 0; geoId /= kGmtNumLayers; StGmtGeomData stripdata = mStrips[ strip + apv*kGmtNumStrips ]; layer = stripdata.isY; - module = geoId; - return 0; } -//////////// FIX ME!!!!!!!!!!!!!!!!!!!! -std::string StGmtGeom::encodeGeoName -( - Int_t module, Char_t layer, Int_t strip -) -{ - Char_t testS='S'; - Char_t testP='P'; +//________________ +std::string StGmtGeom::encodeGeoName(Int_t module, Char_t layer, Int_t strip) { - if ( module < 0 || module >= kGmtNumModules ) - { - LOG_DEBUG << "Module " << module << " out of range in StGmtGeom::encodeGeoName." << endm; - return kGmtErrorString; + Char_t testS='S'; + Char_t testP='P'; + + if ( module < 0 || module >= kGmtNumModules ) { + LOG_DEBUG << "Module " << module << " out of range in StGmtGeom::encodeGeoName." << endm; + return kGmtErrorString; } - else if ( - layer != testS - && layer != testP - ) - { - LOG_DEBUG << "Layer " << layer << " out of range in StGmtGeom::encodeGeoName." << endm; - return kGmtErrorString; + else if (layer != testS && layer != testP) { + LOG_DEBUG << "Layer " << layer << " out of range in StGmtGeom::encodeGeoName." << endm; + return kGmtErrorString; } - else if ( strip < 0 || strip >= kGmtNumStrips ) - { - LOG_DEBUG << "Strip " << strip << " out of range in StGmtGeom::encodeGeoName." << endm; - return kGmtErrorString; + else if ( strip < 0 || strip >= kGmtNumStrips ) { + LOG_DEBUG << "Strip " << strip << " out of range in StGmtGeom::encodeGeoName." << endm; + return kGmtErrorString; } - //////////// FIX ME!!!!!!!!!!!!!!!!!!!! - std::stringstream buff; -// buff << disc+1 << (Char_t)(quadrant+'A') << layer; + std::stringstream buff; + // buff << disc+1 << (Char_t)(quadrant+'A') << layer; buff << module+1 << layer; - if ( strip < 10 ) + if ( strip < 10 ) { buff << "00"; - else if ( strip < 100 ) + } + else if ( strip < 100 ) { buff << "0"; + } buff << strip; return buff.str(); } - //////////// FIX ME!!!!!!!!!!!!!!!!!!!! -Int_t StGmtGeom::decodeGeoName -( -// const std::string & geoName, -// Short_t & module, Char_t & layer, Short_t & strip - const std::string & geoName, - Short_t & module, Int_t & layer, Short_t & strip -) -{ - Char_t testS='S'; - Char_t testP='P'; +//________________ +Int_t StGmtGeom::decodeGeoName(const std::string &geoName, Short_t &module, Int_t &layer, Short_t &strip) { - //assert( geoName.size() == 6 ); -// disc = geoName[0] - '1'; -// quadrant = geoName[1] - 'A'; -// layer = geoName[2]; -// strip = std::atoi( (geoName.substr(3)).c_str() ); + // Char_t testS='S'; + // Char_t testP='P'; + + // assert( geoName.size() == 6 ); + // disc = geoName[0] - '1'; + // quadrant = geoName[1] - 'A'; + // layer = geoName[2]; + // strip = std::atoi( (geoName.substr(3)).c_str() ); module = geoName[0] - '1'; layer = geoName[2]; strip = std::atoi( (geoName.substr(3)).c_str() ); - // This is unlikely to catch all errors with the geoName, but it should - // do fairly well. - if ( - module < 0 - || module >= kGmtNumModules - || ( -// layer != testS -// && layer != testP - layer < 0 || layer > 1 - ) - || strip < 0 - || strip > kGmtNumStrips - ) - { - LOG_DEBUG << "Malformed geoName " << geoName << " in StGmtGeom::decodeGeoName." << endm; - module = kGmtError; - layer = kGmtErrorChar; - strip = kGmtError; - - return kGmtError; + // This is unlikely to catch all errors with the geoName, but it should do fairly well. + if (module < 0 || module >= kGmtNumModules || ( + // layer != testS && layer != testP + layer < 0 || layer > 1) || strip < 0 || strip > kGmtNumStrips) { + LOG_DEBUG << "Malformed geoName " << geoName << " in StGmtGeom::decodeGeoName." << endm; + module = kGmtError; + layer = kGmtErrorChar; + strip = kGmtError; + return kGmtError; } - return 0; } - //////////// FIX ME!!!!!!!!!!!!!!!!!!!! -std::string StGmtGeom::translateGeoIdToGeoName( Int_t geoId ) -{ +//________________ +std::string StGmtGeom::translateGeoIdToGeoName(Int_t geoId) { Short_t module, strip; -// Char_t layer; Int_t layer; - - if ( geoId < 0 || geoId >= kGmtNumGeoIds ) - { - LOG_DEBUG << "GeoId " << geoId << " out of range in StGmtGeom::translateGeoIdToGeoName." << endm; - return kGmtErrorString; + if ( geoId < 0 || geoId >= kGmtNumGeoIds ) { + LOG_DEBUG << "GeoId " << geoId << " out of range in StGmtGeom::translateGeoIdToGeoName." << endm; + return kGmtErrorString; } decodeGeoId( geoId, module, layer, strip ); return encodeGeoName( module, layer, strip ); } - //////////// FIX ME!!!!!!!!!!!!!!!!!!!! -Int_t StGmtGeom::translateGeoNameToGeoId( const std::string & geoName ) -{ +//________________ +Int_t StGmtGeom::translateGeoNameToGeoId(const std::string & geoName) { Short_t module, strip; -// Char_t layer; Int_t layer; Int_t rdo, arm, apv, channel; @@ -208,211 +160,154 @@ Int_t StGmtGeom::translateGeoNameToGeoId( const std::string & geoName ) if ( decodeGeoName( geoName, module, layer, strip ) < 0 ) return kGmtError; -// return encodeGeoId( module, layer, strip ); + // return encodeGeoId( module, layer, strip ); return encodeGeoId( rdo, arm, apv, channel ); } -Int_t StGmtGeom::getPhysicalCoordinate //// WORKING -( - Int_t geoId, -// Short_t & module, Char_t & layer - Short_t & module, Int_t & layer -) -{ - if ( geoId < 0 || geoId >= kGmtNumGeoIds ) - { - LOG_DEBUG << "GeoId " << geoId << " out of range in StGmtGeom::getPhysicalCoordinate." << endm; - module = kGmtError; - layer = kGmtErrorChar; - - return kGmtError; +//________________ +Int_t StGmtGeom::getPhysicalCoordinate(Int_t geoId, Short_t & module, Int_t & layer) { + if ( geoId < 0 || geoId >= kGmtNumGeoIds ) { + LOG_DEBUG << "GeoId " << geoId << " out of range in StGmtGeom::getPhysicalCoordinate." << endm; + module = kGmtError; + layer = kGmtErrorChar; + return kGmtError; } Short_t strip; - decodeGeoId( geoId, module, layer, strip ); - return 0; } - //////////// FIX ME!!!!!!!!!!!!!!!!!!!! -Int_t StGmtGeom::getPhysicalCoordinate -( -// const std::string & geoName, -// Short_t & module, Char_t & layer - const std::string & geoName, - Short_t & module, Int_t & layer -) -{ +//________________ +Int_t StGmtGeom::getPhysicalCoordinate(const std::string & geoName, Short_t & module, Int_t & layer) { Short_t strip; - - if ( decodeGeoName( geoName, module, layer, strip ) < 0 ) - { - // Error is mostly handled by the decodeGeoName call. - module = kGmtError; -// layer = kGmtErrorChar; - layer = kGmtError; - - return kGmtError; + if ( decodeGeoName( geoName, module, layer, strip ) < 0 ) { + // Error is mostly handled by the decodeGeoName call. + module = kGmtError; + // layer = kGmtErrorChar; + layer = kGmtError; + return kGmtError; } - return 0; } -Short_t StGmtGeom::getModuleIdFromElecCoord -( - Int_t rdo, Int_t arm, Int_t apv -) -{ - if ( (rdo - 1) < 0 || (rdo - 1) >= kGmtNumRdos ) - { - LOG_DEBUG << "RDO " << rdo << " out of range in StGmtGeom::getModuleIdFromElecCoord." << endm; - return kGmtError; - } - else if ( arm < 0 || arm >= kGmtNumArms ) - { - LOG_DEBUG << "ARM " << arm << " out of range in StGmtGeom::getModuleIdFromElecCoord." << endm; - return kGmtError; - } - else if ( apv < 0 || apv > kGmtMaxApvId || (apv > 3 && apv < 12) ) - { - LOG_DEBUG << "APV " << apv << " out of range in StGmtGeom::getModuleIdFromElecCoord." << endm; - return kGmtError; - } - - if ( arm == 0 ) - { - if( apv == 0 || apv == 1 ) - return 0; - else if( apv == 2 || apv == 3 ) - return 1; - else if( apv == 12 || apv == 13 ) - return 2; - else if( apv == 14 || apv == 15 ) - return 3; - else - { - LOG_DEBUG << "Invalid electronics coordinates in StGmtGeom::getModuleIdFromElecCoord." << endm; - return kGmtError; - } - } - else - { - if( apv == 0 || apv == 1 ) - return 4; - else if( apv == 2 || apv == 3 ) - return 5; - else if( apv == 12 || apv == 13 ) - return 6; - else if( apv == 14 || apv == 15 ) - return 7; - else - { - LOG_DEBUG << "Invalid electronics coordinates in StGmtGeom::getModuleIdFromElecCoord." << endm; - return kGmtError; - } - } +//________________ +Short_t StGmtGeom::getModuleIdFromElecCoord(Int_t rdo, Int_t arm, Int_t apv) { + if ( (rdo - 1) < 0 || (rdo - 1) >= kGmtNumRdos ) { + LOG_DEBUG << "RDO " << rdo << " out of range in StGmtGeom::getModuleIdFromElecCoord." << endm; + return kGmtError; + } + else if ( arm < 0 || arm >= kGmtNumArms ) { + LOG_DEBUG << "ARM " << arm << " out of range in StGmtGeom::getModuleIdFromElecCoord." << endm; + return kGmtError; + } + else if ( apv < 0 || apv > kGmtMaxApvId || (apv > 3 && apv < 12) ) { + LOG_DEBUG << "APV " << apv << " out of range in StGmtGeom::getModuleIdFromElecCoord." << endm; + return kGmtError; + } + + if ( arm == 0 ) { + if( apv == 0 || apv == 1 ) { + return 0; + } + else if( apv == 2 || apv == 3 ) { + return 1; + } + else if( apv == 12 || apv == 13 ) { + return 2; + } + else if( apv == 14 || apv == 15 ) { + return 3; + } + else { + LOG_DEBUG << "Invalid electronics coordinates in StGmtGeom::getModuleIdFromElecCoord." << endm; + return kGmtError; + } + } // if ( arm == 0 ) + else { + if( apv == 0 || apv == 1 ) { + return 4; + } + else if( apv == 2 || apv == 3 ) { + return 5; + } + else if( apv == 12 || apv == 13 ) { + return + } + else if( apv == 14 || apv == 15 ) { + return 7; + } + else { + LOG_DEBUG << "Invalid electronics coordinates in StGmtGeom::getModuleIdFromElecCoord." << endm; + return kGmtError; + } + } // else } -Int_t StGmtGeom::getCoordNumFromElecCoord -( - Int_t rdo, Int_t arm, Int_t apv, Int_t channel -) -{ - if ( (rdo - 1) < 0 || (rdo - 1) >= kGmtNumRdos ) - { - LOG_DEBUG << "RDO " << rdo << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; - return kGmtError; +//________________ +Int_t StGmtGeom::getCoordNumFromElecCoord(Int_t rdo, Int_t arm, Int_t apv, Int_t channel) { + if ( (rdo - 1) < 0 || (rdo - 1) >= kGmtNumRdos ) { + LOG_DEBUG << "RDO " << rdo << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; + return kGmtError; } - else if ( arm < 0 || arm >= kGmtNumArms ) - { - LOG_DEBUG << "ARM " << arm << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; - return kGmtError; + else if ( arm < 0 || arm >= kGmtNumArms ) { + LOG_DEBUG << "ARM " << arm << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; + return kGmtError; } - else if ( apv < 0 || apv > kGmtMaxApvId || (apv > 3 && apv < 12) ) - { - LOG_DEBUG << "APV " << apv << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; - return kGmtError; + else if ( apv < 0 || apv > kGmtMaxApvId || (apv > 3 && apv < 12) ) { + LOG_DEBUG << "APV " << apv << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; + return kGmtError; } - else if ( channel < 0 || channel >= kGmtNumChannels ) - { - LOG_DEBUG << "Channel " << channel << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; - return kGmtError; + else if ( channel < 0 || channel >= kGmtNumChannels ) { + LOG_DEBUG << "Channel " << channel << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; + return kGmtError; } -// // locally map apv number into [0,1] -// if ( apv == 3 ) -// { -// apv = apv/2; -// } -// else -// { -// apv = (apv - 12)/2; -// } - - - StGmtGeomData stripdata = mStrips[ channel + (apv % 2) * kGmtNumStrips ]; - - return stripdata.coordinate; - + StGmtGeomData stripdata = mStrips[ channel + (apv % 2) * kGmtNumStrips ]; + return stripdata.coordinate; } -Double_t StGmtGeom::getPositionFromElecCoord//here -( - Int_t rdo, Int_t arm, Int_t apv, Int_t channel - ) -{ - Int_t apvi = apv; - if ( (rdo - 1) < 0 || (rdo - 1) >= kGmtNumRdos ) - { - LOG_DEBUG << "RDO " << rdo << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; - return kGmtError; +//________________ +Double_t StGmtGeom::getPositionFromElecCoord(Int_t rdo, Int_t arm, Int_t apv, Int_t channel) { + Int_t apvi = apv; + if ( (rdo - 1) < 0 || (rdo - 1) >= kGmtNumRdos ) { + LOG_DEBUG << "RDO " << rdo << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; + return kGmtError; } - else if ( arm < 0 || arm >= kGmtNumArms ) - { - LOG_DEBUG << "ARM " << arm << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; - return kGmtError; + else if ( arm < 0 || arm >= kGmtNumArms ) { + LOG_DEBUG << "ARM " << arm << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; + return kGmtError; } - else if ( apv < 0 || apv > kGmtMaxApvId || (apv > 3 && apv < 12) ) - { - LOG_DEBUG << "APV " << apv << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; - return kGmtError; + else if ( apv < 0 || apv > kGmtMaxApvId || (apv > 3 && apv < 12) ) { + LOG_DEBUG << "APV " << apv << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; + return kGmtError; } - else if ( channel < 0 || channel >= kGmtNumChannels ) - { - LOG_DEBUG << "Channel " << channel << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; - return kGmtError; + else if ( channel < 0 || channel >= kGmtNumChannels ) { + LOG_DEBUG << "Channel " << channel << " out of range in StGmtGeom::getCoordNumFromElecCoord." << endm; + return kGmtError; } - // locally map apv number into [0,1] -// if ( apv <= 3 ) -// { -// apv = apv/2; -// } -// else -// { -// apv = (apv - 12)/2; -// } - - apv = apv%2; - - StGmtGeomData stripdata = mStrips[ channel + apv*kGmtNumStrips ];//0-257 - //LOG_INFO << "rdo=" << rdo << "\tarm="<< arm << "\tapv="<< apvi <<"\tchannel = "<< channel << endm; - //LOG_INFO << "apv2= " << apv << "\tstr=" << kGmtNumStrips << "\t[]=" << channel + apv*kGmtNumStrips << "\t===> " < " <= kGmtNumGeoIds ) - { - LOG_DEBUG << "GeoId " << geoId << " out of range in StGmtGeom::getPhysicalCoordinate." << endm; - module = kGmtError; -// layer = kGmtErrorChar; - layer = kGmtError; - - return kGmtError; + Short_t strip; + decodeGeoId( geoId, module, layer, strip ); + if ( geoId < 0 || geoId >= kGmtNumGeoIds ){ + LOG_DEBUG << "GeoId " << geoId << " out of range in StGmtGeom::getPhysicalCoordinate." << endm; + module = kGmtError; + // layer = kGmtErrorChar; + layer = kGmtError; + return kGmtError; } - return computeGlobalPhysicalCoordinate( layer, strip); } - //////////// FIX ME!!!!!!!!!!!!!!!!!!!! +//________________ // The ordinate, lowerSpan and upperSpan are all in centimeters or // radians, depending on the layer. -Int_t StGmtGeom::getGlobalPhysicalCoordinate -( - const std::string & geoName, -// Short_t & module, Char_t & layer - Short_t & module, Int_t & layer -) -{ +Int_t StGmtGeom::getGlobalPhysicalCoordinate(const std::string & geoName, Short_t & module, Int_t & layer) { + Short_t strip; - - if ( decodeGeoName( geoName, module, layer, strip ) < 0 ) - { - // Error is mostly handled by the decodeGeoName call. - module = kGmtError; -// layer = kGmtErrorChar; - layer = kGmtError; - - return kGmtError; + if ( decodeGeoName( geoName, module, layer, strip ) < 0 ) { + // Error is mostly handled by the decodeGeoName call. + module = kGmtError; + // layer = kGmtErrorChar; + layer = kGmtError; + return kGmtError; } - return computeGlobalPhysicalCoordinate( layer, strip); - } - - - +//________________ // Please note that the following functions do NOT access the STAR // database to find mapping information. They assume the most // straight-forward mapping scheme and use that. // For those functions that have them, currently rdo can only be 1, arm // can be 0-1, apv can be 0-23 (although 4-11 are not // technically valid) and channel is 0-127. -Int_t StGmtGeom::encodeElectronicId //// WORKING -( - Int_t rdo, Int_t arm, Int_t apv, Int_t channel -) -{ - if ( (rdo - 1) < 0 || (rdo - 1) >= kGmtNumRdos ) - { - LOG_DEBUG << "RDO " << rdo << " out of range in StGmtGeom::encodeElectronicId." << endm; - return kGmtError; +Int_t StGmtGeom::encodeElectronicId(Int_t rdo, Int_t arm, Int_t apv, Int_t channel) { + if ( (rdo - 1) < 0 || (rdo - 1) >= kGmtNumRdos ) { + LOG_DEBUG << "RDO " << rdo << " out of range in StGmtGeom::encodeElectronicId." << endm; + return kGmtError; } - else if ( arm < 0 || arm >= kGmtNumArms ) - { - LOG_DEBUG << "ARM " << arm << " out of range in StGmtGeom::encodeElectronicId." << endm; - return kGmtError; + else if ( arm < 0 || arm >= kGmtNumArms ) { + LOG_DEBUG << "ARM " << arm << " out of range in StGmtGeom::encodeElectronicId." << endm; + return kGmtError; } - else if ( apv < 0 || apv > kGmtMaxApvId || (apv > 3 && apv < 12) ) - { - LOG_DEBUG << "APV " << apv << " out of range in StGmtGeom::encodeElectronicId." << endm; - return kGmtError; + else if ( apv < 0 || apv > kGmtMaxApvId || (apv > 3 && apv < 12) ) { + LOG_DEBUG << "APV " << apv << " out of range in StGmtGeom::encodeElectronicId." << endm; + return kGmtError; } - else if ( channel < 0 || channel >= kGmtNumChannels ) - { - LOG_DEBUG << "Channel " << channel << " out of range in StGmtGeom::encodeElectronicId." << endm; - return kGmtError; + else if ( channel < 0 || channel >= kGmtNumChannels ) { + LOG_DEBUG << "Channel " << channel << " out of range in StGmtGeom::encodeElectronicId." << endm; + return kGmtError; } - return channel + kGmtNumStrips*(apv + 4*arm); } -Int_t StGmtGeom::decodeElectronicId //// WORKING -( - Int_t elecId, - Int_t &rdo, Int_t &arm, Int_t &apv, Int_t &channel -) -{ - if ( elecId < 0 || elecId >= kGmtNumElecIds ) - { - LOG_DEBUG << "Electronic ID " << elecId << " out of range in StGmtGeom::decodeElectronicId." << endm; - - rdo = kGmtError; - arm = kGmtError; - apv = kGmtError; - channel = kGmtError; - - return kGmtError; +//________________ +Int_t StGmtGeom::decodeElectronicId(Int_t elecId, Int_t &rdo, Int_t &arm, Int_t &apv, Int_t &channel) { + if (elecId < 0 || elecId >= kGmtNumElecIds) { + LOG_DEBUG << "Electronic ID " << elecId << " out of range in StGmtGeom::decodeElectronicId." << endm; + rdo = kGmtError; + arm = kGmtError; + apv = kGmtError; + channel = kGmtError; + return kGmtError; } channel = elecId % 128; @@ -560,15 +415,13 @@ Int_t StGmtGeom::decodeElectronicId //// WORKING return 0; } - - // Whether the reverse map is valid Bool_t StGmtGeom::mReverseNaiveMappingValid = 0; // The reverse map data member Int_t StGmtGeom::mReverseNaiveMapping[ kGmtNumStripsPerModule ]; - +//________________________ // Initialize our physical coordinate database here. These are: // APV,Chan,Strip(0) or Pad(1),coordinate #,Location (cm),Signal *,Readout Order // The index corresponds to int(apv/2)+channel (assuming that the apv is in @@ -833,8 +686,9 @@ StGmtGeom::StGmtGeomData StGmtGeom::mStrips[] = {1,127,1,66,5.24,"P66",255} }; -// // This initialized an idealized mapping. The index of the array is the coordinate number (X coordinates are first then Y). -// // The value in the array is the readout number of the coordinate (i.e. the index into mStrips[] above). +//________________ +// This initialized an idealized mapping. The index of the array is the coordinate number (X coordinates are first then Y). +// The value in the array is the readout number of the coordinate (i.e. the index into mStrips[] above). Int_t StGmtGeom::mNaiveMapping[] = { 111, @@ -1095,37 +949,38 @@ Int_t StGmtGeom::mNaiveMapping[] = 224 }; +//________________ // Module locations at the corner of the GEM, // per email from W.J. Llope to stargmt-l@lists.bnl.gov // on 2012/10/31 - Double_t StGmtGeom::getModuleZ(int iModule) { - switch (iModule) { - case 4: - case 0 : return 77.768 * 2.54; // inches => cm - case 5: - case 1 : return 2.729 * 2.54; // inches => cm - case 7: - case 3 : return -2.729 * 2.54; // inches => cm - case 6: - case 2 : return -77.768 * 2.54; // inches => cm - default : return -999; - } + switch (iModule) { + case 4: + case 0 : return 77.768 * 2.54; // inches => cm + case 5: + case 1 : return 2.729 * 2.54; // inches => cm + case 7: + case 3 : return -2.729 * 2.54; // inches => cm + case 6: + case 2 : return -77.768 * 2.54; // inches => cm + default : return -999; + } } +//________________ Double_t StGmtGeom::getModulePhi(int iModule) { - double R = 85.606 * 2.54; // inches => cm - double deltaphi = 5./R; // crude radian conversion - switch (iModule) { - case 0: - case 1 : return TMath::Pi()*(10./6.)-deltaphi; - case 2: - case 3 : return TMath::Pi()*(10./6.)+deltaphi; - case 4: - case 5 : return TMath::Pi()*(1./6.)-deltaphi; - case 6: - case 7 : return TMath::Pi()*(1./6.)+deltaphi; - default : return 0; - } + double R = 85.606 * 2.54; // inches => cm + double deltaphi = 5./R; // crude radian conversion + switch (iModule) { + case 0: + case 1 : return TMath::Pi()*(10./6.)-deltaphi; + case 2: + case 3 : return TMath::Pi()*(10./6.)+deltaphi; + case 4: + case 5 : return TMath::Pi()*(1./6.)-deltaphi; + case 6: + case 7 : return TMath::Pi()*(1./6.)+deltaphi; + default : return 0; + } } diff --git a/StRoot/StGmtUtil/geometry/StGmtGeom.h b/StRoot/StGmtUtil/geometry/StGmtGeom.h index dbfc4479f17..61950b8422c 100644 --- a/StRoot/StGmtUtil/geometry/StGmtGeom.h +++ b/StRoot/StGmtUtil/geometry/StGmtGeom.h @@ -24,8 +24,8 @@ // program. However, because the data contained in this class is entirely // static, the class itself is also entirely static. class StGmtGeom { - public: - + + public: // For all functions where they appear: Disc can be >= 0 (in theory, // although only values 0-5 work at the moment, I believe). Quadrant // is 0-3. Layer is 'P' or 'R'. Strip is 0-720 @@ -205,12 +205,6 @@ class StGmtGeom { // Various constants used in Jan's conversion functions. static double mPi; static double mHalfPi; - // static double mRadStripOff; - // static double mPhiStripOff; - // static int mRadStripLOCId_number; - // static int mPhiStripLOCId_number; - // static double mStripOff; - // static double mPadOff; // ---Private member variables--- @@ -244,27 +238,5 @@ inline Int_t StGmtGeom::getOctant( Double_t phi ) { return i8; } -// inline std::string StGmtGeom::getNaiveGeoNameFromElecCoord -// ( -// Int_t rdo, Int_t arm, Int_t apv, Int_t channel -// ) -// { -// return -// translateGeoIdToGeoName( -// getNaiveGeoIdFromElecCoord( rdo, arm, apv, channel ) -// ); -// } -// -// inline Int_t StGmtGeom::getNaivePhysCoordFromElecCoord -// ( -// Int_t rdo, Int_t arm, Int_t apv, Int_t channel, -// Short_t & module, Char_t & layer -// ) -// { -// return getPhysicalCoordinate( -// getNaiveGeoIdFromElecCoord( rdo, arm, apv, channel ), -// module, layer); -// } - #endif