30 const std::string&
name,
33 m_regionSelector(
"RegSelTool/RegSelTool_MDT",this),
49 ATH_CHECK( m_mdtRegionDefiner.retrieve() );
59 m_BMGpresent = m_idHelperSvc->mdtIdHelper().stationNameIndex(
"BMG") != -1;
61 ATH_MSG_INFO(
"Processing configuration for layouts with BMG chambers.");
62 m_BMGid = m_idHelperSvc->mdtIdHelper().stationNameIndex(
"BMG");
63 for(
int phi=6; phi<8; phi++) {
64 for(
int eta=1; eta<4; eta++) {
67 for(
int roe=1; roe<=( muonDetMgr->
getMuonStation(
"BMG",
side*eta, phi) )->nMuonReadoutElements(); roe++) {
70 if(mdtRE) initDeadChannels(mdtRE);
77 ATH_CHECK(m_mdtPrepContainerKey.initialize());
79 return StatusCode::SUCCESS;
92 ATH_CHECK( m_mdtRegionDefiner->getMdtRegions(p_roids, rpcFitResult, muonRoad, mdtRegion) );
94 ATH_CHECK( getMdtHits(p_roids, muonRoad, mdtHits_normal) );
96 return StatusCode::SUCCESS;
109 ATH_CHECK( m_mdtRegionDefiner->getMdtRegions(p_roids, tgcFitResult, muonRoad, mdtRegion) );
111 ATH_CHECK( getMdtHits(p_roids, muonRoad, mdtHits_normal) );
113 return StatusCode::SUCCESS;
128 std::vector<uint32_t> v_robIds;
129 std::vector<IdentifierHash> mdtHashList;
130 if (m_use_RoIBasedDataAccess) {
136 m_regionSelector->lookup( Gaudi::Hive::currentContext() )->HashIDList(*iroi, mdtHashList);
139 m_regionSelector->lookup( Gaudi::Hive::currentContext() )->ROBIDList(*iroi, v_robIds);
146 m_regionSelector->lookup( Gaudi::Hive::currentContext() )->HashIDList(fullscan_roi, mdtHashList);
149 m_regionSelector->lookup( Gaudi::Hive::currentContext() )->ROBIDList(fullscan_roi, v_robIds);
152 ATH_CHECK( collectMdtHitsFromPrepData(mdtHashList, mdtHits_normal, muonRoad, muDetMgr) );
154 return StatusCode::SUCCESS;
167 if (v_idHash.empty()) {
169 return StatusCode::SUCCESS;
173 auto mdtPrepContainerHandle =
SG::makeHandle(m_mdtPrepContainerKey);
174 mdtPrds = mdtPrepContainerHandle.cptr();
175 if (!mdtPrepContainerHandle.isValid()) {
176 ATH_MSG_ERROR(
" Cannot retrieve MDT PRD Container " << m_mdtPrepContainerKey.key());
177 return StatusCode::FAILURE;
182 std::vector<const Muon::MdtPrepDataCollection*> mdtCols;
188 if( MDTcoll ==
nullptr ) {
189 ATH_MSG_DEBUG(
"MDT prep data collection not found in Hash ID" << (
int)
id);
193 if( MDTcoll->size() == 0 ) {
194 ATH_MSG_DEBUG(
"MDT prep data collection is empty in Hash ID" << (
int)
id);
198 mdtCols.push_back(MDTcoll);
201 << m_idHelperSvc->mdtIdHelper().show_to_string(MDTcoll->identify())
202 <<
" with size " << MDTcoll->size()
203 <<
"in Hash ID" << (
int)
id);
208 mdtHits.reserve( mdtHits.size() + mdtCol->size() );
212 if (!mdtReadout)
continue;
225 int adc = mdt->adc();
226 int drift = mdt->tdc();
229 int TubeLayer = m_idHelperSvc->mdtIdHelper().tubeLayer(
id);
232 int Tube = m_idHelperSvc->mdtIdHelper().
tube(
id);
236 char st = chamberType[1];
239 if (chamberType[0]==
'E') {
255 double R = -99999., Z = -99999.;
256 if(m_BMGpresent && m_idHelperSvc->mdtIdHelper().stationName(
id) == m_BMGid ) {
257 std::map<Identifier, std::vector<Identifier> >::const_iterator myIt = m_DeadChannels.find( muDetMgr->
getMdtReadoutElement(
id)->
identify() );
258 if( myIt != m_DeadChannels.end() ){
259 if(
std::find( (myIt->second).begin(), (myIt->second).end(),
id) != (myIt->second).
end() ) {
260 ATH_MSG_DEBUG(
"Skipping tube with identifier " << m_idHelperSvc->mdtIdHelper().show_to_string(
id) );
269 if(muonStation->
endcap()==0){
270 cXmid = (trans.translation()).
z();
271 double halfRadialThicknessOfMultilayer = muonStation->
RsizeMdtStation()/2.;
272 cYmid = ((trans.translation()).
perp()+halfRadialThicknessOfMultilayer);
275 cXmid = (trans.translation()).
perp();
277 cYmid = (trans.translation()).
z();
278 if(cYmid>0) cYmid += halfZThicknessOfMultilayer;
279 else cYmid -= halfZThicknessOfMultilayer;
281 cPhip = (trans.translation()).phi();
286 dphi = std::abs(cPhip - cphi);
288 if(std::abs(cphi) >
M_PI/2.) {
289 double phi1 = (cPhip>0.)? cPhip-
M_PI : cPhip+
M_PI;
290 double phi2 = (cphi >0.)? cphi -
M_PI : cphi +
M_PI;
291 dphi = std::abs(phi1) + std::abs(phi2);
294 dphi = std::abs(cPhip) + std::abs(cphi);
298 if(muonStation->
endcap()==1)
299 R = R *std::hypot(1,
std::tan(dphi));
302 double Rmin =(trans*OrigOfMdtInAmdbFrame).
perp();
307 if(cPhip<0. && (std::abs(
M_PI+cPhip) < 0.05) ) cPhip =
M_PI;
309 ATH_MSG_DEBUG(
" ...MDT hit Z/R/chamber/MultiLater/TubeLayer/Tube/Layer/adc/tdc = "
310 << Z <<
"/" << R <<
"/" <<
chamber <<
"/" << MultiLayer <<
"/" <<
TubeLayer <<
"/"
311 << Tube <<
"/" <<
Layer <<
"/" <<
adc <<
"/" << drift);
315 if(
Layer!=0 && Tube !=0) {
319 tmp.name = m_idHelperSvc->mdtIdHelper().stationName(
id);
320 tmp.StationEta = StationEta;
321 tmp.StationPhi = StationPhi;
322 tmp.Multilayer = MultiLayer;
332 for(
unsigned int i=0;
i<4;
i++) {
tmp.cType[
i] = chamberType[
i]; }
335 tmp.DriftTime = drift;
337 tmp.LeadingCoarseTime = (drift>>5) & 0xfff;
338 tmp.LeadingFineTime = drift & 0x1f;
340 tmp.readEle = mdtReadout;
343 mdtHits.push_back(std::move(
tmp));
348 return StatusCode::SUCCESS;
355 PVConstLink cv = mydetEl->getMaterialGeom();
356 int nGrandchildren = cv->getNChildVols();
357 if(nGrandchildren <= 0)
return;
359 std::vector<int> tubes;
360 geoGetIds ([&] (
int id) { tubes.push_back (
id); }, &*cv);
361 std::sort (tubes.begin(), tubes.end());
365 int name = m_idHelperSvc->mdtIdHelper().stationName(detElId);
366 int eta = m_idHelperSvc->mdtIdHelper().stationEta(detElId);
367 int phi = m_idHelperSvc->mdtIdHelper().stationPhi(detElId);
368 int ml = m_idHelperSvc->mdtIdHelper().multilayer(detElId);
369 std::vector<Identifier> deadTubes;
374 int want_id =
layer*maxNTubesPerLayer +
tube;
375 if (
it != tubes.end() && *
it == want_id) {
379 it = std::lower_bound (tubes.begin(), tubes.end(), want_id);
380 if (
it != tubes.end() && *
it == want_id) {
385 deadTubes.push_back( deadTubeId );
387 <<
"), phi(" << phi <<
"), eta(" << eta <<
"), name(" <<
name
388 <<
"), multilayerId(" << ml <<
") and identifier " << deadTubeId <<
" .");
393 std::sort(deadTubes.begin(), deadTubes.end());
394 m_DeadChannels[detElId] = deadTubes;