Skip to content
Snippets Groups Projects
Commit 6872f29c authored by Ishan Kiritbhai Vyas's avatar Ishan Kiritbhai Vyas Committed by Edward Moyse
Browse files

PadDesign - Fixing sTgc Pad Positions

Fixing padCorner function, adding 1.5 to beamlineRadius temporarily until it is fixed, modifying globalChannelPosition function to be more efficient
parent b31952fd
No related branches found
No related tags found
No related merge requests found
......@@ -66,6 +66,8 @@ class sTgcReadoutGeomTool : public AthAlgTool,
double sPadLength{0.};
double gasTck{0.}; //gasTck
double lFrameWidth{0.}; //ylFrame
double sFrameWidth{0.}; //ysFrame
};
struct FactoryCache {
......
......@@ -178,7 +178,9 @@ StatusCode sTgcReadoutGeomTool::loadDimensions(sTgcReadoutElement::defineArgs& d
define.stripLayers.push_back(std::move(stripLayer));
if (!define.stripDesign) define.stripDesign = stripDesign;
///Pads
double beamlineRadius = define.physVol->getAbsoluteTransform().translation().perp();
/// defining frameOffset to correct the beamlineRadius
double frameOffset = -0.5 * (paramBook.lFrameWidth - paramBook.sFrameWidth);
double beamlineRadius = frameOffset + define.physVol->getAbsoluteTransform().translation().perp();
padDesign->defineBeamlineRadius(beamlineRadius);
ATH_MSG_DEBUG("The beamline radius is: " << beamlineRadius);
StripLayer padLayer(gapVol.transform * Amg::getRotateY3D(180* Gaudi::Units::deg), padDesign, sTgcReadoutElement::createHash(gasGap, sTgcIdHelper::Pad, 0));
......@@ -288,6 +290,8 @@ StatusCode sTgcReadoutGeomTool::readParameterBook(FactoryCache& cache) {
parBook.sPadLength = record->getDouble("sPadWidth");
parBook.gasTck = record->getDouble("gasTck");
parBook.lFrameWidth = record->getDouble("ylFrame");
parBook.sFrameWidth = record->getDouble("ysFrame");
ATH_MSG_ALWAYS("Parameters of the chamber " << key << " are: "
<< " numStrips: " << parBook.numStrips
......@@ -311,7 +315,9 @@ StatusCode sTgcReadoutGeomTool::readParameterBook(FactoryCache& cache) {
<< " firstPadPhiDivision: " << parBook.firstPadPhiDivision
<< " lPadLength: " << parBook.lPadLength
<< " sPadLength: " << parBook.sPadLength
<< " gasGapTck: " << parBook.gasTck);
<< " gasGapTck: " << parBook.gasTck
<< " lFrameWidth: " << parBook.lFrameWidth
<< " sFrameWidth: " << parBook.sFrameWidth);
}
return StatusCode::SUCCESS;
}
......
......@@ -460,7 +460,6 @@ std::set<sTgcChamber> readTreeDump(const std::string& inputFile) {
newWireGroup.gasGap = (*wireGroupGasGap)[wg];
newWireGroup.channelNumber = (*wireGroupNum)[wg];
newWireGroup.channelType = 2;
if (newWireGroup.channelNumber > 0) continue;
newchamber.channels.insert(std::move(newWireGroup));
}
......@@ -472,7 +471,6 @@ std::set<sTgcChamber> readTreeDump(const std::string& inputFile) {
newStrip.gasGap = (*stripGasGap)[s];
newStrip.channelNumber = (*stripNum)[s];
newStrip.channelType = 1;
if (newStrip.channelNumber > 0 && newStrip.channelNumber < newchamber.numStrips) continue;
newchamber.channels.insert(std::move(newStrip));
}
......@@ -496,7 +494,6 @@ std::set<sTgcChamber> readTreeDump(const std::string& inputFile) {
newPad.gasGap = (*padGasGap)[p];
newPad.padEta = (*padEta)[p];
newPad.padPhi = (*padPhi)[p];
if (newPad.padEta > 1 || newPad.padPhi > 2) continue;
newchamber.pads.insert(std::move(newPad));
}
......@@ -709,7 +706,7 @@ int main( int argc, char** argv ) {
}
const sTgcPad& testPad{*pad_itr};
/// Local Pad position dump
const Amg::Vector2D diffLocalPadPos{testPad.localPosition - testPad.localPosition};
const Amg::Vector2D diffLocalPadPos{testPad.localPosition - refPad.localPosition};
if (diffLocalPadPos.mag() > tolerance) {
std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
<<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " local position: "
......@@ -753,9 +750,9 @@ int main( int argc, char** argv ) {
<<" displacement: "<<Amg::toString(diffLocalPadCornerTR,2)<<std::endl;
chamberOkay = false;
}
/// Global Pad position dump
const Amg::Vector3D diffGlobalPadPos{testPad.globalPosition - testPad.globalPosition};
const Amg::Vector3D diffGlobalPadPos{testPad.globalPosition - refPad.globalPosition};
if (diffGlobalPadPos.mag() > tolerance) {
std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
<<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " global position: "
......@@ -772,6 +769,7 @@ int main( int argc, char** argv ) {
<<" displacement: "<<Amg::toString(diffGlobalPadCornerBL,2)<<std::endl;
chamberOkay = false;
}
/// bottom-right pad corner
const Amg::Vector3D diffGlobalPadCornerBR{testPad.globalPadCornerBR - refPad.globalPadCornerBR};
if (diffGlobalPadCornerBR.mag() > tolerance) {
......
......@@ -42,6 +42,7 @@ namespace MuonGMR4 {
inline double PadDesign::beamlineRadius() const {
return m_radius;
}
using localCornerArray = std::array<Amg::Vector2D, 4>;
inline localCornerArray PadDesign::padCorners(const int channel) const {
return padCorners(padEtaPhi(channel));
......
......@@ -95,12 +95,19 @@ namespace MuonGMR4{
double cosRight = botBase / std::hypot(botRightPoint, botBase);
double cosLeft = botBase / std::hypot(botLeftPoint, botBase);
/// Adjusting the four corners of the pads for staggering in x direction w.r.t. the chamber origin
/// Outer edges of the trapezoid do not undergo staggering. Hence the if condition.
if (padPhi > 1 && padPhi < numPadPhi()) {
botLeftPoint += padPhiShift() * cosLeft;
botRightPoint += padPhiShift() * cosRight;
topLeftPoint += padPhiShift() * cosLeft;
topRightPoint += padPhiShift() * cosRight;
botLeftPoint += padPhiShift() * cosLeft;
botRightPoint += padPhiShift() * cosRight;
topLeftPoint += padPhiShift() * cosLeft;
topRightPoint += padPhiShift() * cosRight;
/// Outer edges of the trapezoid do not undergo staggering. Hence the if conditions.
double adjHeight = /*yCutout()? 2 * halfWidth() - yCutout() :*/ 2 * halfWidth();
if(padPhi == 1) {
botRightPoint = shortHalfHeight() + ((longHalfHeight() - shortHalfHeight()) * (botEdge - maxBottom) / adjHeight);
topRightPoint = shortHalfHeight() + ((longHalfHeight() - shortHalfHeight()) * (topEdge - maxBottom) / adjHeight);
}
if(padPhi == numPadPhi()) {
botLeftPoint = -shortHalfHeight() - ((longHalfHeight() - shortHalfHeight()) * (botEdge - maxBottom) / adjHeight);
topLeftPoint = -shortHalfHeight() - ((longHalfHeight() - shortHalfHeight()) * (topEdge - maxBottom) / adjHeight);
}
/// Adjusting the outer edges of the pads in diamond chambers (QL3)
/// There are pads in the outer columns that may contain five vertices when the topEdge of the pad is above the
......
......@@ -149,29 +149,22 @@ Amg::Vector2D sTgcReadoutElement::localChannelPosition(const IdentifierHash& mea
return Amg::Vector2D::Zero();
}
}
Amg::Vector3D sTgcReadoutElement::globalChannelPosition(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {
const IdentifierHash lHash = layerHash(measHash);
unsigned int layIdx = static_cast<unsigned int>(lHash);
unsigned int gasGap = gasGapNumber(measHash);
if (chType(measHash) == ReadoutChannelType::Strip && gasGap < m_pars.stripLayers.size()) {
return localToGlobalTrans(ctx, lHash) * m_pars.stripLayers[gasGap].localStripPos(channelNumber(measHash));
}
else if (chType(measHash) == ReadoutChannelType::Wire && gasGap < m_pars.wireGroupLayers.size()) {
Amg::Vector3D wireGrPos{Amg::Vector3D::Zero()};
Amg::Vector2D localWireGroup = localChannelPosition(measHash);
wireGrPos.block<2,1>(0,0) = std::move(localWireGroup);
return localToGlobalTrans(ctx, lHash) * wireGrPos;
}
else if (chType(measHash) == ReadoutChannelType::Pad && gasGap < m_pars.padLayers.size()) {
Amg::Vector3D padPos{Amg::Vector3D::Zero()};
Amg::Vector2D localPad = localChannelPosition(measHash);
padPos.block<2,1>(0,0) = std::move(localPad);
return localToGlobalTrans(ctx, lHash) * padPos;
}
ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The layer hash "<<layIdx
<<" is out of range. Maximum range "<<m_pars.stripLayers.size());
return Amg::Vector3D::Zero();
if((chType(measHash) < ReadoutChannelType::Pad || chType(measHash) > ReadoutChannelType::Wire) && gasGap < m_pars.padLayers.size()) {
ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The channel type "<<chType(measHash)
<<"with the layer hash "<<layIdx<<" is invalid. Maximum range "<<m_pars.stripLayers.size());
return Amg::Vector3D::Zero();
}
Amg::Vector3D channelPos{Amg::Vector3D::Zero()};
Amg::Vector2D localChannel = localChannelPosition(measHash);
channelPos.block<2,1>(0,0) = std::move(localChannel);
return localToGlobalTrans(ctx, lHash) * channelPos;
}
using localCornerArray = std::array<Amg::Vector2D, 4>;
using globalCornerArray = std::array<Amg::Vector3D, 4>;
globalCornerArray sTgcReadoutElement::globalPadCorners(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment