Commit 656bcd8c authored by Stewart Martin-Haugh's avatar Stewart Martin-Haugh
Browse files

Fix from ATR-17101, needed for ATR-24023

parent 87ea9cd3
......@@ -115,6 +115,8 @@ namespace TrigL2MuonSA {
TrigL2MuonSA::MdtHits& mdtHits,
const TrigL2MuonSA::MuonRoad& muonRoad);
void initDeadChannels(const MuonGM::MdtReadoutElement* mydetEl);
private:
// Reference to StoreGateSvc;
......@@ -151,6 +153,9 @@ namespace TrigL2MuonSA {
bool m_use_mdtcsm;
bool m_use_RoIBasedDataAccess;
bool m_BMGpresent;
int m_BMGid;
std::map<Identifier, std::vector<Identifier> > m_DeadChannels;
};
......
......@@ -31,8 +31,6 @@
#include "MuonCablingData/MuonMDT_CablingMap.h"
#include "MuonCablingData/MdtSubdetectorMap.h"
#include "MuonCablingData/MdtCsmMap.h"
#include "MuonReadoutGeometry/MuonDetectorManager.h"
#include "MuonReadoutGeometry/MdtReadoutElement.h"
#include "MuonReadoutGeometry/MuonStation.h"
#include "MuonIdHelpers/MdtIdHelper.h"
......@@ -62,7 +60,9 @@ TrigL2MuonSA::MdtDataPreparator::MdtDataPreparator(const std::string& type,
m_regionSelector(0), m_robDataProvider(0), m_recMuonRoIUtils(),
m_mdtRegionDefiner("TrigL2MuonSA::MdtRegionDefiner"),
m_mdtPrepDataProvider("Muon::MdtRdoToPrepDataTool/MdtPrepDataProviderTool"),
m_use_mdtcsm(true)
m_use_mdtcsm(true),
m_BMGpresent(false),
m_BMGid(-1)
{
declareInterface<TrigL2MuonSA::MdtDataPreparator>(this);
......@@ -179,6 +179,25 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::initialize()
return sc ;
}
ATH_MSG_DEBUG("Retrieved ActiveStoreSvc.");
m_BMGpresent = m_mdtIdHelper->stationNameIndex("BMG") != -1;
if(m_BMGpresent){
ATH_MSG_INFO("Processing configuration for layouts with BMG chambers.");
m_BMGid = m_mdtIdHelper->stationNameIndex("BMG");
for(int phi=6; phi<8; phi++) { // phi sectors - BMGs are ony in (6 aka 12) and (7 aka 14)
for(int eta=1; eta<4; eta++) { // eta sectors - BMGs are in eta 1 to 3
for(int side=-1; side<2; side+=2) { // side - both sides have BMGs
if( !m_muonMgr->getMuonStation("BMG", side*eta, phi) ) continue;
for(int roe=1; roe<=( m_muonMgr->getMuonStation("BMG", side*eta, phi) )->nMuonReadoutElements(); roe++) { // iterate on readout elemets
const MuonGM::MdtReadoutElement* mdtRE =
dynamic_cast<const MuonGM::MdtReadoutElement*> ( ( m_muonMgr->getMuonStation("BMG", side*eta, phi) )->getMuonReadoutElement(roe) ); // has to be an MDT
if(mdtRE) initDeadChannels(mdtRE);
}
}
}
}
}
//
return StatusCode::SUCCESS;
......@@ -632,9 +651,23 @@ bool TrigL2MuonSA::MdtDataPreparator::decodeMdtCsm(const MdtCsm* csm,
if (st=='E' && chamberType[2]=='E') chamber = xAOD::L2MuonParameters::Chamber::BEE;
if (st=='M' && chamberType[2]=='E') chamber = xAOD::L2MuonParameters::Chamber::BME;
}
double R = m_mdtReadout->center(TubeLayer, Tube).perp();
double Z = m_mdtReadout->center(TubeLayer, Tube).z();
double R = -99999., Z = -99999.;
if(m_BMGpresent) {
Identifier tubeId = m_mdtIdHelper->channelID(StationName, StationEta, StationPhi, MultiLayer, Layer, Tube);
if(m_mdtIdHelper->stationName(tubeId) == m_BMGid ) {
std::map<Identifier, std::vector<Identifier> >::iterator myIt = m_DeadChannels.find( m_muonMgr->getMdtReadoutElement(tubeId)->identify() );
if( myIt != m_DeadChannels.end() ){
if( std::find( (myIt->second).begin(), (myIt->second).end(), tubeId) != (myIt->second).end() ) {
ATH_MSG_DEBUG("Skipping tube with identifier " << m_mdtIdHelper->show_to_string(tubeId) );
++amt;
continue;
}
}
}
}
R = m_mdtReadout->center(TubeLayer, Tube).perp();
Z = m_mdtReadout->center(TubeLayer, Tube).z();
Amg::Transform3D trans = Amg::CLHEPTransformToEigen(*m_muonStation->getNominalAmdbLRSToGlobal());
if(m_muonStation->endcap()==0){
......@@ -1008,9 +1041,19 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::collectMdtHitsFromPrepData(const std
if (st=='E' && chamberType[2]=='E') chamber = xAOD::L2MuonParameters::Chamber::BEE;
if (st=='M' && chamberType[2]=='E') chamber = xAOD::L2MuonParameters::Chamber::BME;
}
double R = m_mdtReadout->center(TubeLayer, Tube).perp();
double Z = m_mdtReadout->center(TubeLayer, Tube).z();
double R = -99999., Z = -99999.;
if(m_BMGpresent && m_mdtIdHelper->stationName(id) == m_BMGid ) {
std::map<Identifier, std::vector<Identifier> >::iterator myIt = m_DeadChannels.find( m_muonMgr->getMdtReadoutElement(id)->identify() );
if( myIt != m_DeadChannels.end() ){
if( std::find( (myIt->second).begin(), (myIt->second).end(), id) != (myIt->second).end() ) {
ATH_MSG_DEBUG("Skipping tube with identifier " << m_mdtIdHelper->show_to_string(id) );
continue;
}
}
}
R = m_mdtReadout->center(TubeLayer, Tube).perp();
Z = m_mdtReadout->center(TubeLayer, Tube).z();
Amg::Transform3D trans = Amg::CLHEPTransformToEigen(*m_muonStation->getNominalAmdbLRSToGlobal());
if(m_muonStation->endcap()==0){
......@@ -1115,3 +1158,45 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::finalize()
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
void TrigL2MuonSA::MdtDataPreparator::initDeadChannels(const MuonGM::MdtReadoutElement* mydetEl) {
PVConstLink cv = mydetEl->getMaterialGeom(); // it is "Multilayer"
int nGrandchildren = cv->getNChildVols();
if(nGrandchildren <= 0) return;
Identifier detElId = mydetEl->identify();
int name = m_mdtIdHelper->stationName(detElId);
int eta = m_mdtIdHelper->stationEta(detElId);
int phi = m_mdtIdHelper->stationPhi(detElId);
int ml = m_mdtIdHelper->multilayer(detElId);
std::vector<Identifier> deadTubes;
for(int layer = 1; layer <= mydetEl->getNLayers(); layer++){
for(int tube = 1; tube <= mydetEl->getNtubesperlayer(); tube++){
bool tubefound = false;
for(unsigned int kk=0; kk < cv->getNChildVols(); kk++) {
int tubegeo = cv->getIdOfChildVol(kk) % 100;
int layergeo = ( cv->getIdOfChildVol(kk) - tubegeo ) / 100;
if( tubegeo == tube && layergeo == layer ) {
tubefound=true;
break;
}
if( layergeo > layer ) break; // don't loop any longer if you cannot find tube anyway anymore
}
if(!tubefound) {
Identifier deadTubeId = m_mdtIdHelper->channelID( name, eta, phi, ml, layer, tube );
deadTubes.push_back( deadTubeId );
ATH_MSG_VERBOSE("adding dead tube (" << tube << "), layer(" << layer
<< "), phi(" << phi << "), eta(" << eta << "), name(" << name
<< "), multilayerId(" << ml << ") and identifier " << deadTubeId <<" .");
}
}
}
std::sort(deadTubes.begin(), deadTubes.end());
m_DeadChannels[detElId] = deadTubes;
return;
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment