8#include "Identifier/Identifier.h"
23#include <unordered_set>
50 if(
m_idHelperSvc->mdtIdHelper().stationNameIndex(
"BMG") != -1){
52 ATH_MSG_INFO(
"Processing configuration for layouts with BMG chambers.");
56 for(
int side=-1; side<2; side+=2) {
58 for(
int roe=1; roe<=( muonDetMgr->
getMuonStation(
"BMG", side*
eta,
phi) )->nMuonReadoutElements(); roe++) {
68 return StatusCode::SUCCESS;
75 const EventContext& ctx,
87 return StatusCode::SUCCESS;
94 const EventContext& ctx,
106 return StatusCode::SUCCESS;
114 const EventContext& ctx,
119 std::vector<IdentifierHash> mdtHashList;
140 return StatusCode::SUCCESS;
147 const std::vector<IdentifierHash>& v_idHash,
153 if (v_idHash.empty()) {
155 return StatusCode::SUCCESS;
163 auto mdtCol = mdtPrds->indexFindPtr(
id);
165 if( mdtCol ==
nullptr ) {
166 ATH_MSG_DEBUG(
"MDT prep data collection not found in Hash ID" << (
int)
id);
169 if( mdtCol->size() == 0 ) {
170 ATH_MSG_DEBUG(
"MDT prep data collection is empty in Hash ID" << (
int)
id);
176 <<
" with size " << mdtCol->size()
177 <<
"in Hash ID" << (
int)
id);
179 mdtHits.reserve( mdtHits.size() + mdtCol->size() );
198 if(tmp.TubeLayer > TubeLayers) tmp.TubeLayer -= TubeLayers;
201 int Layer = (tmp.Multilayer-1)*TubeLayers + tmp.TubeLayer;
202 tmp.Layer = Layer - 1;
204 if(Layer==0 or tmp.Tube ==0)
continue;
206 int drift = mdt->tdc();
207 tmp.DriftTime = drift;
208 tmp.LeadingCoarseTime = (drift>>5) & 0xfff;
209 tmp.LeadingFineTime = drift & 0x1f;
210 tmp.Adc = mdt->adc();
217 std::copy_n(chamberType.begin(), std::min<size_t>(4, chamberType.size()), tmp.cType.begin());
218 tmp.readEle = mdtReadout;
220 int& chamber {tmp.Chamber};
221 char st = chamberType[1];
222 if (chamberType[0]==
'E') {
239 double &cXmid{tmp.cXmid}, &cYmid{tmp.cYmid}, &cPhip{tmp.cPhip};
241 if(!muonStation->
endcap()){
242 cXmid = (trans.translation()).z();
245 cXmid = (trans.translation()).perp();
246 cYmid = (trans.translation()).z();
250 cPhip = (trans.translation()).phi();
252 double &R {tmp.R}, &Z {tmp.Z};
253 R = -99999.; Z = -99999.;
254 R = mdtReadout->
center(tmp.TubeLayer, tmp.Tube).perp();
255 Z = mdtReadout->
center(tmp.TubeLayer, tmp.Tube).z();
258 double cphi = muonRoad.
phi[chamber][0];
260 dphi = std::abs(cPhip - cphi);
262 if(std::abs(cphi) >
M_PI/2.) {
263 double phi1 = (cPhip>0.)? cPhip-
M_PI : cPhip+
M_PI;
264 double phi2 = (cphi >0.)? cphi -
M_PI : cphi +
M_PI;
265 dphi = std::abs(phi1) + std::abs(phi2);
268 dphi = std::abs(cPhip) + std::abs(cphi);
272 if(muonStation->
endcap()==1) R = R *std::hypot(1, std::tan(dphi));
276 tmp.cInCo = 1./std::cos(std::atan(OrtoRadialPos/Rmin));
277 tmp.cPhi0 = cPhip - std::atan(OrtoRadialPos/Rmin);
278 if(cPhip<0. && (std::abs(
M_PI+cPhip) < 0.05) ) cPhip =
M_PI;
280 ATH_MSG_DEBUG(
" ...MDT hit Z/R/chamber/MultiLater/TubeLayer/Tube/Layer/adc/tdc = "
281 << Z <<
"/" << R <<
"/" << chamber <<
"/" << tmp.Multilayer <<
"/" << tmp.TubeLayer <<
"/"
282 << tmp.Tube <<
"/" << Layer <<
"/" << tmp.Adc <<
"/" << drift);
284 mdtHits.push_back(std::move(tmp));
289 return StatusCode::SUCCESS;
296 PVConstLink cv = mydetEl->getMaterialGeom();
297 int nGrandchildren = cv->getNChildVols();
298 if(nGrandchildren <= 0)
return;
300 std::vector<int> tubes;
301 geoGetIds ([&] (
int id) { tubes.push_back (
id); }, cv);
306 int name =
m_idHelperSvc->mdtIdHelper().stationName(detElId);
311 std::vector<int>::iterator it = tubes.begin();
312 for(
int layer = 1; layer <= mydetEl->
getNLayers(); layer++){
314 int want_id = layer*maxNTubesPerLayer + tube;
315 if (it != tubes.end() && *it == want_id) {
319 it = std::lower_bound (tubes.begin(), tubes.end(), want_id);
320 if (it != tubes.end() && *it == want_id) {
327 <<
"), phi(" <<
phi <<
"), eta(" <<
eta <<
"), name(" << name
328 <<
"), multilayerId(" << ml <<
") and identifier " << deadTubeId <<
" .");
Scalar eta() const
pseudorapidity method
Scalar perp() const
perp method - perpendicular length
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
Visitor to collect all IDs under a GeoModel node.
void geoGetIds(FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
Template helper for running the visitor.
const ServiceHandle< StoreGateSvc > & detStore() const
This is a "hash" representation of an Identifier.
static constexpr int maxNTubesPerLayer
The maxNTubesPerLayer represents the absolute maximum of tubes which are built into a single multilay...
int getNLayers() const
Returns the number of tube layers inside the multilayer.
int getMultilayer() const
Returns the multilayer represented by the readout element.
int getNtubesperlayer() const
Returns the number of tubes in each tube layer.
virtual const Amg::Vector3D & center(const Identifier &) const override final
Return the center of the surface associated with this identifier In the case of silicon it returns th...
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
const MuonStation * getMuonStation(const std::string &stName, int eta, int phi) const
int getStationPhi() const
double getStationS() const
Seems to be exclusively used by the MDTs --> Move it to MdtReadoutElement.
int getStationEta() const
const MuonStation * parentMuonStation() const
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
std::string getStationType() const
const Amg::Transform3D & getNominalAmdbLRSToGlobal() const
const Amg::Vector3D & getBlineFixedPointInAmdbLRS() const
double RsizeMdtStation() const
Class to represent measurements from the Monitored Drift Tubes.
bool isPresent() const
Is the referenced object present in SG?
StatusCode collectMdtHitsFromPrepData(const EventContext &ctx, const std::vector< IdentifierHash > &v_idHash, TrigL2MuonSA::MdtHits &mdtHits, const TrigL2MuonSA::MuonRoad &muonRoad) const
StatusCode prepareData(const EventContext &ctx, const TrigRoiDescriptor *p_roids, const TrigL2MuonSA::RpcFitResult &rpcFitResult, TrigL2MuonSA::MuonRoad &muonRoad, TrigL2MuonSA::MdtRegion &mdtRegion, TrigL2MuonSA::MdtHits &mdtHits) const
std::unordered_set< Identifier > m_DeadChannels
void initDeadChannels(const MuonGM::MdtReadoutElement *mydetEl)
virtual StatusCode initialize() override
StatusCode getMdtHits(const EventContext &ctx, const TrigRoiDescriptor *p_roids, TrigL2MuonSA::MuonRoad &muonRoad, TrigL2MuonSA::MdtHits &mdtHits) const
Gaudi::Property< bool > m_use_RoIBasedDataAccess
Gaudi::Property< bool > m_isPhase2
ToolHandle< IRegSelTool > m_regionSelector
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
ToolHandle< MdtRegionDefiner > m_mdtRegionDefiner
SG::ReadHandleKey< Muon::MdtPrepDataContainer > m_mdtPrepContainerKey
double phi[N_STATION][N_SECTOR]
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
Eigen::Affine3d Transform3D
std::vector< MdtHitData > MdtHits
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
@ BarrelInner
Inner station in the barrel spectrometer.
@ EndcapOuter
Outer station in the endcap spectrometer.
@ BarrelMiddle
Middle station in the barrel spectrometer.
@ EndcapMiddle
Middle station in the endcap spectrometer.
@ BEE
BEE measurement point.
@ EndcapExtra
Extra station in the endcap spectrometer.
@ BarrelOuter
Outer station in the barrel spectrometer.
@ BME
BME measurement point.
@ EndcapInner
Inner station in the endcap spectrometer.