![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "GaudiKernel/SystemOfUnits.h"
18 template<
typename VType>
bool isEqual(
const std::vector<VType>&
a,
19 const std::vector<VType>&
b) {
20 if (
a.size() !=
b.size()) {
23 for (
size_t k =0 ;
k <
a.size() ; ++
k) {
24 if ( std::abs(
a[
k] -
b[
k]) > std::numeric_limits<VType>::epsilon()){
30 template <
typename VType> std::ostream&
operator<<(std::ostream& ostr,
const std::vector<VType>&
v){
31 for (
size_t k = 0 ;
k <
v.size(); ++
k){
33 if (
k+1 !=
v.size())ostr<<
",";
37 template <
typename VType> std::ostream&
operator<<(std::ostream& ostr,
const std::set<VType>&
s){
39 for (
const VType& ele :
s){
41 if (
k !=
s.size()) ostr<<
";";
63 std::abs(
wirePitch -
other.wirePitch) < std::numeric_limits<float>::epsilon();
69 m_gaps[grp.techType].insert(grp.gasGap);
78 const std::map<std::string, std::set<Identifier>>&
allGaps()
const{
return m_gaps; }
83 std::map<std::string, std::set<Identifier>>
m_gaps{};
92 return StatusCode::SUCCESS;
100 if (testCham.size() != 7) {
102 return StatusCode::FAILURE;
105 std::string statName = testCham.substr(0, 3);
106 unsigned int statEta =
std::atoi(testCham.substr(3, 1).c_str()) *
107 (testCham[4] ==
'A' ? 1 : -1);
108 unsigned int statPhi =
std::atoi(testCham.substr(5, 2).c_str());
109 bool is_valid{
false};
111 id_helper.elementID(statName, statEta, statPhi, is_valid);
113 ATH_MSG_FATAL(
"Failed to deduce a station name for " << testCham);
114 return StatusCode::FAILURE;
120 for(
auto itr = id_helper.detectorElement_begin();
121 itr!= id_helper.detectorElement_end();++itr){
125 return StatusCode::SUCCESS;
128 const EventContext& ctx{Gaudi::Hive::currentContext()};
130 if (!detMgr.isValid()) {
133 return StatusCode::FAILURE;
145 if (reElement->
identify() != test_me) {
147 <<
m_idHelperSvc->toStringDetEl(test_me) <<
". But got instead "
149 return StatusCode::FAILURE;
159 <<
" perp: "<<center.perp()
168 return StatusCode::SUCCESS;
201 for (
bool isStrip : {
false,
true}) {
205 if (!nChan)
continue;
218 for (
int strip = 1; strip <=
nStrips(*readoutEle,
layer); ++strip) {
219 bool is_valid{
false};
221 if (!is_valid)
continue;
229 return StatusCode::FAILURE;
234 const double stripHalfLength = readoutEle->
stripLength() / 2.;
238 const Amg::Vector3D globStripBot{surf.localToGlobal(locStripBot)};
239 const Amg::Vector3D globStripTop{surf.localToGlobal(locStripTop)};
263 return StatusCode::FAILURE;
276 return m_tree.
fill(ctx) ? StatusCode::SUCCESS : StatusCode::FAILURE;
285 std::map<Identifier, TgcChamberLayout> allLayouts{};
287 itr != idHelper.module_end(); ++itr) {
289 if (!reEle)
continue;
290 for (
bool isStrip : {
false,
true}) {
299 const double sign = (reEle->
getStationEta()> 0. ? -1. : 1.) *( (globToLoc*Amg::Vector3D::UnitY()).
x() > 0 ? 1. : -1);
301 for (
int strip = 1; strip < 33; ++strip) {
306 if (strip != 32)
continue;
311 unsigned int accumlWires{0};
333 std::vector<ChamberGrp> groupedLayouts{};
334 for (
const auto& lay : allLayouts) {
337 if (grp.addChamber(lay.second)){
342 if (!added) groupedLayouts.emplace_back(lay.second);
345 std::stable_sort(groupedLayouts.begin(),groupedLayouts.end(),
347 return a.layout().techType < b.layout().techType;
350 ATH_MSG_INFO(
"Found in total "<<groupedLayouts.size()<<
" different chamber layouts");
351 xmlStream<<
"<Table name=\"TgcSensorLayout\">"<<std::endl;
353 for (
const ChamberGrp& grp : groupedLayouts) {
354 for (
const auto& [tech_type, gapIds]: grp.allGaps()) {
355 std::set<int> gaps{};
356 std::set<char> sides{};
359 sides.insert(
m_idHelperSvc->stationEta(gapId) > 0 ?
'A' :
'C');
362 xmlStream<<
"TGCSENSORLAYOUT_DATA_ID=\""<<
counter<<
"\" ";
363 xmlStream<<
"technology=\""<<tech_type<<
"\" ";
364 xmlStream<<
"gasGap=\""<<gaps<<
"\" ";
365 xmlStream<<
"side=\""<<sides<<
"\" ";
366 xmlStream<<
"wirePitch=\""<<grp.layout().wirePitch<<
"\" ";
367 xmlStream<<
"wireGangs=\""<<grp.layout().wireGangLayout<<
"\" ";
368 xmlStream<<
"bottomStrips=\""<<grp.layout().botStripPos<<
"\" ";
369 xmlStream<<
"topStrips=\""<<grp.layout().topStripPos<<
"\" ";
370 xmlStream<<
" />"<<std::endl;
374 xmlStream<<
"</Table> "<<std::endl;
std::vector< double > topStripPos
double physicalDistanceFromBase() const
virtual int numberOfLayers(bool isStrip) const override
number of layers in phi/eta projection
double stripPosOnShortBase(int strip) const
std::vector< double > botStripPos
MuonVal::ScalarBranch< float > & m_shortWidth
virtual const Amg::Transform3D & transform() const override
Return local to global transform.
double getALine_trat() const
std::ostream & operator<<(std::ostream &os, const AlignPos &p)
StatusCode dumpToTree(const EventContext &ctx, const TgcReadoutElement *readoutEle)
Ensure that the Athena extensions are properly loaded.
const Amg::Transform3D & absTransform() const
MuonVal::ThreeVectorBranch m_gangCenter
MuonVal::MuonTesterTree m_tree
Write a TTree for validation purposes.
MuonVal::CoordTransformBranch m_readoutTransform
Transformation of the readout element (Translation, ColX, ColY, ColZ)
StatusCode init(OWNER *instance)
Initialize method.
double stripHighEdgeLocX(int gasGap, int strip, double radialPos) const
Returns the local X of the right edge of the strip at a given local radial position.
MuonVal::VectorBranch< float > & m_layHeight
virtual const Amg::Vector3D & center() const override
Return the center of the element.
MuonVal::TwoVectorBranch m_locStripBottom
Eigen::Matrix< double, 2, 1 > Vector2D
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
MuonDetectorManager from the conditions store.
StatusCode initialize() override
double getALine_rotz() const
double getALine_traz() const
MuonVal::VectorBranch< float > & m_stripLongWidth
MuonVal::VectorBranch< float > & m_layShortWidth
MuonVal::TwoVectorBranch m_locStripCenter
double getALine_tras() const
StatusCode execute() override
Gaudi::Property< std::string > m_readoutXML
double stripLength() const
Returns the length of each strip which is equal to the height of the chamber.
MuonVal::VectorBranch< float > & m_stripLength
const std::string & getTechnologyName() const
MuonVal::ScalarBranch< short > & m_stPhi
#define ATH_MSG_VERBOSE(x)
MuonVal::VectorBranch< uint8_t > & m_gangNumWires
double getLongSsize() const
MuonVal::ScalarBranch< short > & m_stEta
MuonVal::VectorBranch< unsigned int > & m_gangNum
MuonVal::ScalarBranch< float > & m_ALineTransZ
MuonVal::VectorBranch< float > & m_gangLength
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
double stripLowEdgeLocX(int gasGap, int strip, double radialPos) const
Returns the local X of the left edge of the strip at a given local radial position.
int nGasGaps() const
Returns the number of gas gaps associated with the readout element (2 or 3)
MuonVal::ThreeVectorBranch m_stripCenter
Amg::Vector3D wireGangPos(const Identifier &id) const
Returns the global position of a wireGang.
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
MuonVal::ScalarBranch< float > & m_ALineTransS
Alignment parameters.
TgcChamberLayout & layout()
MuonVal::VectorBranch< unsigned int > & m_stripNum
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
double getLongRsize() const
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
bool isEqual(const std::vector< VType > &a, const std::vector< VType > &b)
MuonVal::ScalarBranch< float > & m_ALineTransT
MuonVal::ScalarBranch< uint8_t > & m_nGasGaps
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
double gangLongWidth(int gasGap, int gang) const
Returns the length of the most top wire in the gang.
void push_back(const Amg::Vector2D &vec)
interface using the Amg::Vector3D
double getALine_rott() const
std::set< Identifier > m_testStations
Set of stations to be tested.
double getLongZsize() const
::StatusCode StatusCode
StatusCode definition for legacy code.
double gangShortWidth(int gasGap, int gang) const
Returns the length of the most bottom wire in the gang.
int nWires(int gasGap) const
Returns the total number of wires in a given gas gap.
const MuonStation * parentMuonStation() const
Eigen::Affine3d Transform3D
const TgcChamberLayout & layout() const
MuonVal::ScalarBranch< float > & m_thickness
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
bool operator==(const TgcChamberLayout &other) const
MuonVal::ScalarBranch< std::string > & m_stLayout
const Amg::Transform3D & getNativeToAmdbLRS() const
MuonVal::ScalarBranch< float > & m_height
std::vector< int > wireGangLayout
int nStrips(int gasGap) const
Returns the number of strips in a given gas gap.
MuonVal::ThreeVectorBranch m_stripBottom
MuonVal::CoordSystemsBranch m_layTans
StatusCode finalize() override
int nWireGangs(int gasGap) const
Returns the number of wire gangs (Random grouping of wires) in a given gas gap.
MuonVal::VectorBranch< uint16_t > & m_layNumWires
const GeoAlignableTransform * getGeoTransform() const
void push_back(const T &value)
Adds a new element at the end of the vector.
MuonVal::TwoVectorBranch m_locStripTop
int nStrips(const MuonGM::TgcReadoutElement &readoutEle, int layer)
MuonVal::VectorBranch< float > & m_stripShortWidth
double stripLongWidth(int, int) const
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
MuonVal::TwoVectorBranch m_locGangPos
bool addChamber(const TgcChamberLayout &lay)
void dumpReadoutXML(const MuonGM::MuonDetectorManager &detMgr)
const std::map< std::string, std::set< Identifier > > & allGaps() const
MuonVal::VectorBranch< uint8_t > & m_stripGasGap
MuonVal::VectorBranch< uint8_t > & m_layNumber
StatusCode initialize(bool used=true)
Eigen::Matrix< double, 3, 1 > Vector3D
double wirePitch() const
Returns the pitch of the wires.
MuonVal::VectorBranch< bool > & m_layMeasPhi
double stripShortWidth(int, int) const
Gaudi::Property< std::vector< std::string > > m_selectStat
String should be formated like <stationName><stationEta><A/C><stationPhi>
MuonVal::VectorBranch< float > & m_layLongWidth
double stripPitch(int gasGap, int strip) const
Returns the pitch of the given strip in gasGap i.
int getStationIndex() const
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
GeoModelTgcTest(const std::string &name, ISvcLocator *pSvcLocator)
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
MuonVal::VectorBranch< float > & m_stripPitch
void push_back(const Amg::Transform3D &trans)
double stripPosOnLargeBase(int strip) const
bool fill(const EventContext &ctx)
Fills the tree per call.
StatusCode write()
Finally write the TTree objects.
MuonVal::CoordTransformBranch m_alignableNode
std::vector< Identifier >::const_iterator const_id_iterator
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
ChamberGrp(const TgcChamberLayout &grp)
MuonVal::VectorBranch< uint8_t > & m_gangGasGap
std::map< std::string, std::set< Identifier > > m_gaps
MuonVal::ScalarBranch< float > & m_ALineRotZ
MuonVal::ThreeVectorBranch m_stripTop
double getALine_rots() const
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
MuonVal::ScalarBranch< float > & m_ALineRotT
MuonVal::ScalarBranch< float > & m_ALineRotS
MuonVal::ScalarBranch< unsigned short > & m_stIndex
Identifier of the readout element.
int getStationPhi() const
int getStationEta() const
MuonVal::ScalarBranch< float > & m_longWidth