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.");
68 return StatusCode::SUCCESS;
75 const EventContext& ctx,
83 ATH_CHECK( m_mdtRegionDefiner->getMdtRegions(p_roids, rpcFitResult, muonRoad, mdtRegion) );
85 ATH_CHECK( getMdtHits(ctx, p_roids, muonRoad, mdtHits) );
87 return StatusCode::SUCCESS;
94 const EventContext& ctx,
102 ATH_CHECK( m_mdtRegionDefiner->getMdtRegions(p_roids, tgcFitResult, muonRoad, mdtRegion) );
104 ATH_CHECK( getMdtHits(ctx, p_roids, muonRoad, mdtHits) );
106 return StatusCode::SUCCESS;
114 const EventContext& ctx,
119 std::vector<IdentifierHash> mdtHashList;
121 if (m_use_RoIBasedDataAccess) {
125 m_regionSelector->lookup(ctx)->HashIDList(*p_roids, mdtHashList);
133 m_regionSelector->lookup( ctx )->HashIDList(fullscan_roi, mdtHashList);
138 ATH_CHECK( collectMdtHitsFromPrepData(ctx, mdtHashList, mdtHits, muonRoad) );
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);
175 << m_idHelperSvc->toStringChamber(mdtCol->identify())
176 <<
" with size " << mdtCol->size()
177 <<
"in Hash ID" << (
int)
id);
179 mdtHits.reserve( mdtHits.size() + mdtCol->size() );
185 if(m_idHelperSvc->mdtIdHelper().stationName(
id) == m_BMGid && m_DeadChannels.count(
id)) {
186 ATH_MSG_DEBUG(
"Skipping tube with identifier " << m_idHelperSvc->toString(
id) );
197 tmp.TubeLayer = m_idHelperSvc->mdtIdHelper().tubeLayer(
id);
198 if(
tmp.TubeLayer > TubeLayers)
tmp.TubeLayer -= TubeLayers;
199 tmp.Tube = m_idHelperSvc->mdtIdHelper().tube(
id);
201 int Layer = (
tmp.Multilayer-1)*TubeLayers +
tmp.TubeLayer;
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();
212 tmp.name = m_idHelperSvc->mdtIdHelper().stationName(
id);
217 std::copy_n(chamberType.begin(), std::min<size_t>(4, chamberType.size()),
tmp.cType.begin());
218 tmp.readEle = mdtReadout;
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.;
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));
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);
302 std::sort (tubes.begin(), tubes.end());
306 int name = m_idHelperSvc->mdtIdHelper().stationName(detElId);
307 int eta = m_idHelperSvc->mdtIdHelper().stationEta(detElId);
308 int phi = m_idHelperSvc->mdtIdHelper().stationPhi(detElId);
309 int ml = m_idHelperSvc->mdtIdHelper().multilayer(detElId);
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) {
325 m_DeadChannels.insert(deadTubeId);
327 <<
"), phi(" <<
phi <<
"), eta(" <<
eta <<
"), name(" <<
name
328 <<
"), multilayerId(" << ml <<
") and identifier " << deadTubeId <<
" .");