ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
MuonML::Factory Namespace Reference

Functions

NodeFeatureList::Feature_t makeFeature (const std::string &featName, MsgStream &log)
 Factory function that builds a NodeFeature from a predefined list of features. More...
 
NodeFeatureList::Connector_t makeConnector (const std::string &connName, MsgStream &log)
 Factory function that builds a connector relation between two edges in the bucket. More...
 

Function Documentation

◆ makeConnector()

NodeFeatureList::Connector_t MuonML::Factory::makeConnector ( const std::string &  connName,
MsgStream &  log 
)

Factory function that builds a connector relation between two edges in the bucket.

Parameters
connNameName of the connection function inside the predefined list
logRefetrence to the message object for logging

Definition at line 128 of file NodeFeatureFactory.cxx.

128  {
129 
130  static const std::set<Connector_t, std::less<>> connectorPool{
131  std::make_unique<NodeConnector>("fullyConnected",
132  [](const Bucket_t& , size_t , size_t ) {
133  return true;
134  }),
135  };
136  const auto feat_itr = connectorPool.find(connName);
137  if(feat_itr != connectorPool.end()){
138  if (log.level() <= MSG::DEBUG) {
139  log<<MSG::DEBUG<<"Found graph connector "<<connName<<"."<<endmsg;
140  }
141  return *feat_itr;
142  }
143  std::stringstream available{};
144  for (const Connector_t& known : connectorPool) {
145  available<<known->name()<<", ";
146  }
147  log<<MSG::ERROR<<"The graph connector "<<connName<<" is unknown to the factory. "
148  <<" Please check for typos w.r.t "<<available.str()<<". Otherwise augment "
149  <<__FILE__<<" with your desired connection function. "<<endmsg;
150  return nullptr;
151  }

◆ makeFeature()

Feature_t MuonML::Factory::makeFeature ( const std::string &  featName,
MsgStream &  log 
)

Factory function that builds a NodeFeature from a predefined list of features.

Parameters
featNameName of the feature inside the list
logRefetrence to the message object for logging

Definition at line 38 of file NodeFeatureFactory.cxx.

38  {
39  static const std::set<Feature_t, std::less<>> featurePool{
40  std::make_unique<NodeFeature>("localX",
41  [](const Bucket_t& bucket, size_t index) {
42  return bucket[index]->positionInChamber().x();
43  }),
44  std::make_unique<NodeFeature>("localY",
45  [](const Bucket_t& bucket, size_t index) {
46  return bucket[index]->positionInChamber().y();
47  bucket[index]->positionInChamber().y();
48  }),
49  std::make_unique<NodeFeature>("localZ",
50  [](const Bucket_t& bucket, size_t index) {
51  return bucket[index]->positionInChamber().z();
52  }),
53  std::make_unique<NodeFeature>("stationIndex",
54  [](const Bucket_t& bucket, size_t index) {
55  return bucket[index]->msSector()->idHelperSvc()->stationName(bucket[index]->identify());
56  }),
57  std::make_unique<NodeFeature>("stationPhi",
58  [](const Bucket_t& bucket, size_t index) {
59  return bucket[index]->msSector()->idHelperSvc()->stationPhi(bucket[index]->identify());
60  }),
61  std::make_unique<NodeFeature>("stationEta",
62  [](const Bucket_t& bucket, size_t index) {
63  return bucket[index]->msSector()->idHelperSvc()->stationEta(bucket[index]->identify());
64  }),
65  std::make_unique<NodeFeature>("driftR",
66  [](const Bucket_t& bucket, size_t index) {
67  return bucket[index]->driftRadius();
68  }),
69  std::make_unique<NodeFeature>("relative_layer",
70  [](const Bucket_t& bucket, size_t index) {
71  const double relLayNum = (1 + 1.*bucket.layerNum(index)) / (bucket.nStripLayers() + bucket.nMdtLayers());
72  return relLayNum;
73  }),
74  std::make_unique<NodeFeature>("neighbors",
75  [](const Bucket_t& bucket, size_t index) {
76  constexpr double radCut2 = (50.*Gaudi::Units::cm * 50.*Gaudi::Units::cm);
77  unsigned int n =0;
78  for (size_t other =0 ; other < bucket.size(); ++ other){
79  n+= index != other && (bucket[index]->positionInChamber() - bucket[other]->positionInChamber()).perp2() < radCut2;
80  }
81  return n;
82  }),
83  std::make_unique<NodeFeature>("bucket_density",
84  [](const Bucket_t& bucket, size_t /*index*/) {
85 
86  return 1.*bucket.size() / std::max(bucket.coveredMax() - bucket.coveredMin(), 1. * Gaudi::Units::cm);
87  }),
88  std::make_unique<NodeFeature>("isolation",
89  [](const Bucket_t& bucket, size_t index) {
90  unsigned int neighbors = 0;
91  constexpr double radCut2 = (50.*Gaudi::Units::cm * 50.*Gaudi::Units::cm);
92  for (size_t other =0 ; other < bucket.size(); ++ other){
93  neighbors+= index != other && (bucket[index]->positionInChamber() - bucket[other]->positionInChamber()).perp2() < radCut2;
94  }
95 
96  float bucket_density = 1.f*bucket.size() / std::max(bucket.coveredMax() - bucket.coveredMin(), 1. * Gaudi::Units::cm);
97  return neighbors / bucket_density;
98  }),
99  std::make_unique<NodeFeature>("covX",
100  [](const Bucket_t& bucket, size_t index) {
101  return bucket[index]->covariance()(Amg::x, Amg::x);
102  }),
103  std::make_unique<NodeFeature>("covY",
104  [](const Bucket_t& bucket, size_t index) {
105  return bucket[index]->covariance()(Amg::y, Amg::y);
106  }),
107  std::make_unique<NodeFeature>("covXY",
108  [](const Bucket_t& bucket, size_t index) {
109  return bucket[index]->covariance()(Amg::x, Amg::y);
110  }),
111  };
112  const auto feat_itr = featurePool.find(featName);
113  if(feat_itr != featurePool.end()){
114  if (log.level() <= MSG::DEBUG) {
115  log<<MSG::DEBUG<<"Found graph feature "<<featName<<"."<<endmsg;
116  }
117  return *feat_itr;
118  }
119  std::stringstream available{};
120  for (const Feature_t& known : featurePool) {
121  available<<known->name()<<", ";
122  }
123  log<<MSG::ERROR<<"The feature "<<featName<<" is unknown to the feature factory. "
124  <<" Please check for typos w.r.t "<<available.str()<<". Otherwise augment "
125  <<__FILE__<<" with your desired feature "<<endmsg;
126  return nullptr;
127  }
Muon::nsw::STGTPSegments::moduleIDBits::stationPhi
constexpr uint8_t stationPhi
station Phi 1 to 8
Definition: NSWSTGTPDecodeBitmaps.h:161
xAOD::identify
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
Definition: MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/UtilFunctions.cxx:61
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
index
Definition: index.py:1
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
Amg::y
@ y
Definition: GeoPrimitives.h:35
perp2
Scalar perp2() const
perp2 method - perpendicular length squared
Definition: AmgMatrixBasePlugin.h:36
x
#define x
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
z
#define z
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Amg::x
@ x
Definition: GeoPrimitives.h:34
DeMoScan.index
string index
Definition: DeMoScan.py:364
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
y
#define y
known
Definition: TrigBStoxAODTool.cxx:107
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonML::Connector_t
NodeFeatureList::Connector_t Connector_t
Definition: NodeFeatureFactory.cxx:14
Muon::nsw::STGTPSegments::moduleIDBits::stationEta
constexpr uint8_t stationEta
1 to 3
Definition: NSWSTGTPDecodeBitmaps.h:159
MuonML::Bucket_t
NodeFeature::Bucket_t Bucket_t
Definition: NodeFeatureFactory.cxx:15
MuonML::Feature_t
NodeFeatureList::Feature_t Feature_t
Definition: NodeFeatureFactory.cxx:13