diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx index 792bf7b7ddb6d2e5d23351a4a26cd7de1630e578..fe90cab6e700d3e74a7469bbfe896f332939407a 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx @@ -39,8 +39,6 @@ namespace MuonCalib { CscCalcPed::CscCalcPed(const string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name,pSvcLocator), - m_cscId(NULL), - m_muon_mgr(NULL), m_chronoSvc(0), m_cscCoolStrSvc("MuonCalib::CscCoolStrSvc",name), m_cscRdoDecoderTool ("Muon::CscRDO_Decoder"), @@ -114,18 +112,8 @@ namespace MuonCalib { //*******Register services and tools *********/ /// Store Gate active store - StatusCode sc = detStore()->retrieve(m_cscId,"CSCIDHELPER"); - if( sc.isFailure()) - { - mLog << MSG::ERROR << " Cannot retrieve CscIdHelper " << endmsg; - return sc; - } - else - { - mLog << MSG::ERROR << "couldn't retrieve CscIdHelper" << endmsg; - return StatusCode::FAILURE; - } + ATH_CHECK(m_idHelperSvc.retrieve()); if(m_cscCoolStrSvc.retrieve().isFailure()) { @@ -133,7 +121,7 @@ namespace MuonCalib { return StatusCode::FAILURE; } - sc = service("ChronoStatSvc",m_chronoSvc); + StatusCode sc = service("ChronoStatSvc",m_chronoSvc); if(sc.isFailure()) { mLog << MSG::FATAL << "Cannot retrieve ChronoStatSvc!" << endmsg; @@ -167,7 +155,7 @@ namespace MuonCalib { //Loop through ids to find out what hash range we're working on (in case we're using some //unusual geometry) - vector<Identifier> ids = m_cscId->idVector(); + vector<Identifier> ids = m_idHelperSvc->cscIdHelper().idVector(); vector<Identifier>::const_iterator chamItr = ids.begin(); vector<Identifier>::const_iterator chamEnd = ids.end(); m_maxStripHash = 0; @@ -175,14 +163,14 @@ namespace MuonCalib { for(; chamItr != chamEnd; chamItr++) { vector<Identifier> stripVect; - m_cscId->idChannels(*chamItr,stripVect); + m_idHelperSvc->cscIdHelper().idChannels(*chamItr,stripVect); vector<Identifier>::const_iterator stripItr = stripVect.begin(); vector<Identifier>::const_iterator stripEnd = stripVect.end(); for(;stripItr != stripEnd; stripItr++) { IdentifierHash stripHash; - m_cscId->get_channel_hash(*stripItr,stripHash); + m_idHelperSvc->cscIdHelper().get_channel_hash(*stripItr,stripHash); if((unsigned int)stripHash > m_maxStripHash) m_maxStripHash = (int)stripHash; }//End strip loop @@ -199,23 +187,23 @@ namespace MuonCalib { IdentifierHash stripHash =stripItr; Identifier stripId; - IdContext channelContext = m_cscId->channel_context(); - m_cscId->get_id(stripHash, stripId, &channelContext); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); + m_idHelperSvc->cscIdHelper().get_id(stripHash, stripId, &channelContext); - int chamLayer = m_cscId->chamberLayer(stripId); + int chamLayer = m_idHelperSvc->cscIdHelper().chamberLayer(stripId); if(chamLayer == m_expectedChamberLayer) //Only second chamber layer exists { - int stationEta = m_cscId->stationEta(stripId); - int stationPhi = m_cscId->stationPhi(stripId); - int stripNumber = m_cscId->strip(stripId); - int wireLayer = m_cscId->wireLayer(stripId); - char orientation = m_cscId->measuresPhi(stripId) ? 'Y':'X'; + int stationEta = m_idHelperSvc->cscIdHelper().stationEta(stripId); + int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(stripId); + int stripNumber = m_idHelperSvc->cscIdHelper().strip(stripId); + int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(stripId); + char orientation = m_idHelperSvc->cscIdHelper().measuresPhi(stripId) ? 'Y':'X'; char name[30],titleSeed[600]; TH1I* hist = NULL; - int stationName = m_cscId->stationName(stripId); + int stationName = m_idHelperSvc->cscIdHelper().stationName(stripId); //Amplitude histogram sprintf(name, "ampHist%u",stripItr); sprintf(titleSeed, "Amplitude Histogram for eta %d, sector %d, layer %d%c, strip %d", @@ -452,7 +440,7 @@ namespace MuonCalib { if(m_verbose) mLog << MSG::VERBOSE <<"There are " << rawDataContainter->size() << " rods in the RDO" << endmsg; - IdContext channelContext = m_cscId->channel_context(); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); //Loop over RODs (data from 2 chambers), each of which is in //a single CscRawaData collection @@ -489,58 +477,58 @@ namespace MuonCalib { // WP Added Identifier channelId =m_cscRdoDecoderTool->channelIdentifier(cluster, stripItr); IdentifierHash cscChannelHashId; - m_cscId->get_channel_hash(channelId, cscChannelHashId); + m_idHelperSvc->cscIdHelper().get_channel_hash(channelId, cscChannelHashId); /////////// int stripHash = cscChannelHashId; Identifier stripId; - m_cscId->get_id(stripHash, stripId, &channelContext); + m_idHelperSvc->cscIdHelper().get_id(stripHash, stripId, &channelContext); Chrono chronoAfterId(m_chronoSvc,"afterID1"); - if( m_cscId->chamberLayer(channelId) != m_expectedChamberLayer) + if( m_idHelperSvc->cscIdHelper().chamberLayer(channelId) != m_expectedChamberLayer) { // cout << "Wrong chamber layer" << endl; mLog << MSG::WARNING << "Wrong chamber layer a hash (" - << stripHash << ") from the wrong multilayer has appeared in the data. Its string id is " << m_cscId->show_to_string(stripId) - << " " << m_cscId->show_to_string(channelId) + << stripHash << ") from the wrong multilayer has appeared in the data. Its string id is " << m_idHelperSvc->cscIdHelper().show_to_string(stripId) + << " " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) << endmsg; mLog << MSG::INFO << "WP added (1) " - << m_cscId->stationEta(stripId) << " " << m_cscId->measuresPhi(stripId) << " " + << m_idHelperSvc->cscIdHelper().stationEta(stripId) << " " << m_idHelperSvc->cscIdHelper().measuresPhi(stripId) << " " << stripHash << " " << cscChannelHashId << endmsg; mLog << MSG::INFO << "WP added (2) " - << m_cscId->stationEta(stripId) << " " << m_cscId->measuresPhi(stripId) << " " + << m_idHelperSvc->cscIdHelper().stationEta(stripId) << " " << m_idHelperSvc->cscIdHelper().measuresPhi(stripId) << " " << stripId << " " << channelId << endmsg; - // if(m_cscId->measuresPhi(stripId)) + // if(m_idHelperSvc->cscIdHelper().measuresPhi(stripId)) // mLog << MSG::DEBUG <<" bad id Measures Phi" << endmsg; // else // mLog << MSG::DEBUG <<" bad id is eta" << endmsg; //continue; - stripId = m_cscId->channelID( - m_cscId->stationName(stripId), - m_cscId->stationEta(stripId), - m_cscId->stationPhi(stripId), + stripId = m_idHelperSvc->cscIdHelper().channelID( + m_idHelperSvc->cscIdHelper().stationName(stripId), + m_idHelperSvc->cscIdHelper().stationEta(stripId), + m_idHelperSvc->cscIdHelper().stationPhi(stripId), 2, - m_cscId->wireLayer(stripId), - m_cscId->measuresPhi(stripId), - m_cscId->strip(stripId) + m_idHelperSvc->cscIdHelper().wireLayer(stripId), + m_idHelperSvc->cscIdHelper().measuresPhi(stripId), + m_idHelperSvc->cscIdHelper().strip(stripId) ); IdentifierHash newHash; - m_cscId->get_channel_hash(stripId, newHash ); + m_idHelperSvc->cscIdHelper().get_channel_hash(stripId, newHash ); stripHash = newHash; if(m_debug) mLog << MSG::DEBUG << "New hash " << stripHash << endmsg; } else{ - if(m_cscId->measuresPhi(stripId)) + if(m_idHelperSvc->cscIdHelper().measuresPhi(stripId)) mLog << MSG::VERBOSE <<" good id Measures Phi" << endmsg; else mLog << MSG::VERBOSE <<" good id is eta" << endmsg; @@ -556,7 +544,7 @@ namespace MuonCalib { //Test for threshold breach... //int minMax = GetMinMax(samples); - //if(minMax < (m_cscId->measuresPhi(stripId) ? 50 :30)) { + //if(minMax < (m_idHelperSvc->cscIdHelper().measuresPhi(stripId) ? 50 :30)) { size_t sampCnt = 0; std::vector<uint16_t>::const_iterator sampItr = samples.begin(); std::vector<uint16_t>::const_iterator sampEnd = samples.end(); @@ -761,25 +749,25 @@ namespace MuonCalib { if(m_debug) mLog << MSG::DEBUG << "we're on hash " << hashId << " with pedestal " << ped << "and noise " << noise << endmsg;//<< " and threshold " << thold << endmsg; Identifier id; - IdContext channelContext = m_cscId->channel_context(); - m_cscId->get_id(hashId,id, &channelContext); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); + m_idHelperSvc->cscIdHelper().get_id(hashId,id, &channelContext); - Identifier chamberId = m_cscId->elementID(id); - if(!m_cscId->valid(chamberId)) + Identifier chamberId = m_idHelperSvc->cscIdHelper().elementID(id); + if(!m_idHelperSvc->cscIdHelper().valid(chamberId)) { mLog << MSG::WARNING << chamberId.getString() << " is not a valid id!" << endmsg; - mLog << MSG::WARNING << "identifier is: " << m_cscId->show_to_string(chamberId) << endmsg; + mLog << MSG::WARNING << "identifier is: " << m_idHelperSvc->cscIdHelper().show_to_string(chamberId) << endmsg; //id.show(); //in.ignore(10000,'\n'); } IdentifierHash chamberHash; - m_cscId->get_module_hash(id,chamberHash); + m_idHelperSvc->cscIdHelper().get_module_hash(id,chamberHash); //print out values. out << hashId; out <<" " << chamberHash; - out << " " << m_cscId->show_to_string(id) << " "; + out << " " << m_idHelperSvc->cscIdHelper().show_to_string(id) << " "; out << " " << ped; out << " " << noise; out << " " << rms; @@ -835,31 +823,31 @@ namespace MuonCalib { if(m_debug) mLog << MSG::DEBUG << "we're on hash " << hashId << " with pedestal " << ped << "and noise " << noise << endmsg;//<< " and threshold " << thold << endmsg; Identifier id; - IdContext channelContext = m_cscId->channel_context(); - m_cscId->get_id(hashId,id, &channelContext); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); + m_idHelperSvc->cscIdHelper().get_id(hashId,id, &channelContext); - Identifier chamberId = m_cscId->elementID(id); - if(!m_cscId->valid(chamberId)) + Identifier chamberId = m_idHelperSvc->cscIdHelper().elementID(id); + if(!m_idHelperSvc->cscIdHelper().valid(chamberId)) { mLog << MSG::WARNING << chamberId.getString() << " is not a valid id!" << endmsg; - mLog << MSG::WARNING << "identifier is: " << m_cscId->show_to_string(chamberId) << endmsg; + mLog << MSG::WARNING << "identifier is: " << m_idHelperSvc->cscIdHelper().show_to_string(chamberId) << endmsg; //id.show(); //in.ignore(10000,'\n'); } - char orientationChar = (m_cscId->measuresPhi(id) ? 'Y':'X'); + char orientationChar = (m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 'Y':'X'); IdentifierHash chamberHash; - m_cscId->get_module_hash(id,chamberHash); + m_idHelperSvc->cscIdHelper().get_module_hash(id,chamberHash); //print out values. out.setf(ios::right);//right aligned columns out << setfill('0') << setw(8) << onlineHexId; out <<" " - << setw(2) << chamberHash << orientationChar << (m_cscId->wireLayer(id)-1) + << setw(2) << chamberHash << orientationChar << (m_idHelperSvc->cscIdHelper().wireLayer(id)-1) <<" " - << setw(3) << m_cscId->strip(id) -1 << " " ; + << setw(3) << m_idHelperSvc->cscIdHelper().strip(id) -1 << " " ; out.setf(ios::fixed); @@ -1001,18 +989,18 @@ namespace MuonCalib { for(unsigned int hashItr =0; hashItr <= m_maxStripHash; hashItr++) { IdentifierHash stripHash =hashItr; Identifier stripId; - IdContext channelContext = m_cscId->channel_context(); - m_cscId->get_id(stripHash, stripId, &channelContext); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); + m_idHelperSvc->cscIdHelper().get_id(stripHash, stripId, &channelContext); - int chamLayer = m_cscId->chamberLayer(stripId); + int chamLayer = m_idHelperSvc->cscIdHelper().chamberLayer(stripId); if(chamLayer == m_expectedChamberLayer) //Only second chamber layer exists { - int stationName = m_cscId->stationName(stripId); - //int stationEta = m_cscId->stationEta(stripId); - int stationPhi = m_cscId->stationPhi(stripId); - int stripNumber = m_cscId->strip(stripId); - int wireLayer = m_cscId->wireLayer(stripId); - char orientation = m_cscId->measuresPhi(stripId) ? 'Y':'X'; + int stationName = m_idHelperSvc->cscIdHelper().stationName(stripId); + //int stationEta = m_idHelperSvc->cscIdHelper().stationEta(stripId); + int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(stripId); + int stripNumber = m_idHelperSvc->cscIdHelper().strip(stripId); + int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(stripId); + char orientation = m_idHelperSvc->cscIdHelper().measuresPhi(stripId) ? 'Y':'X'; int sector = 2*stationPhi + 50 - stationName; @@ -1099,10 +1087,10 @@ namespace MuonCalib { strip = ((onlineId)&0xff) +1; } - Identifier chanId = m_cscId->channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip); + Identifier chanId = m_idHelperSvc->cscIdHelper().channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip); IdentifierHash chanHash; - m_cscId->get_channel_hash(chanId, chanHash); + m_idHelperSvc->cscIdHelper().get_channel_hash(chanId, chanHash); hashId = (unsigned int)chanHash; diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h index a15ffaca85e1d62722f5d190205370d726a5e645..d03127a57c10eee4e2328a0f48bac6916c64f5a1 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h @@ -13,8 +13,8 @@ an RDO #include "StoreGate/DataHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "AthContainers/DataVector.h" #include <vector> @@ -25,6 +25,7 @@ an RDO #include "TH2.h" #include "TH2F.h" #include "MuonCondInterface/CscICoolStrSvc.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class cscIdHelper; class TFile; @@ -102,8 +103,7 @@ namespace MuonCalib{ /**Services and tools*/ // ITHistSvc * m_thistSvc; // ICscCalibTool * m_cscCalibTool; - const CscIdHelper *m_cscId; - const MuonGM::MuonDetectorManager * m_muon_mgr; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; IChronoStatSvc* m_chronoSvc; ServiceHandle<CscICoolStrSvc> m_cscCoolStrSvc; ToolHandle<Muon::ICSC_RDO_Decoder> m_cscRdoDecoderTool; diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.cxx b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.cxx index 2b797b05de8bd431062784031ac69e536faa687e..d30994e0425a310319cf4c04560b19baae1894b0 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.cxx +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "GaudiKernel/MsgStream.h" @@ -50,7 +50,6 @@ namespace MuonCalib { m_cscCalibTool(NULL), m_cscCoolStrSvc("MuonCalib::CscCoolStrSvc",name), m_cscRdoDecoderTool ("Muon::CscRDO_Decoder"), - m_cscId(NULL), m_chronoSvc(NULL), m_outputFileName("output.cal"), m_dumpAllHists(false), @@ -179,13 +178,9 @@ cerr << "detstore" << endl; } cerr << "idhelper" << endl; - sc = detStore->retrieve(m_cscId,"CSCIDHELPER"); - if( sc.isFailure()) - { - mLog << MSG::ERROR << " Cannot retrieve CscIdHelper " << endmsg; - return sc; - } + ATH_CHECK(m_idHelperSvc.retrieve()); + cerr << "chorno" << endl; sc = service("ChronoStatSvc",m_chronoSvc); if(sc.isFailure()) @@ -240,19 +235,19 @@ cerr << "done init services" << endl; for(unsigned int pulserLevel=0; pulserLevel < 64; pulserLevel++) m_dbLevels[pulserLevel] = pulserLevel*.5; - IdContext channelContext = m_cscId->channel_context(); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); if(m_doBitHists) m_bitHists = new DataVector<TH1I>(SG::VIEW_ELEMENTS); //Loop through ids to find out what hash range we're working on, and to //initialize histograms. - vector<Identifier> ids = m_cscId->idVector(); + vector<Identifier> ids = m_idHelperSvc->cscIdHelper().idVector(); vector<Identifier>::const_iterator chamItr = ids.begin(); vector<Identifier>::const_iterator chamEnd = ids.end(); m_maxStripHash = 0; for(; chamItr != chamEnd; chamItr++) { std::vector<Identifier> stripVect; - m_cscId->idChannels(*chamItr,stripVect); + m_idHelperSvc->cscIdHelper().idChannels(*chamItr,stripVect); /* vector<vector<float> > chamberDbs; @@ -272,7 +267,7 @@ cerr << "done init services" << endl; for(;stripItr != stripEnd; stripItr++) { IdentifierHash stripHash; - m_cscId->get_channel_hash(*stripItr,stripHash); + m_idHelperSvc->cscIdHelper().get_channel_hash(*stripItr,stripHash); if(m_maxStripHash < (unsigned int)stripHash) m_maxStripHash = (unsigned int)stripHash; @@ -280,15 +275,15 @@ cerr << "done init services" << endl; if(m_bitHists) { Identifier id; - m_cscId->get_id((IdentifierHash)stripHash,id,&channelContext); - int wireLayer = m_cscId->wireLayer(id); - char orientation = (m_cscId->measuresPhi(id) ? 'Y':'X'); + m_idHelperSvc->cscIdHelper().get_id((IdentifierHash)stripHash,id,&channelContext); + int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(id); + char orientation = (m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 'Y':'X'); - int stationName = m_cscId->stationName(id); - int stationPhi = m_cscId->stationPhi(id); - int stationEta = m_cscId->stationEta(id); + int stationName = m_idHelperSvc->cscIdHelper().stationName(id); + int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(id); + int stationEta = m_idHelperSvc->cscIdHelper().stationEta(id); - int stripNumber = m_cscId->strip(id); + int stripNumber = m_idHelperSvc->cscIdHelper().strip(id); char bitName[200], titleSeed[500]; //Bit histogram (for looking for stuck-bits) @@ -314,9 +309,9 @@ cerr << "done init services" << endl; m_calGraphs->push_back(NULL); /*IdentifierHash stripHash =chanItr; Identifier stripId; - IdContext channelContext = m_cscId->channel_context(); - m_cscId->get_id(stripHash, stripId, &channelContext); - m_allowedStrips[chanItr] = (m_cscId->chamberLayer(stripId) == m_expectedChamberLayer);*/ + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); + m_idHelperSvc->cscIdHelper().get_id(stripHash, stripId, &channelContext); + m_allowedStrips[chanItr] = (m_idHelperSvc->cscIdHelper().chamberLayer(stripId) == m_expectedChamberLayer);*/ } @@ -527,13 +522,13 @@ cerr << "done init services" << endl; int numStrips = cluster->width(); int samplesPerStrip = (cluster->samples()).size()/numStrips; - IdContext channelContext = m_cscId->channel_context(); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); /* Identifier startId; - m_cscId->get_id(hashStart, startId, &channelContex); + m_idHelperSvc->cscIdHelper().get_id(hashStart, startId, &channelContex); //check the chamber layer. - int chamberLayer = m_cscId->chamberLayer(startId) << endmsg; + int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(startId) << endmsg; if(chamberLayer != m_expectedChamberLayer) { m_log << MSG::ERROR << "A chamber with a chamber layer of " << chamberLayer << " was found. " @@ -545,11 +540,11 @@ cerr << "done init services" << endl; { Identifier stripId =m_cscRdoDecoderTool->channelIdentifier(cluster, stripItr); IdentifierHash cscChannelHashId; - m_cscId->get_channel_hash(stripId, cscChannelHashId); + m_idHelperSvc->cscIdHelper().get_channel_hash(stripId, cscChannelHashId); int stripHash = cscChannelHashId; - mLog << MSG::VERBOSE << "The eta of this strip is: " << m_cscId->stationEta(stripId) << endmsg; + mLog << MSG::VERBOSE << "The eta of this strip is: " << m_idHelperSvc->cscIdHelper().stationEta(stripId) << endmsg; - int chamberLayer = m_cscId->chamberLayer(stripId); + int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(stripId); if(chamberLayer != m_expectedChamberLayer) { mLog << MSG::FATAL << "Cluster includes strip in chamber layer " @@ -559,18 +554,18 @@ cerr << "done init services" << endl; return StatusCode::FAILURE; } - int currentWireLayer = m_cscId->wireLayer(stripId) - 1; + int currentWireLayer = m_idHelperSvc->cscIdHelper().wireLayer(stripId) - 1; if( currentWireLayer < 0 || currentWireLayer > 3) { mLog << MSG::FATAL << "Problem in getting wire layer! - Current value is " - << m_cscId->wireLayer(stripId) << " while only values between 1-4 are allowed." << endmsg; + << m_idHelperSvc->cscIdHelper().wireLayer(stripId) << " while only values between 1-4 are allowed." << endmsg; return StatusCode::FAILURE; } bool isThisLayerPulsed = (pulsedWireLayer >> currentWireLayer)&0x1; if(isThisLayerPulsed) { /*Usefull for debug, but slows things down a surprising amount - if(!m_cscId->valid(stripId)) + if(!m_idHelperSvc->cscIdHelper().valid(stripId)) { mLog << MSG::ERROR << stripId.getString() << " is not a valid id!" << endmsg; }*/ @@ -661,7 +656,7 @@ cerr << "done init services" << endl; mLog << MSG::WARNING << "stripHash " << stripHash << endmsg; mLog << MSG::WARNING << "strip in chamber " << stripItr << endmsg; mLog << MSG::WARNING - << " and detailed id " << m_cscId->show_to_string(stripId,&channelContext) + << " and detailed id " << m_idHelperSvc->cscIdHelper().show_to_string(stripId,&channelContext) << endmsg; mLog << "Pulsed layer " << pulsedWireLayer <<endmsg; mLog << ", Samples: " << samples[0] <<", " << samples[1] << ", " @@ -702,7 +697,7 @@ cerr << "done init services" << endl; unsigned int numCalibPoints = m_ampProfs->size(); mLog << MSG::INFO << "There are " << numCalibPoints << " pulser levels to evaluate." << endmsg; - IdContext channelContext = m_cscId->channel_context(); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); float chargeMax = 530.88; //in fC @@ -721,17 +716,17 @@ cerr << "done init services" << endl; Identifier id; - m_cscId->get_id((IdentifierHash)stripHash,id,&channelContext); - int chamberLayer = m_cscId->chamberLayer(id); - char orientation = (m_cscId->measuresPhi(id) ? 'Y':'X'); + m_idHelperSvc->cscIdHelper().get_id((IdentifierHash)stripHash,id,&channelContext); + int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(id); + char orientation = (m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 'Y':'X'); - int wireLayer = m_cscId->wireLayer(id); + int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(id); - int stationName = m_cscId->stationName(id); - int stationPhi = m_cscId->stationPhi(id); - int stationEta = m_cscId->stationEta(id); - int stripNumber = m_cscId->strip(id); + int stationName = m_idHelperSvc->cscIdHelper().stationName(id); + int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(id); + int stationEta = m_idHelperSvc->cscIdHelper().stationEta(id); + int stripNumber = m_idHelperSvc->cscIdHelper().strip(id); //Decide if we're fitting to an edge strip or not, which @@ -746,7 +741,7 @@ cerr << "done init services" << endl; IdentifierHash chamHash; - m_cscId->get_module_hash(id,chamHash); + m_idHelperSvc->cscIdHelper().get_module_hash(id,chamHash); if(chamberLayer != m_expectedChamberLayer) continue; @@ -1018,24 +1013,24 @@ cerr << "done init services" << endl; //get id for next few outputs Identifier id; - IdContext channelContext = m_cscId->channel_context(); - m_cscId->get_id((*slopeItr)->hashId(),id, &channelContext); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); + m_idHelperSvc->cscIdHelper().get_id((*slopeItr)->hashId(),id, &channelContext); //output chamber # IdentifierHash chamberHash; - Identifier chamberId = m_cscId->elementID(id); - if(!m_cscId->valid(chamberId)) + Identifier chamberId = m_idHelperSvc->cscIdHelper().elementID(id); + if(!m_idHelperSvc->cscIdHelper().valid(chamberId)) { mLog << MSG::FATAL << chamberId.getString() << " is not a valid id!" << endmsg; - mLog << MSG::FATAL << "identifier is: " << m_cscId->show_to_string(chamberId) << endmsg; + mLog << MSG::FATAL << "identifier is: " << m_idHelperSvc->cscIdHelper().show_to_string(chamberId) << endmsg; return StatusCode::FAILURE; } - m_cscId->get_module_hash(id,chamberHash); + m_idHelperSvc->cscIdHelper().get_module_hash(id,chamberHash); out <<" " << chamberHash; //output strip details - out << " " << m_cscId->show_to_string(id) << " "; + out << " " << m_idHelperSvc->cscIdHelper().show_to_string(id) << " "; //output parameter values out << " " << (*slopeItr)->value(); diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.h b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.h index c917b0cd4fd1ec8572d3b67728c402efa90630ac..13dbe18dcb33aa4195e8d6f4fdf663fd5ee75603 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.h +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.h @@ -12,6 +12,7 @@ so that he can determine the validity of the constants #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/ITHistSvc.h" +#include "GaudiKernel/ServiceHandle.h" #include "StoreGate/DataHandle.h" #include "GaudiKernel/ToolHandle.h" @@ -19,6 +20,7 @@ so that he can determine the validity of the constants #include "AthContainers/DataVector.h" #include "CscCalibData/CscCalibResultCollection.h" #include "MuonCSC_CnvTools/ICSC_RDO_Decoder.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" //temporary for tests #include "BipolarFit.h" @@ -85,7 +87,7 @@ namespace MuonCalib{ ICscCalibTool * m_cscCalibTool; ServiceHandle<CscICoolStrSvc> m_cscCoolStrSvc; ToolHandle<Muon::ICSC_RDO_Decoder> m_cscRdoDecoderTool; - const CscIdHelper *m_cscId; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; IChronoStatSvc* m_chronoSvc; /**Parameters input through joboptions*/ diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool.h index d8e1a7cca3a9a45f099ebd29a806ae7f71cddcb0..80f32954613ca1c189ada2fc9ee24e04706f0625 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool.h +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool.h @@ -10,6 +10,7 @@ #include "MdtCalibData/MdtTubeCalibContainerCollection.h" #include "MdtCalibData/MdtRtRelationCollection.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "CLHEP/Random/RandomEngine.h" class IAtRndmGenSvc; @@ -17,10 +18,6 @@ class IAtRndmGenSvc; class MdtCalibrationRegionSvc; class Identifier; -namespace MuonGM{ -class MuonDetectorManager; -} - namespace MuonCalib { @@ -72,7 +69,12 @@ private: ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager* m_detMgr; + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + MdtCalibrationRegionSvc* m_regionSvc; mutable MdtTubeCalibContainerCollection * m_tubeData; mutable MdtRtRelationCollection * m_rtData; diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/MdtCalibDbAsciiTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/MdtCalibDbAsciiTool.cxx index 4730e70d8697369cac15bb197de63678f65593b3..51e769bf7193732517f464a8d625549d3f955b1c 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/MdtCalibDbAsciiTool.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/MdtCalibDbAsciiTool.cxx @@ -126,13 +126,9 @@ StatusCode MdtCalibDbAsciiTool::initialize() { ATH_CHECK( m_muonIdHelperTool.retrieve() ); - StatusCode sc = detStore()->retrieve( m_detMgr ); - if (!sc.isSuccess()) { - *m_log << MSG::ERROR << "Can't retrieve MuonDetectorManager" << endmsg; - return sc; - } + ATH_CHECK(m_DetectorManagerKey.initialize()); - sc = serviceLocator()->service("MdtCalibrationRegionSvc", m_regionSvc); + StatusCode sc = serviceLocator()->service("MdtCalibrationRegionSvc", m_regionSvc); if ( sc.isSuccess() ) { if( m_debug ) *m_log << MSG::DEBUG << "Retrieved MdtCalibrationRegionSvc" << endmsg; }else{ @@ -341,11 +337,18 @@ StatusCode MdtCalibDbAsciiTool::defaultT0s() { MuonCalib::MdtTubeCalibContainer * MdtCalibDbAsciiTool::buildMdtTubeCalibContainer(const Identifier& id) { MuonCalib::MdtTubeCalibContainer* tubes = 0; - - const MuonGM::MdtReadoutElement* detEl = m_detMgr->getMdtReadoutElement( m_muonIdHelperTool->mdtIdHelper().channelID(id,1,1,1) ); + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return tubes; + } + + const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement( m_muonIdHelperTool->mdtIdHelper().channelID(id,1,1,1) ); const MuonGM::MdtReadoutElement* detEl2 = 0; if (m_muonIdHelperTool->mdtIdHelper().numberOfMultilayers(id) == 2){ - detEl2 = m_detMgr->getMdtReadoutElement(m_muonIdHelperTool->mdtIdHelper().channelID(id,2,1,1) ); + detEl2 = MuonDetMgr->getMdtReadoutElement(m_muonIdHelperTool->mdtIdHelper().channelID(id,2,1,1) ); }else{ *m_log << MSG::ERROR << "A single multilayer for this station " << m_muonIdHelperTool->mdtIdHelper().show_to_string(id); } diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbCoolStrTool/MdtCalibDbCoolStrTool/MdtCalibDbCoolStrTool.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbCoolStrTool/MdtCalibDbCoolStrTool/MdtCalibDbCoolStrTool.h index c7e76c896cb2f4493f326dde9d14baca7d4d6898..5b0a2cca808d8a891b7cb9b3366e78fbf4994f8b 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbCoolStrTool/MdtCalibDbCoolStrTool/MdtCalibDbCoolStrTool.h +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbCoolStrTool/MdtCalibDbCoolStrTool/MdtCalibDbCoolStrTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef MDTCALIBDB_MDTCALIBCOOLSTRTOOL_H @@ -13,6 +13,8 @@ #include "GaudiKernel/ToolHandle.h" #include "CLHEP/Random/RandomEngine.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" //c - c++ #include "zlib.h" @@ -25,9 +27,6 @@ class Identifier; class IIOVDbSvc; class MsgStream; class IAtRndmGenSvc; -namespace MuonGM{ - class MuonDetectorManager; -} namespace coral { class Blob; @@ -79,7 +78,12 @@ private: ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager *m_detMgr; + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + ToolHandle<IIdToFixedIdTool> m_idToFixedIdTool; ServiceHandle<IIOVDbSvc> m_IOVDbSvc; ServiceHandle<MdtCalibrationRegionSvc> m_regionSvc; diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbCoolStrTool/src/MdtCalibDbCoolStrTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbCoolStrTool/src/MdtCalibDbCoolStrTool.cxx index bbff9ab93fda227236a6802ee0a1574a18ec1ed3..1f706eb2f5989efc3ad48d32afb850729edc5474 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbCoolStrTool/src/MdtCalibDbCoolStrTool.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbCoolStrTool/src/MdtCalibDbCoolStrTool.cxx @@ -36,7 +36,6 @@ #include "MdtCalibDbCoolStrTool/MdtCalibDbCoolStrTool.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "AthenaKernel/IIOVDbSvc.h" @@ -139,7 +138,7 @@ StatusCode MdtCalibDbCoolStrTool::initialize() { } ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_CHECK( detStore()->retrieve( m_detMgr ) ); + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_IOVDbSvc.retrieve() ); ATH_CHECK( m_regionSvc.retrieve() ); @@ -977,10 +976,17 @@ StatusCode MdtCalibDbCoolStrTool::defaultT0s() { MuonCalib::MdtTubeCalibContainer* MdtCalibDbCoolStrTool::buildMdtTubeCalibContainer(const Identifier &id) { MuonCalib::MdtTubeCalibContainer *tubes = 0; - const MuonGM::MdtReadoutElement *detEl = m_detMgr->getMdtReadoutElement( m_muonIdHelperTool->mdtIdHelper().channelID(id,1,1,1) ); + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return 0; + } + + const MuonGM::MdtReadoutElement *detEl = MuonDetMgr->getMdtReadoutElement( m_muonIdHelperTool->mdtIdHelper().channelID(id,1,1,1) ); const MuonGM::MdtReadoutElement *detEl2 = 0; if (m_muonIdHelperTool->mdtIdHelper().numberOfMultilayers(id) == 2){ - detEl2 = m_detMgr->getMdtReadoutElement(m_muonIdHelperTool->mdtIdHelper().channelID(id,2,1,1) ); + detEl2 = MuonDetMgr->getMdtReadoutElement(m_muonIdHelperTool->mdtIdHelper().channelID(id,2,1,1) ); } else { ATH_MSG_VERBOSE( "A single multilayer for this station " << m_muonIdHelperTool->mdtIdHelper().stationNameString(m_muonIdHelperTool->mdtIdHelper().stationName(id))<<","<< m_muonIdHelperTool->mdtIdHelper().stationPhi(id) <<","<< m_muonIdHelperTool->mdtIdHelper().stationEta(id) ); } diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/MdtCalibTool.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/MdtCalibTool.h index 6bfe0424f946cf7f52541b857d8cf86dde8c56ef..e74d598df52ae0fba12f5d2bd243d863bc9de837 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/MdtCalibTool.h +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/MdtCalibTool.h @@ -29,15 +29,14 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonCalibITools/IMuonCalibTool.h" #include "MuonCalibITools/IRegionSelectorTool.h" #include <map> - -class MdtIdHelper; - namespace MuonCalib { class IMdtCalibTool; @@ -113,7 +112,8 @@ namespace MuonCalib { /** RegionSelector initialization */ ToolHandle<IRegionSelectorTool> m_regionSelector; //!< RegionSelector ToolHandle - const MdtIdHelper* m_mdtIdHelper; //!< pointer to MdtIdHelper + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + }; } diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/MdtCalibTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/MdtCalibTool.cxx index ae488de06afb5f582bc7fa354d4f1d78563254f4..55dcb5ecae75464863b011ff261d5cb32fb1970c 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/MdtCalibTool.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/MdtCalibTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "MdtCalibTools/MdtCalibTool.h" @@ -18,7 +18,6 @@ #include "MdtCalibEventLoop/MdtCalibEventLoop.h" #include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include <algorithm> #include <fstream> @@ -68,20 +67,8 @@ namespace MuonCalib { log << MSG::INFO << "Retrieved" << m_regionSelector << endmsg; } + ATH_CHECK(m_idHelperSvc.retrieve()); - const MuonGM::MuonDetectorManager* detMgr; - // initialize MuonGeoModel access - sc = detStore()->retrieve( detMgr ); - if (!sc.isSuccess()) { - log << MSG::ERROR << "Can't retrieve MuonDetectorManager" << endmsg; - return sc; - } - - // initialize MuonIdHelpers - if(detMgr) { - m_mdtIdHelper = detMgr->mdtIdHelper(); - } - log << MSG::INFO << "Initialization ended " << endmsg; return StatusCode::SUCCESS; diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/MdtCalibValidation/MdtValidationAlg.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/MdtCalibValidation/MdtValidationAlg.h index 05a5e5367bebcbc7b00a15d8faab5ee4870dcad8..16f7873e3f6d058272b17ee274f36004dc897c9e 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/MdtCalibValidation/MdtValidationAlg.h +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/MdtCalibValidation/MdtValidationAlg.h @@ -31,13 +31,10 @@ #include "MdtCalibData/MdtTubeFitContainer.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" class RegionSelectionSvc; -namespace MuonGM { - class MuonDetectorManager; -} - namespace MuonCalib { class NtupleStationId; @@ -114,8 +111,10 @@ namespace MuonCalib { ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager *m_detMgr; // pointer to the muon - // detector manager + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; CalibDbConnection * m_db; CalibT0DbOperations * m_t0_op; diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/MdtValidationAlg.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/MdtValidationAlg.cxx index b1aeae87d7fc8bb8bd153964932a8198ba163d68..a1bd6fc60d1357b78c69822df4bf7ecbb51733ee 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/MdtValidationAlg.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/MdtValidationAlg.cxx @@ -6,8 +6,6 @@ #include "MdtCalibValidation/MdtValidationAlg.h" #include "MdtCalibValidation/FixRtEnds.h" -// geo model // -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/MdtIdHelper.h" //MuonCalibStandAloneBase @@ -36,7 +34,7 @@ namespace MuonCalib { MdtValidationAlg::MdtValidationAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), -p_reg_sel_svc(NULL), m_tube_chamber(NULL),m_detMgr(NULL), m_db(NULL), m_t0_op(NULL), m_rt_op(NULL), m_head_ops(NULL), +p_reg_sel_svc(NULL), m_tube_chamber(NULL), m_db(NULL), m_t0_op(NULL), m_rt_op(NULL), m_head_ops(NULL), m_fitter(1), m_writeToDbEnable(true), m_limitslevel(0), m_makeHistos(0), m_lastdate(0), m_validationTask(""), m_db_ConnectionString(""),m_db_WorkingSchema(""),m_defaultRtFile("./RT_default_comm.dat"), m_minSegs(-1), m_minDAngle(-999.), m_Histos(NULL), m_HistosList(NULL), @@ -98,7 +96,7 @@ StatusCode MdtValidationAlg::initialize() { log<< MSG::INFO << "Thank you for using MdtValidationAlg!" <<endmsg; ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_CHECK ( detStore()->retrieve( m_detMgr ) ); + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( serviceLocator()->service("RegionSelectionSvc", p_reg_sel_svc) ); m_region_ids=p_reg_sel_svc->GetStationsInRegions(); log<< MSG::INFO << " MdtValidationAlg::initialize() - number of selected regions: "<<m_region_ids.size()<<endmsg; @@ -689,7 +687,15 @@ double MdtValidationAlg::getRightLimit(TH1F * histo) { // Check if tube is a real or dummy tube (inserted as placeholder in COOL text blob) inline bool MdtValidationAlg::exists(NtupleStationId &id, int ml, int ly, int tb) { - if(!id.InitializeGeometry(m_muonIdHelperTool->mdtIdHelper(), m_detMgr)) { + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return false; + } + + if(!id.InitializeGeometry(m_muonIdHelperTool->mdtIdHelper(), MuonDetMgr)) { return false; } if(ml+1>id.NMultilayers()) { diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/MuonCalibAlgs/MuonCalibAlg.h b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/MuonCalibAlgs/MuonCalibAlg.h index ef5f364e3380d051080d92626aea884bae214adc..2e2e6b0d3cd4f9c06dc2bb445863979bc2394ee8 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/MuonCalibAlgs/MuonCalibAlg.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/MuonCalibAlgs/MuonCalibAlg.h @@ -12,15 +12,13 @@ #include "MuonCalibEventBase/MuonCalibEvent.h" #include "MuonPrdSelector/MuonIdCutTool.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" +/* #include "StoreGate/ReadCondHandleKey.h" */ +#include "MuonReadoutGeometry/MuonDetectorManager.h" class ICscStripFitter; class TileTBID; -namespace MuonGM { - class MuonDetectorManager; -} - namespace Muon { class RpcPrepData; } @@ -98,7 +96,11 @@ namespace MuonCalib { /** retrieve event trigger time information from storegate and convert to MuonCalibTriggerTimeInfo */ const MuonCalibTriggerTimeInfo* retrieveTriggerTimeInfo() const; - const MuonGM::MuonDetectorManager* m_detMgr; //!< Pointer to MuonDetectorManager + /** retrieve MuonDetectorManager from the conditions store */ + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + std::string m_globalPatternLocation; //!< Location of the MuonCalibPattern in StoreGate /* RtCalibration initialization */ diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/MuonCalibAlg.cxx b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/MuonCalibAlg.cxx index e39d5f532f7bf7ca9ae266820b9f11f4306490ae..bb7b172e177f1cd16421ba4d8e1a9e0ed0707b5f 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/MuonCalibAlg.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/MuonCalibAlg.cxx @@ -28,7 +28,6 @@ #include "GeoPrimitives/GeoPrimitives.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "CscClusterization/ICscStripFitter.h" @@ -78,7 +77,7 @@ namespace MuonCalib { MuonCalibAlg::MuonCalibAlg(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator), m_detMgr(NULL), + AthAlgorithm(name, pSvcLocator), m_muonCalibTool("MuonCalib::MdtCalibTool/MdtCalibTool"), m_idToFixedIdTool("MuonCalib::IdToFixedIdTool"), m_stripFitter("CalibCscStripFitter/CalibCscStripFitter"), @@ -184,12 +183,8 @@ namespace MuonCalib { << "Unable to retrieve TileTBID helper from DetectorStore" << endmsg; } - // retrieve MuonDetectorManager - std::string managerName="Muon"; - if (detStore()->retrieve(m_detMgr).isFailure()) { - log << MSG::INFO << "Could not find the MuonGeoModel Manager: " - << managerName << " ! " << endmsg; - } + // retrieve MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); log << MSG::INFO << "Initialization ended " << endmsg; return StatusCode::SUCCESS; @@ -536,7 +531,14 @@ namespace MuonCalib { } }//retrieved other MCtruth } - + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return 0; + } + std::string sdoKey; const MuonSimDataCollection* sdoContainer = 0; if ( m_doMDTs ) { @@ -598,7 +600,7 @@ namespace MuonCalib { mdtTruth->setDriftRadius( (*deposits_it).second.firstEntry() ) ; double posAlongAMDB = (*deposits_it).second.secondEntry(); Amg::Vector3D geoModelLocPos(0.,0.,posAlongAMDB); - const MuonGM::MdtReadoutElement* detEl = m_detMgr->getMdtReadoutElement(id); + const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(id); if( detEl ) { Amg::Vector3D gpos = detEl->localToGlobalCoords(geoModelLocPos,id); Amg::Vector3D localAMDBPos = detEl->GlobalToAmdbLRSTransform()*gpos; @@ -797,7 +799,7 @@ namespace MuonCalib { if (!drop || (drop && (*deposits_it).first.barcode() != 0)) { ncscSDO++; Identifier id = (*csc_it).first; - const MuonGM::CscReadoutElement* detEl = m_detMgr->getCscReadoutElement(id); + const MuonGM::CscReadoutElement* detEl = MuonDetMgr->getCscReadoutElement(id); if( !detEl ){ log << MSG::WARNING << "Found CSC Identifier which seems to have no readout element " << m_idHelperSvc->mdtIdHelper().print_to_string(id) << endmsg; @@ -825,7 +827,7 @@ namespace MuonCalib { } // m_doCSCs log << MSG::DEBUG << "retrieved MCtruthCollection size " << MCtruthCollection->numberOfTruth() << endmsg; - + return MCtruthCollection; } diff --git a/MuonSpectrometer/MuonCalib/MuonCalibDbOperations/MuonCalibDbOperations/CoolInserter.h b/MuonSpectrometer/MuonCalib/MuonCalibDbOperations/MuonCalibDbOperations/CoolInserter.h index 75e0a5f2a32b7d253e0b0cfe6acb950b6f51676c..e9d9e905e2e5d5310217fa68f0b651b2e4fb17f6 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibDbOperations/MuonCalibDbOperations/CoolInserter.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibDbOperations/MuonCalibDbOperations/CoolInserter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef MuonCalib_CoolInserter_h @@ -33,14 +33,10 @@ #include "MuonCalibStandAloneBase/NtupleStationId.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" class RegionSelectionSvc; -namespace MuonGM { - class MuonDetectorManager; -} - - namespace MuonCalib { class CalibDbConnection; @@ -99,7 +95,12 @@ class CoolInserter : public AthAlgorithm { std::set<NtupleStationId> m_t0_filled, m_rt_filled; ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager* m_detMgr; + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + std::ostringstream m_data_string; int m_n_tubes_added; int m_n_tubes_chamber; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibDbOperations/src/CoolInserter.cxx b/MuonSpectrometer/MuonCalib/MuonCalibDbOperations/src/CoolInserter.cxx index 891960464b407ead4391eef9d621b0dd99f79c84..986bc8e2097f9f37a5df13abfbe849e51448cb48 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibDbOperations/src/CoolInserter.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibDbOperations/src/CoolInserter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //this @@ -29,7 +29,6 @@ #include "GaudiKernel/IMessageSvc.h" #include "StoreGate/StoreGateSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" //c - c++ #include "iostream" @@ -40,7 +39,7 @@ //using namespace cool; namespace MuonCalib { -CoolInserter::CoolInserter(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_version("v0.0"), p_reg_sel_svc(NULL), m_cool_connect(false), m_t0_created(false), m_rt_created(false), m_detMgr(NULL) { +CoolInserter::CoolInserter(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_version("v0.0"), p_reg_sel_svc(NULL), m_cool_connect(false), m_t0_created(false), m_rt_created(false) { declareProperty("CoolConnectionString", m_cool_connection_string); declareProperty("RtVersion", m_version); declareProperty("T0Tag", m_tagt0); @@ -77,11 +76,7 @@ StatusCode CoolInserter::initialize() { ATH_CHECK( m_muonIdHelperTool.retrieve() ); - sc = detStore->retrieve( m_detMgr ); - if (!sc.isSuccess()) { - log << MSG::FATAL << "Can't retrieve MuonDetectorManager" << endmsg; - return sc; - } + ATH_CHECK(m_DetectorManagerKey.initialize()); //get region selection service sc=service("RegionSelectionSvc", p_reg_sel_svc); @@ -189,7 +184,15 @@ bool CoolInserter::StartT0Chamber(const NtupleStationId & sid) { m_n_tubes_added=0; m_sid=sid; m_sid.SetMultilayer(0); - if (!m_sid.InitializeGeometry(m_muonIdHelperTool->mdtIdHelper(), m_detMgr)) + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return false; + } + + if (!m_sid.InitializeGeometry(m_muonIdHelperTool->mdtIdHelper(), MuonDetMgr)) return false; //get number of tubes int max_nly(-1); diff --git a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/ExtraTreeTrackFillerTool.h b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/ExtraTreeTrackFillerTool.h index 76148e3f4312408c254ecaa8307a591c12e43895..a9907865ae90c0758d507716902a0bf7198f55be 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/ExtraTreeTrackFillerTool.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/ExtraTreeTrackFillerTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef MuonCalib_ExtraTreeTrackFillerTool_h @@ -11,10 +11,12 @@ #include "TrkTrack/TrackCollection.h" #include "TrkToolInterfaces/IResidualPullCalculator.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + #include <vector> #include <set> -class MdtIdHelper; namespace Trk { class ITrackHoleSearchTool; class MeasurementBase; @@ -22,9 +24,6 @@ namespace Trk { class TrackStateOnSurface; class RIO_OnTrack; } -namespace MuonGM { - class MuonDetectorManager; -} namespace MuonCalib { @@ -41,12 +40,14 @@ class ExtraTreeTrackFillerTool: virtual public IExtraTreeFillerTool, public AthA protected: ToolHandle<IIdToFixedIdTool> m_idToFixedIdTool; ToolHandle<Trk::IResidualPullCalculator > m_pullCalculator; //!< private: - const MdtIdHelper *m_muonIdHelper; //<! + + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + std::string m_trackCollectionKey; std::vector<int> m_segment_authors; std::set<int> m_segment_authors_set; int m_author; - const MuonGM::MuonDetectorManager *m_detMgr; + //retrieve all tools StatusCode retrieveTools(); //store one track diff --git a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg.h b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg.h index 235f36deb0f366404b9ba8d9f17285ac8fdc2921..f8b7b62bc3426f54c85bd6a81be4f5e3c2e12a2b 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg.h @@ -24,12 +24,6 @@ class TFile; class TDirectory; class TTree; -class MdtIdHelper; - -namespace MuonGM { - class MuonDetectorManager; -} - namespace MuonCalib { class IExtraTreeFillerTool; class ISegmentOnTrackSelector; @@ -69,8 +63,6 @@ class ISegmentOnTrackSelector; bool createHitBranch(TTree* tree); //!< creates MuonCalibHit_EBranch bool createTrackBranch(TTree* tree); //!< creates hit overlap between two tracks - const MuonGM::MuonDetectorManager* m_detMgr; //<! MuonDetector manager - const MdtIdHelper* m_muonIdHelper;//<! // const MuonPrdPatternCollection* m_patterns; //!< Athena pattern Collection const MuonPatternCombinationCollection* m_patterns; //!< Athena pattern Collection bool m_doPhi; //!< property flagging wether to store PhiHits on ExtraTree diff --git a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/MuonCalibExtraTreeTriggerAlg.h b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/MuonCalibExtraTreeTriggerAlg.h index a3c9437640084bd1c06653335f77830e2530815c..dfb7e11df51b00d54059dedd2126e110f37d17ce 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/MuonCalibExtraTreeTriggerAlg.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/MuonCalibExtraTreeAlg/MuonCalibExtraTreeTriggerAlg.h @@ -21,9 +21,6 @@ class TgcIdHelper; class TileID; class TTree; -namespace MuonGM { - class MuonDetectorManager; -} namespace LVL1 { class RecMuonRoiSvc; } diff --git a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/ExtraTreeTrackFillerTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/ExtraTreeTrackFillerTool.cxx index ecacb0236bfca14e1db82bfb07f93b2333838c22..9bf403538a7807e0bcae6429c39d794ed70a359c 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/ExtraTreeTrackFillerTool.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/ExtraTreeTrackFillerTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "MuonCalibExtraTreeAlg/ExtraTreeTrackFillerTool.h" @@ -48,7 +48,6 @@ ExtraTreeTrackFillerTool::ExtraTreeTrackFillerTool(const std::string &type, cons AthAlgTool(type, name, parent), m_idToFixedIdTool( "MuonCalib::IdToFixedIdTool/MuonCalib_IdToFixedIdTool" ), m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator"), - m_muonIdHelper(NULL), m_author(0) { declareInterface<IExtraTreeFillerTool>(this); declareProperty("TrackCollectionKey", m_trackCollectionKey); @@ -59,6 +58,9 @@ ExtraTreeTrackFillerTool::ExtraTreeTrackFillerTool(const std::string &type, cons } StatusCode ExtraTreeTrackFillerTool::initialize() { + + ATH_CHECK(m_idHelperSvc.retrieve()); + if(!m_trackCollectionKey.size()) { ATH_MSG_FATAL("No TrackCollectionKey set!"); return StatusCode::FAILURE; @@ -132,15 +134,15 @@ inline void ExtraTreeTrackFillerTool::storeMeasurement(const Trk::MeasurementBas bool ismdt = false; if (rot) { type = 1; - if (m_muonIdHelper->is_muon(rot->identify())) { + if (m_idHelperSvc->mdtIdHelper().is_muon(rot->identify())) { id = m_idToFixedIdTool->idToFixedId(rot->identify()); - if(m_muonIdHelper->is_mdt(rot->identify())) ismdt = true; + if(m_idHelperSvc->mdtIdHelper().is_mdt(rot->identify())) ismdt = true; } } else { rotc = dynamic_cast<const Trk::CompetingRIOsOnTrack*> (measurement); if (rotc) { idc = rotc->rioOnTrack(0).identify(); - if (m_muonIdHelper->is_muon(idc)) id = m_idToFixedIdTool->idToFixedId(idc); + if (m_idHelperSvc->mdtIdHelper().is_muon(idc)) id = m_idToFixedIdTool->idToFixedId(idc); type = 2; } else { const Trk::PseudoMeasurementOnTrack *rotp = dynamic_cast<const Trk::PseudoMeasurementOnTrack*> (measurement); @@ -254,11 +256,7 @@ StatusCode ExtraTreeTrackFillerTool::retrieveTools() { ATH_MSG_FATAL("Failed to reteive pullCalculator!"); return StatusCode::FAILURE; } - if(!detStore()->retrieve( m_detMgr ).isSuccess()) { - ATH_MSG_FATAL("Failed to retrieve MuonDetectorManager"); - return StatusCode::FAILURE; - } - m_muonIdHelper = m_detMgr->mdtIdHelper(); + //initialize segment author set if not done if(m_segment_authors.size() && !m_segment_authors_set.size()) { for(std::vector<int>::const_iterator it=m_segment_authors.begin(); it!=m_segment_authors.end(); it++) { diff --git a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/MuonCalibExtraTreeAlg.cxx b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/MuonCalibExtraTreeAlg.cxx index fabc2a075ec22c505052f336235e61a24abe6c5b..597c0b8e360947454977a754249fa1f6f317a38f 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/MuonCalibExtraTreeAlg.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/MuonCalibExtraTreeAlg.cxx @@ -16,12 +16,9 @@ #include "MuonCalibIdentifier/MuonFixedId.h" #include "MuonCalibITools/IIdToFixedIdTool.h" -#include "MuonIdHelpers/MdtIdHelper.h" - #include "MuonPattern/MuonPatternCombination.h" #include "MuonPattern/MuonPattern.h" #include "TrkPrepRawData/PrepRawData.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" /*#include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "TrkDetElementBase/TrkDetElementBase.h" @@ -48,7 +45,6 @@ namespace MuonCalib{ MuonCalibExtraTreeAlg::MuonCalibExtraTreeAlg(const std::string &name, ISvcLocator *pSvcLocator) : AthAlgorithm(name, pSvcLocator), - m_muonIdHelper(0), m_patterns(0), m_doPhi(false), m_ntupleName(""), m_patternLocation(""),m_delayFinish(false), @@ -69,19 +65,12 @@ MuonCalibExtraTreeAlg::MuonCalibExtraTreeAlg(const std::string &name, ISvcLocato declareProperty("TrackFillerTools", m_track_fillers); declareProperty("IdToFixedIdTool", m_idToFixedIdTool); declareProperty("SegmentOnTrackSelector", m_segmentOnTrackSelector); - m_detMgr=NULL; } //end MuonCalibExtraTreeAlg::MuonCalibExtraTreeAlg MuonCalibExtraTreeAlg::~MuonCalibExtraTreeAlg() { } StatusCode MuonCalibExtraTreeAlg::initialize() { - StatusCode sc = detStore()->retrieve( m_detMgr ); - if ( sc.isFailure() ) { - ATH_MSG_FATAL(" Cannot retrieve MuonDetDescrMgr " << endmsg); - return StatusCode::FAILURE; - } - m_muonIdHelper = m_detMgr->mdtIdHelper(); return StatusCode::SUCCESS; } // end MuonCalibExtraTreeAlg::initialize diff --git a/MuonSpectrometer/MuonCalib/MuonCalibPatRec/MuonCalibPatRec/MuonSegmentToCalibSegment.h b/MuonSpectrometer/MuonCalib/MuonCalibPatRec/MuonCalibPatRec/MuonSegmentToCalibSegment.h index ae5594273ebd196cabf7944577c92a2ba6c92d15..968df06d63034dc6270409114141a984c213202c 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibPatRec/MuonCalibPatRec/MuonSegmentToCalibSegment.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibPatRec/MuonCalibPatRec/MuonSegmentToCalibSegment.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCALIB_MUONSEGMENTTOCALIBSEGMENT_H @@ -18,15 +18,12 @@ #include "MuonRecToolInterfaces/IMuonPatternSegmentAssociationTool.h" #include "MdtCalibSvc/MdtCalibrationTool.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" namespace Muon{ class MuonPatternCombination; } -namespace MuonGM { - class MuonDetectorManager; -} - namespace MuonCalib { /** @class MuonSegmentToCalibSegment @@ -65,10 +62,10 @@ output the muon calibration input. StatusCode savePatterns( const MuonCalibPatternCollection* newPatterns ) const; - MuonCalibSegment* createMuonCalibSegment( const Muon::MuonSegment& seg ) const; + MuonCalibSegment* createMuonCalibSegment( const Muon::MuonSegment& seg, const MuonGM::MuonDetectorManager* MuonDetMgr ) const; MuonCalibPattern* createMuonCalibPattern( const Muon::MuonPatternCombination* pat ) const; Identifier getChId( const Muon::MuonSegment& seg ) const; - Amg::Transform3D getGlobalToStation( const Identifier& id ) const; + Amg::Transform3D getGlobalToStation( const Identifier& id, const MuonGM::MuonDetectorManager* MuonDetMgr ) const; unsigned int getQuality( const Muon::MuonSegment& seg ) const; @@ -91,9 +88,11 @@ output the muon calibration input. std::string m_associationInputLocation; //!< Location of the association object for PatternCombis and SegmentCombis std::string m_cscAssociationInputLocation; //!< Location of the association object for PatternCombis and SegmentCombis - /** Pointer to MuonDetectorManager */ - const MuonGM::MuonDetectorManager* m_detMgr; - + /** MuonDetectorManager from the conditions store */ + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + /** Tool for the Identifier Helpers */ ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx b/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx index 2d4d11cc38532f1ce993760d40f469066b78c463..b94769feef5dfced8cd238b17092f8d928cf363d 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx @@ -16,7 +16,6 @@ #include "MuonIdHelpers/TgcIdHelper.h" // muon geomodel -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonRecToolInterfaces/IMuonPatternSegmentAssociationTool.h" #include "MuonPattern/MuonPatternCombination.h" @@ -60,7 +59,6 @@ namespace MuonCalib { MuonSegmentToCalibSegment::MuonSegmentToCalibSegment(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), - m_detMgr(NULL), m_calibrationTool("MdtCalibrationTool",this), m_assocTool("Muon::MuonPatternSegmentAssociationTool/MuonPatternSegmentAssociationTool"), m_idToFixedIdTool("MuonCalib::IdToFixedIdTool/MuonCalib_IdToFixedIdTool") @@ -116,7 +114,7 @@ namespace MuonCalib { m_log << MSG::INFO << "================================" << endmsg;*/ std::string managerName="Muon"; - ATH_CHECK( detStore()->retrieve(m_detMgr) ); + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_idToFixedIdTool.retrieve() ); ATH_CHECK( m_assocTool.retrieve() ); @@ -164,7 +162,14 @@ namespace MuonCalib { ATH_MSG_DEBUG( " convertPatterns() " ); - if( !m_readSegments ) { + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + + if( !m_readSegments ) { const MuonSegmentCombinationCollection* segCombis = retrieveSegmentCombinations(); @@ -217,7 +222,7 @@ namespace MuonCalib { continue; } - MuonCalibSegment* mdtSeg = createMuonCalibSegment( *seg ); + MuonCalibSegment* mdtSeg = createMuonCalibSegment( *seg, MuonDetMgr ); mdtSeg->setAuthor(seg->author()); calibpat->addMuonSegment( mdtSeg ); } @@ -276,7 +281,7 @@ namespace MuonCalib { ATH_MSG_DEBUG( "WARNING, empty muoncalibpattern created" ); MuonCalibPattern* pat = new MuonCalibPattern(); - MuonCalibSegment* mdtSeg = createMuonCalibSegment( *seg ); + MuonCalibSegment* mdtSeg = createMuonCalibSegment( *seg, MuonDetMgr ); if(*autIt<0) mdtSeg->setAuthor(seg->author()); else @@ -352,7 +357,7 @@ namespace MuonCalib { continue; } - MuonCalibSegment* CscSeg = createMuonCalibSegment( *seg ); + MuonCalibSegment* CscSeg = createMuonCalibSegment( *seg, MuonDetMgr ); CscSeg->setAuthor(seg->author()); calibpat->addMuonSegment( CscSeg ); } @@ -397,32 +402,32 @@ namespace MuonCalib { return rots.front()->identify(); } - Amg::Transform3D MuonSegmentToCalibSegment::getGlobalToStation( const Identifier& id ) const + Amg::Transform3D MuonSegmentToCalibSegment::getGlobalToStation( const Identifier& id, const MuonGM::MuonDetectorManager* MuonDetMgr ) const { if( m_muonIdHelperTool->mdtIdHelper().is_mdt( id ) ){ - const MuonGM::MdtReadoutElement* detEl = m_detMgr->getMdtReadoutElement(id); + const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(id); if( !detEl ) { ATH_MSG_WARNING( "getGlobalToStation failed to retrieve detEL byebye" ); }else{ return detEl->GlobalToAmdbLRSTransform(); } }else if( m_muonIdHelperTool->cscIdHelper().is_csc( id ) ){ - const MuonGM::CscReadoutElement* detEl = m_detMgr->getCscReadoutElement(id); + const MuonGM::CscReadoutElement* detEl = MuonDetMgr->getCscReadoutElement(id); if( !detEl ) { ATH_MSG_WARNING( "getGlobalToStation failed to retrieve detEL byebye" ); }else{ return detEl->transform().inverse(); } }else if( m_muonIdHelperTool->tgcIdHelper().is_tgc( id ) ){ - const MuonGM::TgcReadoutElement* detEl = m_detMgr->getTgcReadoutElement(id); + const MuonGM::TgcReadoutElement* detEl = MuonDetMgr->getTgcReadoutElement(id); if( !detEl ) { ATH_MSG_WARNING( "getGlobalToStation failed to retrieve detEL byebye" ); }else{ return detEl->transform().inverse(); } }else if( m_muonIdHelperTool->rpcIdHelper().is_rpc( id ) ){ - const MuonGM::RpcReadoutElement* detEl = m_detMgr->getRpcReadoutElement(id); + const MuonGM::RpcReadoutElement* detEl = MuonDetMgr->getRpcReadoutElement(id); if( !detEl ) { ATH_MSG_WARNING( "getGlobalToStation failed to retrieve detEL byebye" ); }else{ @@ -495,7 +500,7 @@ namespace MuonCalib { } - MuonCalibSegment* MuonSegmentToCalibSegment::createMuonCalibSegment( const Muon::MuonSegment& seg ) const + MuonCalibSegment* MuonSegmentToCalibSegment::createMuonCalibSegment( const Muon::MuonSegment& seg, const MuonGM::MuonDetectorManager* MuonDetMgr ) const { // convert MuonSegment to MuonCalibSegment @@ -503,7 +508,7 @@ namespace MuonCalib { // global to station transformation for this chamber Amg::Transform3D gToStationCheck = seg.associatedSurface().transform().inverse(); - Amg::Transform3D gToStation = getGlobalToStation( chid ); + Amg::Transform3D gToStation = getGlobalToStation( chid, MuonDetMgr ); // create the local position and direction vector Amg::Vector3D segPosG(seg.globalPosition()); Amg::Vector3D segDirG(seg.globalDirection()); diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/BarrelSecondCoordinatePreparationTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/BarrelSecondCoordinatePreparationTool.h index 5eb53708ed6ad95ede0bd4f20ba918ae14075c6c..a92308dd9d65a05d425d8f97d282a9266c0b4850 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/BarrelSecondCoordinatePreparationTool.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/BarrelSecondCoordinatePreparationTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -29,6 +29,7 @@ // MuonCalib // #include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" // AtlasCore // // AtlasConditions // @@ -37,12 +38,6 @@ #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/Vector.h" -namespace MuoinGM { - -class MuonDetectorManager; - -} - namespace MuonCalib { class IIdToFixedIdTool; @@ -77,7 +72,12 @@ class BarrelSecondCoordinatePreparationTool : public AthAlgTool, virtual public std::vector<int> num_same, double max_r, CLHEP::HepVector &tr_par, double &angle_err); private: - const MuonGM::MuonDetectorManager *m_detMgr; // pointer to the muon detector manager + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + const MuonCalib::IIdToFixedIdTool *m_id_tool; // identifier converter FILE* m_rpcHitsFile; //File to store RPC entries diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/RpcTimingCorr.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/RpcTimingCorr.h index 37e9a9014dc4641b2ae17b0abfb637664af60d4a..527aa1ffd8a46e2d74103a7bf7db5dedc5bb1d22 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/RpcTimingCorr.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/RpcTimingCorr.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef MuonCalib_RpcTimingCorr_H @@ -44,7 +44,6 @@ class RpcTimingCorr : public AlgTool, virtual public CalibSegmentPreparationTool RegionSelectionSvc *p_reg_sel_svc; StoreGateSvc *m_detStore; // pointer to the detector store const RpcIdHelper *m_RpcIdHelper; // pointer to the RPC ID helper - const MuonGM::MuonDetectorManager *m_detMgr; // pointer to the muon std::string m_detector_store; // name of the detector store std::string m_RPC_ID_helper; // name of the RPC ID helper diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRawdataSelector.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRawdataSelector.h index c234b4cdd7df10847e4e1900b2e2811cf29141f6..3a698f14d2fff1d72537c01133ceeec53e78d5c8 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRawdataSelector.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRawdataSelector.h @@ -18,15 +18,10 @@ #include "GeoPrimitives/GeoPrimitives.h" #include "MuonIdHelpers/MuonIdHelperTool.h" - +#include "MuonReadoutGeometry/MuonDetectorManager.h" class RegionSelectionSvc; - -namespace MuonGM { -class MuonDetectorManager; -} - namespace MuonCalib { class IIdToFixedIdTool; class MuonCalibRawMdtHit; @@ -59,7 +54,12 @@ class SegmentRawdataSelector : public AthAlgTool, virtual public CalibSegmentPre std::string m_idToFixedIdToolName; // name of the muon fixed id tool ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager *m_detMgr; // pointer to the muon detector manager + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + const MuonCalib::IIdToFixedIdTool *m_id_tool;// identifier converter //store segments, because we have to delete them std::set<MuonCalibSegment *> m_segments; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BarrelSecondCoordinatePreparationTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BarrelSecondCoordinatePreparationTool.cxx index a2e8832b1b1dd5b5e6ef48bed33003283635c915..fcbc7d3b8f50e125caa8326db5c1c2af1cd19d1e 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BarrelSecondCoordinatePreparationTool.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BarrelSecondCoordinatePreparationTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -24,7 +24,6 @@ //MuonReadoutGeometry #include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" //MuonCalibITools #include "MuonCalibITools/IIdToFixedIdTool.h" @@ -79,8 +78,8 @@ StatusCode BarrelSecondCoordinatePreparationTool::initialize(void) { ///////////// ATH_MSG_INFO( "Initializing tool..." ); -// muon detector manager // - ATH_CHECK( detStore()->retrieve(m_detMgr) ); +//retrieve detector manager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); // muon fixed id tool // ATH_CHECK( toolSvc()->retrieveTool("MuonCalib::IdToFixedIdTool", @@ -222,6 +221,13 @@ bool BarrelSecondCoordinatePreparationTool::handleRPChits(MuonCalibSegment & MDT vector<int> in_seg_sector; vector<int> num_hits_same_layer; + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return false; + } + vector<MuonCalibRawRpcHit *>::iterator raw_it = raw_hits.begin(); while (raw_it != raw_hits.end()) { bool bad_hit = false; @@ -317,7 +323,7 @@ bool BarrelSecondCoordinatePreparationTool::handleRPChits(MuonCalibSegment & MDT for (unsigned int l=0; l<MDT_segment.mdtHOT().size(); l++) { MuonFixedId ID(MDT_segment.mdtHOT()[l]->identify()); Identifier atl_id = m_id_tool->fixedIdToId(ID); - const MuonGM::MdtReadoutElement *MdtRoEl = m_detMgr->getMdtReadoutElement(atl_id); + const MuonGM::MdtReadoutElement *MdtRoEl = MuonDetMgr->getMdtReadoutElement(atl_id); double tube_length(MdtRoEl->tubeLength(atl_id)); Amg::Vector3D loc_position(MDT_segment.mdtHOT()[l]->localPosition()); diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRawdataSelector.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRawdataSelector.cxx index 931057ba0b245509291ab047e798e5aa312008d8..4a1a00307496c95052786388a953c9168b5b111b 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRawdataSelector.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRawdataSelector.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //this @@ -19,7 +19,6 @@ // MuonReadoutGeometry // #include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" // AtlasConditions // #include "MuonIdHelpers/MdtIdHelper.h" @@ -63,8 +62,8 @@ StatusCode SegmentRawdataSelector::initialize(void) { // MDT ID helper // ATH_CHECK( m_muonIdHelperTool.retrieve() ); -// muon detector manager // - ATH_CHECK( detStore()->retrieve(m_detMgr) ); +//retrieve detector manager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); // muon fixed id tool // ATH_CHECK( toolSvc()->retrieveTool(m_idToFixedIdToolType, m_idToFixedIdToolName, m_id_tool) ); @@ -73,6 +72,14 @@ StatusCode SegmentRawdataSelector::initialize(void) { } //end SegmentRawdataSelector::initialize void SegmentRawdataSelector::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> & segments) { + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + //delete old segments for(std::set<MuonCalibSegment *>::iterator it=m_segments.begin(); it!=m_segments.end(); it++) { delete (*it); @@ -94,7 +101,7 @@ void SegmentRawdataSelector::prepareSegments(const MuonCalibEvent *&event, std:: station_identifier.SetMultilayer(0); Identifier station_id = m_id_tool->fixedIdToId(hit->identify()); const MuonGM::MdtReadoutElement *MdtRoEl = - m_detMgr->getMdtReadoutElement(m_muonIdHelperTool->mdtIdHelper().channelID(station_id, + MuonDetMgr->getMdtReadoutElement(m_muonIdHelperTool->mdtIdHelper().channelID(station_id, hit->identify().mdtMultilayer(),hit->identify().mdtTubeLayer(),hit->identify().mdtTube())); if (MdtRoEl==0) { diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc/MdtCalibIOSvc/MdtCalibOutputDbSvc.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc/MdtCalibIOSvc/MdtCalibOutputDbSvc.h index 90c4ec10416d9eb1a70e163874dabe4df4bbae18..00f7c1eda9fbd692ec96104a0c995ab95bd63e3d 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc/MdtCalibIOSvc/MdtCalibOutputDbSvc.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc/MdtCalibIOSvc/MdtCalibOutputDbSvc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -48,11 +48,10 @@ #include "MuonCalibStandAloneBase/NtupleStationId.h" #include "MuonCalibStandAloneBase/CalibrationIOTool.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" + class RegionSelectionSvc; class MdtCalibInputSvc; -namespace MuonGM { - class MuonDetectorManager; -} // MuonCalib // //#include "MuonCalibIdentifier/MdtRegion.h" @@ -136,7 +135,12 @@ private: //access to geomodel ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager *m_detMgr; + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + //region selection service ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; //calibration input service diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc/src/MdtCalibOutputDbSvc.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc/src/MdtCalibOutputDbSvc.cxx index dde5ba331ea67a06f454455a8bbf4f4d6e765931..ae8d0c2ee20f05eb6454e61c5780383420ff7986 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc/src/MdtCalibOutputDbSvc.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc/src/MdtCalibOutputDbSvc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -22,7 +22,6 @@ //geo model #include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" // MuonCalib // #include "MdtCalibIOSvc/MdtCalibOutputDbSvc.h" @@ -87,7 +86,6 @@ MdtCalibOutputDbSvc::MdtCalibOutputDbSvc(const std::string &name,ISvcLocator *sv declareProperty("RegionSelectionSvc", m_reg_sel_svc); //for the sake of coverity - m_detMgr=NULL; m_resolution=NULL; return; @@ -127,8 +125,8 @@ StatusCode MdtCalibOutputDbSvc::initialize(void) { ATH_CHECK( serviceLocator()->service("DetectorStore", detStore) ); //retrieve mdt id helper ATH_CHECK( m_muonIdHelperTool.retrieve() ); - //retrieve detector manager - ATH_CHECK( detStore->retrieve( m_detMgr ) ); + //retrieve detector manager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); } //get region selection service @@ -199,6 +197,13 @@ StatusCode MdtCalibOutputDbSvc::saveCalibrationResults(void) { if(m_results==NULL) return StatusCode::SUCCESS; + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + StatusCode sc; /////////////// @@ -215,7 +220,7 @@ StatusCode MdtCalibOutputDbSvc::saveCalibrationResults(void) { MuonCalib::NtupleStationId the_id(*it); // get region geometry if required if (m_postprocess_calibration) { - if(!the_id.InitializeGeometry(m_muonIdHelperTool->mdtIdHelper(), m_detMgr)) { + if(!the_id.InitializeGeometry(m_muonIdHelperTool->mdtIdHelper(), MuonDetMgr)) { ATH_MSG_ERROR( "Faild to get geometry for " << the_id.regionId() ); } } diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleCalibADCTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleCalibADCTool.h index b4367728aa4a664bb118e6080589714ffb8a4875..a3807fbb385e6412fb3816eac536a8aefb0a49f6 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleCalibADCTool.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleCalibADCTool.h @@ -1,206 +1,207 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 20.06.2007, AUTHOR: Zhen YAN -// Used for ADC data studies and product the ADC parameters for time slewing -// 2009.01.14 new Tool NtupleCalibADCTool -// 2009.01.21 Empty frame is working in Athena frame -// 2009.01.22 Add ADC plot for ADC data studies -// 2009.02.26 Add new array histogram for radius range analysis -// 2009.03.06 Add new array histogram for studing the ADC varation with differnet segment AngleXZ -// 2009.06.22 Test the current version in new package, working on the producting of timeslewing coefficient -// 2009.07.02 v320 input_svc ->T0 and RT , slewing factor from r_MDT_residual_vs_ADC[15] -// 2009.07.15 v330 TS_factor[15] change range. Range 0 to 0.5, 0.5~1.5£¬13.5~15 -// 2009.07.23 v400 introduce the TS_cor and reset the driftRadius before the refit. new plot Residual_vs_Radius[3] -// 2009.08.27 v440 new plot radius_vs_distanceTowire ->> check the bugs on the NTUP filling -// 2009.08.31 v500 running version except r_MDT_residual_vs_ADC[15] -// 2009.09.02 v510 new ADC correction array, compile ok -// -// Todo list 1) Try to use GTFitter for the segment refit -// 2) Introduce TrRelation() class in CalibData -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#ifndef MuonCalib_NtupleCalibADCToolH -#define MuonCalib_NtupleCalibADCToolH - -//::::::::::::::::::::::::::::::::::::::: -//:: CLASS NtupleCalibADCTool :: -//::::::::::::::::::::::::::::::::::::::: - -/// \class NtupleCalibADCTool - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// STL // -#include <string> -#include <map> - -// ROOT // -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -class TF1; -class TTree; -class TProfile; - +// 20.06.2007, AUTHOR: Zhen YAN +// Used for ADC data studies and product the ADC parameters for time slewing +// 2009.01.14 new Tool NtupleCalibADCTool +// 2009.01.21 Empty frame is working in Athena frame +// 2009.01.22 Add ADC plot for ADC data studies +// 2009.02.26 Add new array histogram for radius range analysis +// 2009.03.06 Add new array histogram for studing the ADC varation with differnet segment AngleXZ +// 2009.06.22 Test the current version in new package, working on the producting of timeslewing coefficient +// 2009.07.02 v320 input_svc ->T0 and RT , slewing factor from r_MDT_residual_vs_ADC[15] +// 2009.07.15 v330 TS_factor[15] change range. Range 0 to 0.5, 0.5~1.5£¬13.5~15 +// 2009.07.23 v400 introduce the TS_cor and reset the driftRadius before the refit. new plot Residual_vs_Radius[3] +// 2009.08.27 v440 new plot radius_vs_distanceTowire ->> check the bugs on the NTUP filling +// 2009.08.31 v500 running version except r_MDT_residual_vs_ADC[15] +// 2009.09.02 v510 new ADC correction array, compile ok +// +// Todo list 1) Try to use GTFitter for the segment refit +// 2) Introduce TrRelation() class in CalibData +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#ifndef MuonCalib_NtupleCalibADCToolH +#define MuonCalib_NtupleCalibADCToolH + +//::::::::::::::::::::::::::::::::::::::: +//:: CLASS NtupleCalibADCTool :: +//::::::::::::::::::::::::::::::::::::::: + +/// \class NtupleCalibADCTool + +//:::::::::::::::::: +//:: HEADER FILES :: +//:::::::::::::::::: + +// STL // +#include <string> +#include <map> + +// ROOT // +#include "TFile.h" +#include "TH1.h" +#include "TH2.h" +class TF1; +class TTree; +class TProfile; + #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -// MuonCalib // -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibITools/IIdToFixedIdTool.h" -#include "MdtCalibFitters/CurvedPatRec.h" -#include "MuonCalibStandAloneBase/T0Refinement.h" -#include "MdtCalibUtils/GlobalTimeFitter.h" +#include "GaudiKernel/ServiceHandle.h" + +// MuonCalib // +#include "MuonCalibEventBase/MuonCalibEvent.h" +#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" +#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" +#include "MuonCalibStandAloneBase/NtupleStationId.h" +#include "MuonCalibITools/IIdToFixedIdTool.h" +#include "MdtCalibFitters/CurvedPatRec.h" +#include "MuonCalibStandAloneBase/T0Refinement.h" +#include "MdtCalibUtils/GlobalTimeFitter.h" #include "MdtCalibFitters/DCSLFitter.h" -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" -class RegionSelectionSvc; - -namespace MuonGM { -class MuonDetectorManager; -} - -namespace MuonCalib { - -class T0MTHistos; - -class NtupleCalibADCTool : public AthAlgTool, - virtual public NtupleCalibrationTool { - -public: -// Constructors // - NtupleCalibADCTool(const std::string & t, - const std::string & n, const IInterface * p); - ///< Constructor of the tool. - - ~NtupleCalibADCTool(void); - ///< Destructor of the tool. - -// Methods // -// methods required by the base classes // - StatusCode initialize(void); - ///< initialization of the tool - StatusCode finalize(void); - ///< finilization of the tool - StatusCode handleEvent(const MuonCalibEvent & event, int evnt_nb, - const std::vector<MuonCalibSegment *> & segments, - unsigned int position); - ///< analysis of the event, - ///< raw data and segment histograms - ///< are filled - bool KeepSegments(void) const; - ///< returns true, if segments should - ///< be stored in memory, false - ///< otherwise - -private: -// job options // - bool m_refit_segments; // = true, if the segments should be refitted, - // = false, if the segments are not refitted - bool m_Recalc2ndCoordinate; // use for certifate ADC_vs_distX and ADC_vs_DirXYZ - bool m_curved_fits; // = true, if curved segment fits should be performed, - // = false, if straight segment fits should be performed - double m_time_out; // time out for pattern finding - double m_road_width; // road width for pattern recognition - std::string m_MDT_ID_helper; // name of the MDT ID helper - std::string m_RPC_ID_helper; // name of the RPC ID helper - std::string m_idToFixedIdToolType; // type of the muon fixed id tool - std::string m_idToFixedIdToolName; // name of the muon fixed id tool - std::string m_ROOT_file_name; // name of the output ROOT file - //std::string m_group_by; // name of the output ROOT file -// double RA_table[30]; - -// ROOT file // - TFile *m_tfile; // pointer to the ROOT file in which the data have to - // be stored - -// calibration region // - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; -// calibration parameters // - ServiceHandle<MdtCalibInputSvc> m_input_service; // pointer to the calibration input - // service -// chamber parameters // - std::map<NtupleStationId, unsigned int> m_nb_ml; // number of - // multilayers - std::map<NtupleStationId, unsigned int> m_nb_ly; // number of layers per - // multilayer - std::map<NtupleStationId, unsigned int> m_nb_tb; // number of tubes per - // layer - - -// event data // - // number of raw MDT hits in - // the chambers - unsigned int m_nb_events; - // number of events - // strips [rDoublet][zDoublett] -// straight-line fitter // - QuasianalyticLineReconstruction *m_qfitter; - -// curved-line fitter // - CurvedPatRec *m_cfitter; - -// t0 refinement // - T0Refinement *m_t0_refinement; - -// histograms // - // segment histograms // -// ########## Group 1, the histograms for generating ADC correction factor ############### - - std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_radius; - std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_pathD; - std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_residual; - std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_posX; - std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_DistanceToSegmentTrack; - std::map<NtupleStationId, TH2F *> m_MDT_radius_vs_t; - std::map<NtupleStationId, TH2F *> m_MDT_radius_vs_DistanceToSegmentTrack; - - - std::map<NtupleStationId, TH2F*> m_r_MDT_residual_vs_adc[15]; - - std::map<NtupleStationId, TH1F *> m_MDT_segment_localangle_YZ; //local incidence angle XZ, YZ distributions of the segments - std::map<NtupleStationId, TH1F *> m_MDT_segment_localangle_XZ; - -// ########## Group 2, Histograms for compare the refit inprovement ############### - - std::map<NtupleStationId, TH2F *> m_MDT_residual_vs_radius[3]; - std::map<NtupleStationId, TH1F *> m_MDT_segment_hits[3]; - std::map<NtupleStationId, TH1F *> m_MDT_segment_chi2[3]; - std::map<NtupleStationId, TH1F *> m_MDT_segment_delta_chi2; -// std::map<NtupleStationId, TH1F *> m_MDT_segment_delta_residual; - - -// ########## Group 3, Histograms for ADC specify checking ############### -// 3.1 double hits -> ADC distribution v440 - std::map<NtupleStationId, TH2F *> m_MDT_shit_adc; - std::map<NtupleStationId, TH2F *> m_MDT_fhit_adc; -// 3.2 big residual hits -> working on - -// helpers // -// - - - const MdtIdHelper *m_MdtIdHelper; // pointer to the MDT ID helper - const RpcIdHelper *m_RpcIdHelper; // pointer to the RPC ID helper - - const MuonGM::MuonDetectorManager *m_detMgr; // pointer to the muon - // detector manager - const MuonCalib::IIdToFixedIdTool *m_id_tool; // identifier converter - -// private methods // - void createMaps(const MuonFixedId & id); - // create the histograms for the - // given station id if they do not - // exist -}; - -} - -#endif +#include "MdtCalibIOSvc/MdtCalibInputSvc.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" + +class RegionSelectionSvc; + +namespace MuonCalib { + +class T0MTHistos; + +class NtupleCalibADCTool : public AthAlgTool, + virtual public NtupleCalibrationTool { + +public: +// Constructors // + NtupleCalibADCTool(const std::string & t, + const std::string & n, const IInterface * p); + ///< Constructor of the tool. + + ~NtupleCalibADCTool(void); + ///< Destructor of the tool. + +// Methods // +// methods required by the base classes // + StatusCode initialize(void); + ///< initialization of the tool + StatusCode finalize(void); + ///< finilization of the tool + StatusCode handleEvent(const MuonCalibEvent & event, int evnt_nb, + const std::vector<MuonCalibSegment *> & segments, + unsigned int position); + ///< analysis of the event, + ///< raw data and segment histograms + ///< are filled + bool KeepSegments(void) const; + ///< returns true, if segments should + ///< be stored in memory, false + ///< otherwise + +private: +// job options // + bool m_refit_segments; // = true, if the segments should be refitted, + // = false, if the segments are not refitted + bool m_Recalc2ndCoordinate; // use for certifate ADC_vs_distX and ADC_vs_DirXYZ + bool m_curved_fits; // = true, if curved segment fits should be performed, + // = false, if straight segment fits should be performed + double m_time_out; // time out for pattern finding + double m_road_width; // road width for pattern recognition + std::string m_MDT_ID_helper; // name of the MDT ID helper + std::string m_RPC_ID_helper; // name of the RPC ID helper + std::string m_idToFixedIdToolType; // type of the muon fixed id tool + std::string m_idToFixedIdToolName; // name of the muon fixed id tool + std::string m_ROOT_file_name; // name of the output ROOT file + //std::string m_group_by; // name of the output ROOT file +// double RA_table[30]; + +// ROOT file // + TFile *m_tfile; // pointer to the ROOT file in which the data have to + // be stored + +// calibration region // + ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; +// calibration parameters // + ServiceHandle<MdtCalibInputSvc> m_input_service; // pointer to the calibration input + // service +// chamber parameters // + std::map<NtupleStationId, unsigned int> m_nb_ml; // number of + // multilayers + std::map<NtupleStationId, unsigned int> m_nb_ly; // number of layers per + // multilayer + std::map<NtupleStationId, unsigned int> m_nb_tb; // number of tubes per + // layer + + +// event data // + // number of raw MDT hits in + // the chambers + unsigned int m_nb_events; + // number of events + // strips [rDoublet][zDoublett] +// straight-line fitter // + QuasianalyticLineReconstruction *m_qfitter; + +// curved-line fitter // + CurvedPatRec *m_cfitter; + +// t0 refinement // + T0Refinement *m_t0_refinement; + +// histograms // + // segment histograms // +// ########## Group 1, the histograms for generating ADC correction factor ############### + + std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_radius; + std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_pathD; + std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_residual; + std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_posX; + std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_DistanceToSegmentTrack; + std::map<NtupleStationId, TH2F *> m_MDT_radius_vs_t; + std::map<NtupleStationId, TH2F *> m_MDT_radius_vs_DistanceToSegmentTrack; + + + std::map<NtupleStationId, TH2F*> m_r_MDT_residual_vs_adc[15]; + + std::map<NtupleStationId, TH1F *> m_MDT_segment_localangle_YZ; //local incidence angle XZ, YZ distributions of the segments + std::map<NtupleStationId, TH1F *> m_MDT_segment_localangle_XZ; + +// ########## Group 2, Histograms for compare the refit inprovement ############### + + std::map<NtupleStationId, TH2F *> m_MDT_residual_vs_radius[3]; + std::map<NtupleStationId, TH1F *> m_MDT_segment_hits[3]; + std::map<NtupleStationId, TH1F *> m_MDT_segment_chi2[3]; + std::map<NtupleStationId, TH1F *> m_MDT_segment_delta_chi2; +// std::map<NtupleStationId, TH1F *> m_MDT_segment_delta_residual; + + +// ########## Group 3, Histograms for ADC specify checking ############### +// 3.1 double hits -> ADC distribution v440 + std::map<NtupleStationId, TH2F *> m_MDT_SiHitAdc; + std::map<NtupleStationId, TH2F *> m_MDT_fhit_adc; +// 3.2 big residual hits -> working on + +// helpers // +// + + + const MdtIdHelper *m_MdtIdHelper; // pointer to the MDT ID helper + const RpcIdHelper *m_RpcIdHelper; // pointer to the RPC ID helper + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + + const MuonCalib::IIdToFixedIdTool *m_id_tool; // identifier converter + +// private methods // + void createMaps(const MuonFixedId & id); + // create the histograms for the + // given station id if they do not + // exist +}; + +} + +#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleControlHistogramsTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleControlHistogramsTool.h index 5748a8b1d832e753a58ef9bcaa6fa9cffe50fefa..7c773f659547ecb4432781cef401304792dec6aa 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleControlHistogramsTool.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleControlHistogramsTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -50,7 +50,6 @@ class TTree; class TProfile; namespace MuonGM { -class MuonDetectorManager; class RpcDetectorElement; } class RpcIdHelper; @@ -66,6 +65,8 @@ class RpcIdHelper; #include "MuonCalibStandAloneBase/T0Refinement.h" #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" + class RegionSelectionSvc; class MdtCalibInputSvc; @@ -235,8 +236,11 @@ private: const MdtIdHelper *m_MdtIdHelper; // pointer to the MDT ID helper const RpcIdHelper *m_RpcIdHelper; // pointer to the RPC ID helper - const MuonGM::MuonDetectorManager *m_detMgr; // pointer to the muon - // detector manager + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + const MuonCalib::IIdToFixedIdTool *m_id_tool; // identifier converter // private methods // diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleDisplayTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleDisplayTool.h index 0cd9fed31c42727693672ff800bdc833311212ec..64ee9f291668c8a8b94c221ec1ade1ef681fd917 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleDisplayTool.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleDisplayTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -43,10 +43,8 @@ class TApplication; #include "MdtCalibInterfaces/IMdtPatRecFitter.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" -namespace MuonGM{ -class MuonDetectorManager; -} class RegionSelectionSvc; namespace MuonCalib { @@ -93,7 +91,12 @@ class NtupleDisplayTool : public AthAlgTool, virtual public NtupleCalibrationToo //for retrieving the chamber geometry ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager* m_detMgr; + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + const MuonCalib::IIdToFixedIdTool *m_id_tool; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleMDTChamberGeometryDeterminationTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleMDTChamberGeometryDeterminationTool.h index e71c7f65acc76a6ce334bec4b7d2edd69276ab7b..4459e59a042265b4a1a3d21cd3e41dda6cd2d01f 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleMDTChamberGeometryDeterminationTool.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleMDTChamberGeometryDeterminationTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -52,11 +52,6 @@ class MdtCalibInputSvc; - -namespace MuonGM { -class MuonDetectorManager; -} - namespace MuonCalib { class IIdToFixedIdTool; @@ -168,8 +163,6 @@ private: // helpers // const MdtIdHelper *m_MdtIdHelper; // pointer to the MDT ID helper - const MuonGM::MuonDetectorManager *m_detMgr; // pointer to the muon - // detector manager const MuonCalib::IIdToFixedIdTool *m_id_tool; // identifier converter // private methods // diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleRunScanTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleRunScanTool.h index bddf444e15d7fcd52be38bd48dd25b277195cc66..5bed7e13dff1e73dda7d063384b5a0c93e2904f1 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleRunScanTool.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleRunScanTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef _NtupleRunScanTool_H @@ -15,14 +15,10 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" class TFile; - -namespace MuonGM { -class MuonDetectorManager; -} - namespace MuonCalib { @@ -68,7 +64,12 @@ class NtupleRunScanTool: public AthAlgTool, virtual public NtupleCalibrationToo //!access to geomodel ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager* m_detMgr; + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + //!iov informatino unsigned int m_time_min, m_time_max; unsigned int m_run_min, m_run_max; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleTubeEfficiencyTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleTubeEfficiencyTool.h index a35517df655a81b43086068b30380d0ec13919ff..fd7ecc1fecd6614031ccd697303e630686b7dc7d 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleTubeEfficiencyTool.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleTubeEfficiencyTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -39,6 +39,8 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" + class RegionSelectionSvc; //root @@ -47,10 +49,6 @@ class TNtuple; class TH1F; class TH1I; -namespace MuonGM{ -class MuonDetectorManager; -} - namespace MuonCalib { class QuasianalyticLineReconstruction; @@ -94,7 +92,12 @@ class NtupleTubeEfficiencyTool : public AthAlgTool, virtual public NtupleCalibra ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager* m_detMgr; + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + const MuonCalib::IIdToFixedIdTool *m_id_tool; // ROOT file and analysis ntuples/trees // diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleCalibADCTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleCalibADCTool.cxx index ad5b62717e6843add9cad79f893613dfdbef0479..4f0d007f48f6dd780d988fe1176444328cbd30f9 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleCalibADCTool.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleCalibADCTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -31,7 +31,6 @@ // MuonGeoModel // #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" // MuonCalib // #include "MdtCalibUtils/GlobalTimeFitter.h" @@ -161,13 +160,12 @@ for(int i=0;i<3;++i) } */ m_MDT_fhit_adc.clear(); -m_MDT_shit_adc.clear(); +m_MDT_SiHitAdc.clear(); // Other parameter m_nb_events = 0; m_MdtIdHelper = 0; m_RpcIdHelper = 0; - m_detMgr = 0; m_id_tool = 0; m_qfitter = new QuasianalyticLineReconstruction(); @@ -217,8 +215,8 @@ StatusCode NtupleCalibADCTool::initialize(void) { // RPC ID helper // ATH_CHECK( detStore()->retrieve(m_RpcIdHelper, m_RPC_ID_helper) ); -// muon detector manager // - ATH_CHECK( detStore()->retrieve(m_detMgr) ); +//retrieve detector manager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); // muon fixed id tool // ATH_CHECK( toolSvc()->retrieveTool(m_idToFixedIdToolType, @@ -443,11 +441,11 @@ double low_bin[15] = {52.1363,59.5508,72.9139,79.8775,82.4582,82.4905,81.2233,80 if(!((hit2->adcCount()>50)&&(hit->adcCount()>50))) continue; if(hit2->tdcCount()>hit->tdcCount()) { m_MDT_fhit_adc[station_identifier]->Fill(hit->tdcCount(),hit->adcCount(),1.0); - m_MDT_shit_adc[station_identifier]->Fill(hit2->tdcCount(),hit2->adcCount(),1.0); + m_MDT_SiHitAdc[station_identifier]->Fill(hit2->tdcCount(),hit2->adcCount(),1.0); } else { m_MDT_fhit_adc[station_identifier]->Fill(hit2->tdcCount(),hit2->adcCount(),1.0); - m_MDT_shit_adc[station_identifier]->Fill(hit->tdcCount(),hit->adcCount(),1.0); + m_MDT_SiHitAdc[station_identifier]->Fill(hit->tdcCount(),hit->adcCount(),1.0); } } // counter++; @@ -625,8 +623,15 @@ void NtupleCalibADCTool::createMaps(const MuonFixedId & id) { // GET THE GEOMETRY OF THE GIVEN CHAMBER // /////////////////////////////////////////// + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + Identifier station_id = m_id_tool->fixedIdToId(id); - const MuonGM::MdtReadoutElement *MdtRoEl =m_detMgr->getMdtReadoutElement(m_MdtIdHelper->channelID(station_id,1,1,1)); + const MuonGM::MdtReadoutElement *MdtRoEl =MuonDetMgr->getMdtReadoutElement(m_MdtIdHelper->channelID(station_id,1,1,1)); m_nb_ml[station_identifier] = m_MdtIdHelper->numberOfMultilayers(station_id); m_nb_ly[station_identifier] = MdtRoEl->getNLayers(); @@ -793,15 +798,15 @@ void NtupleCalibADCTool::createMaps(const MuonFixedId & id) { sprintf(delta_chi2,"%.7s_Segment_delta_chi2",chambername.c_str()); m_MDT_segment_delta_chi2[station_identifier]= new TH1F(delta_chi2,delta_chi2,100,-5,5); m_MDT_segment_delta_chi2[station_identifier]->SetXTitle("Delta_Segment_chi2()"); - char fhit[100],shit[100]; + char fhit[100],SiHit[100]; sprintf(fhit,"%.7s_fristHit_ADC_vs_TDC",chambername.c_str()); - sprintf(shit,"%.7s_secondHit_ADC_vs_TDC",chambername.c_str()); - m_MDT_fhit_adc[station_identifier]= new TH2F(fhit,shit,3000, 0,3000,500, 0, 500); + sprintf(SiHit,"%.7s_secondHit_ADC_vs_TDC",chambername.c_str()); + m_MDT_fhit_adc[station_identifier]= new TH2F(fhit,SiHit,3000, 0,3000,500, 0, 500); m_MDT_fhit_adc[station_identifier]->SetXTitle("ADC count(ns)"); m_MDT_fhit_adc[station_identifier]->SetYTitle("TDC count(ns)"); - m_MDT_shit_adc[station_identifier]= new TH2F(shit,shit,3000,0,3000, 500, 0, 500); - m_MDT_shit_adc[station_identifier]->SetXTitle("ADC count(ns)"); - m_MDT_shit_adc[station_identifier]->SetYTitle("TDC count(ns)"); + m_MDT_SiHitAdc[station_identifier]= new TH2F(SiHit,SiHit,3000,0,3000, 500, 0, 500); + m_MDT_SiHitAdc[station_identifier]->SetXTitle("ADC count(ns)"); + m_MDT_SiHitAdc[station_identifier]->SetYTitle("TDC count(ns)"); m_tfile->cd(".."); return; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleControlHistogramsTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleControlHistogramsTool.cxx index 1eb5a70f9bbbf4b80faa2fcaa7b3fa2d87bd7972..e979db49abd144d4fbda05a58cd58f605de5842e 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleControlHistogramsTool.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleControlHistogramsTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -32,7 +32,6 @@ #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" // MuonReadoutGeometry // -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" // MuonCalib // @@ -141,7 +140,6 @@ NtupleControlHistogramsTool::NtupleControlHistogramsTool(const std::string & t, m_nb_events = 0; m_MdtIdHelper = 0; m_RpcIdHelper = 0; - m_detMgr = 0; m_id_tool = 0; m_qfitter = new StraightPatRec(); @@ -190,8 +188,8 @@ StatusCode NtupleControlHistogramsTool::initialize(void) { // RPC ID helper // ATH_CHECK( detStore()->retrieve(m_RpcIdHelper, m_RPC_ID_helper) ); -// muon detector manager // - ATH_CHECK( detStore()->retrieve(m_detMgr) ); +//retrieve detector manager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); // muon fixed id tool // ATH_CHECK( toolSvc()->retrieveTool(m_idToFixedIdToolType, @@ -958,9 +956,16 @@ void NtupleControlHistogramsTool::createMaps(const MuonFixedId & id) { // GET THE GEOMETRY OF THE GIVEN CHAMBER // /////////////////////////////////////////// + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + Identifier station_id = m_id_tool->fixedIdToId(id); const MuonGM::MdtReadoutElement *MdtRoEl = - m_detMgr->getMdtReadoutElement( + MuonDetMgr->getMdtReadoutElement( m_MdtIdHelper->channelID(station_id,1,1,1)); m_nb_ml[station_identifier] = m_MdtIdHelper->numberOfMultilayers( @@ -977,7 +982,7 @@ void NtupleControlHistogramsTool::createMaps(const MuonFixedId & id) { // loop over possible Z doublets for (int z_doublet=0; z_doublet<4; z_doublet++){ const MuonGM::RpcReadoutElement *RpcRoEl = - m_detMgr->getRpcRElement_fromIdFields( + MuonDetMgr->getRpcRElement_fromIdFields( m_MdtIdHelper -> stationName(station_id),// int stationName, m_MdtIdHelper -> stationEta(station_id), // int stationEta, m_MdtIdHelper -> stationPhi(station_id), // int stationPhi diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleDisplayTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleDisplayTool.cxx index 612360179a3abcad165dfed545b44475180024cb..1c6358bc90324e8ec1cb11560a148e9d9ef7e46e 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleDisplayTool.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleDisplayTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -26,11 +26,8 @@ #include "MuonIdHelpers/MdtIdHelper.h" // MuonReadoutGeometry // -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" - - #include "Identifier/IdentifierHash.h" #include "MuonCalibITools/IIdToFixedIdTool.h" #include "MdtCalibInterfaces/IMdtSegmentFitter.h" @@ -137,7 +134,8 @@ StatusCode NtupleDisplayTool::initialize() { ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_CHECK( detStore()->retrieve( m_detMgr ) ); + //retrieve detector manager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); //retrieve fixed id tool std::string idToFixedIdToolType("MuonCalib::IdToFixedIdTool"); @@ -252,10 +250,17 @@ NtupleDisplayTool::handleEvent( const MuonCalibEvent & event, //working correctly, otherwise also for the first multilayer, the second is returned Mid.setMdtMultilayer(1); + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + Identifier station_id = m_id_tool->fixedIdToId(Mid); NtupleStationId st_id((segment.mdtHOT()[0])->identify()); st_id.SetMultilayer(0); - if (!st_id.InitializeGeometry(m_muonIdHelperTool->mdtIdHelper(), m_detMgr)) + if (!st_id.InitializeGeometry(m_muonIdHelperTool->mdtIdHelper(), MuonDetMgr)) return StatusCode::SUCCESS; if(m_nb_multilayers<0){ @@ -278,7 +283,7 @@ NtupleDisplayTool::handleEvent( const MuonCalibEvent & event, for (int multilayer=1; multilayer<m_nb_multilayers+1; multilayer++) { const MuonGM::MdtReadoutElement* MdtRoEl = - m_detMgr->getMdtReadoutElement( m_muonIdHelperTool->mdtIdHelper().channelID(station_id,multilayer,1,1) ); + MuonDetMgr->getMdtReadoutElement( m_muonIdHelperTool->mdtIdHelper().channelID(station_id,multilayer,1,1) ); //loop over layers for (int layer=st_id.LayerMin(multilayer-1); layer<=st_id.LayerMax(multilayer-1); layer++) { diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleRunScanTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleRunScanTool.cxx index 77cea45562cdc8f79c3a4b967675f76c39285f95..4f862ddf87199f8e72bdcd7511f3b1b4d7e151e3 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleRunScanTool.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleRunScanTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //c - c++ @@ -20,7 +20,6 @@ #include "MuonCalibEventBase/MuonCalibEvent.h" // MuonReadoutGeometry // -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" @@ -54,8 +53,10 @@ StatusCode NtupleRunScanTool::initialize() //get geometry //retrieve mdt id helper ATH_CHECK( m_muonIdHelperTool.retrieve() ); - //retrieve detector manager - ATH_CHECK( detStore()->retrieve( m_detMgr ) ); + + //retrieve detector manager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); + p_outfile = new TFile("RunScan.root", "RECREATE"); return StatusCode :: SUCCESS; } @@ -64,6 +65,13 @@ StatusCode NtupleRunScanTool::initialize() StatusCode NtupleRunScanTool::handleEvent(const MuonCalibEvent &event, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position) { //iov + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + const MuonCalibEventInfo & eventinfo(event.eventInfo()); if(eventinfo.timeStamp()<m_time_min) { @@ -93,7 +101,7 @@ StatusCode NtupleRunScanTool::handleEvent(const MuonCalibEvent &event, int /*evn HitCounter &counter(m_hit_counters[id]); if(!counter.IsInitialized()) { - if(!id.InitializeGeometry(m_muonIdHelperTool->mdtIdHelper(), m_detMgr)) + if(!id.InitializeGeometry(m_muonIdHelperTool->mdtIdHelper(), MuonDetMgr)) { ATH_MSG_FATAL( "Cannot initialize Geometry!" ); return StatusCode::FAILURE; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleTubeEfficiencyTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleTubeEfficiencyTool.cxx index 2ab13ccce76a892a10b4827cc12d94b0ca4f32ee..db4389305357171e35216ab59a8c7ed7737651cf 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleTubeEfficiencyTool.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleTubeEfficiencyTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -22,7 +22,6 @@ #include <cstdlib> // MuonReadoutGeometry // -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" @@ -107,7 +106,8 @@ StatusCode NtupleTubeEfficiencyTool::initialize() { ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_CHECK( detStore()->retrieve( m_detMgr ) ); + //retrieve detector manager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); //retrieve fixed id tool std::string idToFixedIdToolType("MuonCalib::IdToFixedIdTool"); @@ -391,11 +391,18 @@ NtupleTubeEfficiencyTool::handleEvent( const MuonCalibEvent & event, m_qfitter->switchOnRefit(); //m_qfitter->fit(segment); + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + //loop over multilayers for (int multilayer=1; multilayer<m_nb_multilayers+1; multilayer++) { const MuonGM::MdtReadoutElement* MdtRoEl = - m_detMgr->getMdtReadoutElement( m_muonIdHelperTool->mdtIdHelper().channelID(station_id,multilayer,1,1) ); + MuonDetMgr->getMdtReadoutElement( m_muonIdHelperTool->mdtIdHelper().channelID(station_id,multilayer,1,1) ); if(m_nb_layers<0) m_nb_layers = MdtRoEl->getNLayers(); if(m_nb_tubes<0) m_nb_tubes = MdtRoEl->getNtubesperlayer(); diff --git a/MuonSpectrometer/MuonCalib/MuonCalibTools/MuonCalibTools/IdToFixedIdTool.h b/MuonSpectrometer/MuonCalib/MuonCalibTools/MuonCalibTools/IdToFixedIdTool.h index 2323ae1129a43dd3f862c1bdfdb3c9a583e64586..b2545a02b0fd685d300c54d2f232fe2734418398 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibTools/MuonCalibTools/IdToFixedIdTool.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibTools/MuonCalibTools/IdToFixedIdTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -21,7 +21,6 @@ // this package #include "MuonCalibITools/IIdToFixedIdTool.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "Identifier/Identifier.h" namespace Muon { diff --git a/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/RpcCalibTools/RpcExtrapolationTool.h b/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/RpcCalibTools/RpcExtrapolationTool.h index aa252f05b578569fd4fb7e66b6d047e5a8984025..1066fbb3aaf205f91b13d52aa7c4eb5ac5cde659 100644 --- a/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/RpcCalibTools/RpcExtrapolationTool.h +++ b/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/RpcCalibTools/RpcExtrapolationTool.h @@ -6,7 +6,6 @@ #define RPC_EXTRAPOLATIONTOOL #include "AthenaBaseComps/AthAlgTool.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "AthLinks/DataLink.h" #include "GaudiKernel/ToolHandle.h" @@ -52,7 +51,6 @@ class RpcExtrapolationTool: public AthAlgTool{ private: bool m_cosmicMode; - const MuonGM::MuonDetectorManager* m_muonMgr; ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; ToolHandle<Trk::IPropagator> m_propagator; diff --git a/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/RpcCalibTools/RpcResidualsTool.h b/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/RpcCalibTools/RpcResidualsTool.h index d1020613c98c407d14642938a6f4bd810adb15fc..f2512e15065831f2bcc044297ce3cfeb788faf5b 100644 --- a/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/RpcCalibTools/RpcResidualsTool.h +++ b/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/RpcCalibTools/RpcResidualsTool.h @@ -62,7 +62,12 @@ class RpcResidualsTool: public AthAlgTool{ std::string m_clusCollection; ActiveStoreSvc* m_activeStore; - const MuonGM::MuonDetectorManager* m_muonMgr; + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; RpcExtrapolationTool* m_rpcExtrapolTool; diff --git a/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/src/RpcExtrapolationTool.cxx b/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/src/RpcExtrapolationTool.cxx index 7641c48cfe615e87f9c6ea966f828409325e10c7..dd3c6b9e7f120d2f4fd510ad75cd445702ba654a 100644 --- a/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/src/RpcExtrapolationTool.cxx +++ b/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/src/RpcExtrapolationTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "RpcCalibTools/RpcExtrapolationTool.h" @@ -46,9 +46,6 @@ StatusCode RpcExtrapolationTool::initialize(){ ATH_MSG_DEBUG( "in initialize()" ); - // Retrieve the MuonDetectorManager - ATH_CHECK( detStore()->retrieve(m_muonMgr) ); - // Get the Navigation AlgTools ATH_CHECK( m_navigator.retrieve() ); diff --git a/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/src/RpcResidualsTool.cxx b/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/src/RpcResidualsTool.cxx index 27c05a2338012c1bdc56f8c190fca7157d4a0136..36fb7e77340dfad8cfb11a310b2d0c470f538cf8 100644 --- a/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/src/RpcResidualsTool.cxx +++ b/MuonSpectrometer/MuonCalib/RpcCalib/RpcCalibTools/src/RpcResidualsTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "RpcCalibTools/RpcExtrapolationTool.h" @@ -43,8 +43,8 @@ StatusCode RpcResidualsTool::initialize(){ // retrieve the active store ATH_CHECK( serviceLocator()->service("ActiveStoreSvc", m_activeStore) ); - // Retrieve the MuonDetectorManager - ATH_CHECK( detStore()->retrieve(m_muonMgr) ); + //retrieve detector manager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); // get extrapolation tool @@ -113,6 +113,13 @@ void RpcResidualsTool::getRpcResiduals(TrackCollection::const_iterator theTrack, } } + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + // now loop over extrapolations: std::vector<RpcExtrapolationResults>::const_iterator theExtra=extrapolations.begin(); @@ -186,7 +193,7 @@ void RpcResidualsTool::getRpcResiduals(TrackCollection::const_iterator theTrack, if(panel_id==m_muonIdHelperTool->rpcIdHelper().panelID(result.id)){ - const MuonGM::RpcReadoutElement* descriptor = m_muonMgr->getRpcReadoutElement((*rpcPrd)->identify()); + const MuonGM::RpcReadoutElement* descriptor = MuonDetMgr->getRpcReadoutElement((*rpcPrd)->identify()); // eta residual float residual=0.; diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.cxx index 59b2dc71b510b21934b0affc9393c7911578b7ae..6915dc9ae72187a1eba395e3a0d2da27a8a56abe 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.cxx @@ -47,7 +47,9 @@ StatusCode Muon::CSC_RawDataProviderTool::initialize() { // call initialize from base class ATH_CHECK( CSC_RawDataProviderToolCore::initialize() ); - + + ATH_CHECK(m_idHelperSvc.retrieve()); + return StatusCode::SUCCESS; } @@ -56,8 +58,7 @@ StatusCode Muon::CSC_RawDataProviderTool::initialize() // new one StatusCode Muon::CSC_RawDataProviderTool::convert(const std::vector<IdentifierHash>& rdoIdhVect){ - const CscIdHelper* idHelper = m_muonMgr->cscIdHelper(); - IdContext cscContext = idHelper->module_context(); + IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context(); std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vecOfRobf; std::vector< uint32_t > robIds; @@ -113,7 +114,7 @@ Muon::CSC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs, } else { - ATH_CHECK( rdoContainerHandle.record(std::make_unique<CscRawDataContainer>( m_muonMgr->cscIdHelper()->module_hash_max() ))); + ATH_CHECK( rdoContainerHandle.record(std::make_unique<CscRawDataContainer>( m_idHelperSvc->cscIdHelper().module_hash_max() ))); ATH_MSG_DEBUG( "Created CSCRawDataContainer" ); container = rdoContainerHandle.ptr(); } diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.h index 330e43dad0bb7e0b17a2d4219d17a6040cf577d1..a9be02ed374f66ef7c32e1f9af787f6e63d18edb 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderTool.h @@ -11,7 +11,9 @@ #include "CSC_RawDataProviderToolCore.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Muon { @@ -49,7 +51,8 @@ public: StatusCode convert(const EventContext& ctx) const; private: - + + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; } // end of namespace diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.cxx index 1b3398589e300c1c9c11aef8577e76d094b13a68..69a32a274581880d5358e0bd891767f4fe276e65 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.cxx @@ -53,6 +53,8 @@ StatusCode Muon::CSC_RawDataProviderToolMT::initialize() // Initialise the container cache if available ATH_CHECK( m_rdoContainerCacheKey.initialize( !m_rdoContainerCacheKey.key().empty() ) ); + ATH_CHECK(m_idHelperSvc.retrieve()); + return StatusCode::SUCCESS; } @@ -61,8 +63,7 @@ StatusCode Muon::CSC_RawDataProviderToolMT::initialize() // new one StatusCode Muon::CSC_RawDataProviderToolMT::convert(const std::vector<IdentifierHash>& rdoIdhVect){ - const CscIdHelper* idHelper = m_muonMgr->cscIdHelper(); - IdContext cscContext = idHelper->module_context(); + IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context(); std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vecOfRobf; std::vector< uint32_t > robIds; @@ -106,7 +107,7 @@ Muon::CSC_RawDataProviderToolMT::convert(const ROBFragmentList& vecRobs, // Split the methods to have one where we use the cache and one where we just setup the container const bool externalCacheRDO = !m_rdoContainerCacheKey.key().empty(); if(!externalCacheRDO){ - ATH_CHECK( rdoContainerHandle.record(std::make_unique<CscRawDataContainer>( m_muonMgr->cscIdHelper()->module_hash_max() ))); + ATH_CHECK( rdoContainerHandle.record(std::make_unique<CscRawDataContainer>( m_idHelperSvc->cscIdHelper().module_hash_max() ))); ATH_MSG_DEBUG( "Created CSCRawDataContainer" ); } else{ diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.h index 5bdb1e996e1d22075cf828b0100a6eabc5bfe3f7..83319a800d2ba2a5ef76e759c7e812c58eef872c 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CSC_RawDataProviderToolMT.h @@ -11,8 +11,10 @@ #include "CSC_RawDataProviderToolCore.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" #include "MuonRDO/CscRawDataCollection_Cache.h" #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Muon { @@ -54,6 +56,8 @@ private: /// CSC container cache key SG::UpdateHandleKey<CscRawDataCollection_Cache> m_rdoContainerCacheKey ; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + }; } // end of namespace diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.cxx index c46bc865078dfa2b6de1347483365273cc3faf1f..f0c0942c57d4ccd6ba943e313a968fa6a14d2712 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.cxx @@ -133,7 +133,7 @@ StatusCode CscRdoToCscPrepDataToolCore::decode(const CscRawDataContainer* rdoCon //These collections can be empty for the trigger if(!m_outputCollection || m_outputCollection->size()==0){ ATH_MSG_DEBUG("Stored empty collection."); - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } // identifiers of collections already decoded and stored in the container will be skipped diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscPrepDataContainerCnv.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscPrepDataContainerCnv.cxx index 9f0acb10974041107b9d69fdf4adb8a84c710e37..8bc1315bd4281177152cfc8be6e7d230c9caedd7 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscPrepDataContainerCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscPrepDataContainerCnv.cxx @@ -17,9 +17,6 @@ #include "MuonEventTPCnv/CscPrepDataContainerCnv_tlp1.h" -// #include "MuonReadoutGeometry/MuonDetectorManager.h" -// #include "MuonReadoutGeometry/CscReadoutElement.h" - CscPrepDataContainerCnv::CscPrepDataContainerCnv(ISvcLocator* svcloc) : CscPrepDataContainerCnvBase(svcloc) { diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscStripPrepDataContainerCnv.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscStripPrepDataContainerCnv.cxx index e437cd562249c777c7ac50dd3796adf610b8f022..3814cbc1a82a3a912ec00d5d35fd7bdf14a72652 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscStripPrepDataContainerCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscStripPrepDataContainerCnv.cxx @@ -14,10 +14,6 @@ // Id includes // #include "MuonIdHelpers/CscIdHelper.h" #include "MuonPrepRawData/CscStripPrepDataContainer.h" -// #include "MuonReadoutGeometry/MuonDetectorManager.h" -// #include "MuonReadoutGeometry/CscReadoutElement.h" - - CscStripPrepDataContainerCnv::CscStripPrepDataContainerCnv(ISvcLocator* svcloc) : CscStripPrepDataContainerCnvBase(svcloc), diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscStripPrepDataContainerCnv.h b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscStripPrepDataContainerCnv.h index 06e65088e09e6e45595f650d8fe28bd7b1019098..f1fe635969e48a019730cbd0daeef2fb8630ce0e 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscStripPrepDataContainerCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/CscStripPrepDataContainerCnv.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONEVENTATHENAPOOL_CSCSTRIPPREPDATACONTAINERCNV_H @@ -13,10 +13,6 @@ class StoreGateSvc; class CscStripIdHelper; -namespace MuonGM { - class MuonDetectorManager; -} - // the latest persistent representation type of DataCollection: typedef Muon::CscStripPrepDataContainer_tlp1 CscStripPrepDataContainer_PERS; typedef T_AthenaPoolCustomCnv<Muon::CscStripPrepDataContainer, CscStripPrepDataContainer_PERS > CscStripPrepDataContainerCnvBase; @@ -49,8 +45,6 @@ private: //CscStripPrepDataContainerCnv_p1 m_converter_p1; CscStripPrepDataContainerCnv_tlp1 m_TPConverter; - //const CscStripIdHelper* m_cscId; - //const MuonGM::MuonDetectorManager* m_muonMgr; //!< Muon Detector Manager }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MMPrepDataContainerCnv.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MMPrepDataContainerCnv.cxx index e0b140c5c5d346cf95f26c5cff7f8c4cf95dbf5f..cb8ed53a05e08d0660c6c2c8556b6a93a63a3de5 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MMPrepDataContainerCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MMPrepDataContainerCnv.cxx @@ -15,9 +15,6 @@ // #include "MuonIdHelpers/MMIdHelper.h" #include "MuonPrepRawData/MMPrepDataContainer.h" -// #include "MuonReadoutGeometry/MuonDetectorManager.h" -// #include "MuonReadoutGeometry/MMReadoutElement.h" - MMPrepDataContainerCnv::MMPrepDataContainerCnv(ISvcLocator* svcloc) : MMPrepDataContainerCnvBase(svcloc) { diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtPrepDataContainerCnv.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtPrepDataContainerCnv.cxx index 9177ddeb6ef0f71ba0f6b2244cf910c338512aed..67caf1c1dbdc5ce1d23c35e7488e8004807d039c 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtPrepDataContainerCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtPrepDataContainerCnv.cxx @@ -16,7 +16,6 @@ // Id includes #include "MuonIdHelpers/MdtIdHelper.h" #include "MuonPrepRawData/MdtPrepDataContainer.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtPrepDataContainerCnv.h b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtPrepDataContainerCnv.h index bf0d3bd1d030b0adc4f28014b55107e61a015a5e..b2fbc44ecb6f81db2d5280978e51f9c7ba6d722f 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtPrepDataContainerCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtPrepDataContainerCnv.h @@ -14,10 +14,6 @@ class StoreGateSvc; class MdtIdHelper; -namespace MuonGM { - class MuonDetectorManager; -} - // the latest persistent representation type of DataCollection: typedef Muon::MdtPrepDataContainer_p2 MdtPrepDataContainer_PERS; typedef T_AthenaPoolCustomCnv<Muon::MdtPrepDataContainer, MdtPrepDataContainer_PERS > MdtPrepDataContainerCnvBase; diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPadContainerCnv_p1.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPadContainerCnv_p1.cxx index 63a154806863c501ecaaa98dbabb0365f2554086..ff7bbc6e9c0b8608054675dcd48b8e859a05ddb9 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPadContainerCnv_p1.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPadContainerCnv_p1.cxx @@ -7,7 +7,6 @@ #include "MuonEventAthenaPool/RpcPad_p1.h" #include "MuonEventAthenaPool/RpcPadContainer_p1.h" #include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "RpcPadCnv_p1.h" #include "RpcPadContainerCnv_p1.h" diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPadContainerCnv_p2.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPadContainerCnv_p2.cxx index da9bbf5ad250fdb1e2f6e73acf5cec8758cb3f30..7adf612c718cd609c8c238eaf84dcb21c8557c5b 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPadContainerCnv_p2.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPadContainerCnv_p2.cxx @@ -7,7 +7,6 @@ #include "MuonEventAthenaPool/RpcPad_p1.h" #include "MuonEventAthenaPool/RpcPadContainer_p2.h" #include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "RpcPadCnv_p1.h" #include "RpcPadContainerCnv_p2.h" diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPrepDataContainerCnv.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPrepDataContainerCnv.cxx index aa88c115a78f07224dcb4758a9959abfeccff662..89dcc7a19e61ae0327a6dab47a9cde071feecd2e 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPrepDataContainerCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPrepDataContainerCnv.cxx @@ -14,7 +14,6 @@ // Id includes #include "MuonIdHelpers/RpcIdHelper.h" #include "MuonPrepRawData/RpcPrepDataContainer.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPrepDataContainerCnv.h b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPrepDataContainerCnv.h index d7bae5304f6e0a64f5892eb12472d4f49ccfd592..81dfca1daeb7aef7c8db1f0f6a682e255aa5a04b 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPrepDataContainerCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcPrepDataContainerCnv.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONEVENTATHENAPOOL_RPCPREPDATACONTAINERCNV_H @@ -14,10 +14,6 @@ class StoreGateSvc; class RpcIdHelper; -namespace MuonGM { - class MuonDetectorManager; -} - // the latest persistent representation type of DataCollection: typedef Muon::RpcPrepDataContainer_p3 RpcPrepDataContainer_PERS; typedef T_AthenaPoolCustomCnv<Muon::RpcPrepDataContainer, RpcPrepDataContainer_PERS > RpcPrepDataContainerCnvBase; diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcSectorLogicContainerCnv_p1.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcSectorLogicContainerCnv_p1.cxx index e80a25bcc1b869b631a22aba98041dae279d5c28..5855332683d4e7f6fed26dafc717074fc0c550dc 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcSectorLogicContainerCnv_p1.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/RpcSectorLogicContainerCnv_p1.cxx @@ -8,8 +8,6 @@ #include "RpcSectorLogicContainerCnv_p1.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - // Gaudi #include "GaudiKernel/ISvcLocator.h" #include "GaudiKernel/Bootstrap.h" diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcCoinDataContainerCnv.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcCoinDataContainerCnv.cxx index da3e4ca1b1fedc6f17576473b5e0ca261cc7e259..df19044a757e269c852e09b2d4a05ab2d92c74c4 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcCoinDataContainerCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcCoinDataContainerCnv.cxx @@ -15,7 +15,6 @@ // Id includes #include "MuonIdHelpers/TgcIdHelper.h" #include "MuonTrigCoinData/TgcCoinDataContainer.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcCoinDataContainerCnv.h b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcCoinDataContainerCnv.h index afc4eb49982f6d59e2569040d35ce6ad8c5cf35b..19dd894c1c8f7cff870403787c80d0aee6a43f63 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcCoinDataContainerCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcCoinDataContainerCnv.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /* Takashi Kubota - June 30, 2008 */ @@ -17,10 +17,6 @@ class StoreGateSvc; class TgcIdHelper; -namespace MuonGM { - class MuonDetectorManager; -} - // the latest persistent representation type of DataCollection: typedef Muon::TgcCoinDataContainer_tlp3 TgcCoinDataContainer_PERS; typedef T_AthenaPoolCustomCnv<Muon::TgcCoinDataContainer, TgcCoinDataContainer_PERS > TgcCoinDataContainerCnvBase; @@ -56,8 +52,6 @@ private: TgcCoinDataContainerCnv_tlp2 m_TPConverter_tlp2; TgcCoinDataContainerCnv_tlp3 m_TPConverter_tlp3; - //const TgcIdHelper* m_cscId; - //const MuonGM::MuonDetectorManager* m_muonMgr; //!< Muon Detector Manager }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcPrepDataContainerCnv.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcPrepDataContainerCnv.cxx index 99dbbfd7a7fcb97ebf08002a7903580960b5a5b6..38c6ffbee820710e50650d3508bc3a1ef78c47b5 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcPrepDataContainerCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcPrepDataContainerCnv.cxx @@ -14,7 +14,6 @@ // Id includes #include "MuonIdHelpers/TgcIdHelper.h" #include "MuonPrepRawData/TgcPrepDataContainer.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" TgcPrepDataContainerCnv::TgcPrepDataContainerCnv(ISvcLocator* svcloc) : diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcPrepDataContainerCnv.h b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcPrepDataContainerCnv.h index f83c8545c7d45a1b649fabeaeb955436ffa27376..89d4635e1009c1c151a8f764f1c6d2399a781fa5 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcPrepDataContainerCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/TgcPrepDataContainerCnv.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONEVENTATHENAPOOL_TGCPREPDATACONTAINERCNV_H @@ -16,10 +16,6 @@ class StoreGateSvc; class TgcIdHelper; -namespace MuonGM { - class MuonDetectorManager; -} - // the latest persistent representation type of DataCollection: typedef Muon::TgcPrepDataContainer_p3 TgcPrepDataContainer_PERS; typedef T_AthenaPoolCustomCnv<Muon::TgcPrepDataContainer, TgcPrepDataContainer_PERS > TgcPrepDataContainerCnvBase; diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/sTgcPrepDataContainerCnv.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/sTgcPrepDataContainerCnv.cxx index 4f7f02542abfb6bdc3360b21632d5e912959999f..abedc62819b4c70c70bbc4ba9a1dc6551f587ada 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/sTgcPrepDataContainerCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/sTgcPrepDataContainerCnv.cxx @@ -15,9 +15,6 @@ // #include "MuonIdHelpers/sTgcIdHelper.h" #include "MuonPrepRawData/sTgcPrepDataContainer.h" -// #include "MuonReadoutGeometry/MuonDetectorManager.h" -// #include "MuonReadoutGeometry/sTgcReadoutElement.h" - sTgcPrepDataContainerCnv::sTgcPrepDataContainerCnv(ISvcLocator* svcloc) : sTgcPrepDataContainerCnvBase(svcloc) { diff --git a/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.cxx b/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.cxx index 814f5991e3d68d3ad8d1de371e44f504808210dd..df2c4848b15c6c4d6cec04f897ea60f38cfe554b 100755 --- a/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.cxx @@ -12,8 +12,7 @@ #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkPrepRawData/PrepRawData.h" #include "TrkDetElementBase/TrkDetElementBase.h" -//Muon DD manager -#include "MuonReadoutGeometry/MuonDetectorManager.h" + #include "MuonReadoutGeometry/CscReadoutElement.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" @@ -40,35 +39,24 @@ Muon::MuonEventCnvTool::MuonEventCnvTool( const std::string& n, const IInterface* p ) : - AthAlgTool(t,n,p), - m_muonMgr(nullptr) + AthAlgTool(t,n,p) { declareInterface<ITrkEventCnvTool>(this); } StatusCode Muon::MuonEventCnvTool::initialize() { -// StatusCode sc = IPatToTrackToolBase::initialize(); -// if (sc.isFailure()) return sc; - - // Get Muon Detector Description Manager - StatusCode sc = detStore()->retrieve(m_muonMgr); - if (sc.isFailure()) { - ATH_MSG_FATAL("Could not get MuonReadoutGeometry DetectorDescription manager"); - return StatusCode::FAILURE; - }else{ - ATH_MSG_DEBUG( "Found MuonReadoutGeometry DetectorDescription manager at :"<<m_muonMgr); - } - ATH_CHECK(m_idHelperSvc.retrieve()); - ATH_CHECK(m_rpcPrdKey.initialize()); - ATH_CHECK(m_cscPrdKey.initialize(!m_cscPrdKey.empty())); // check for layouts without CSCs - ATH_CHECK(m_tgcPrdKey.initialize()); - ATH_CHECK(m_mdtPrdKey.initialize()); - ATH_CHECK(m_mmPrdKey.initialize(!m_mmPrdKey.empty())); // check for layouts without MicroMegas - ATH_CHECK(m_stgcPrdKey.initialize(!m_stgcPrdKey.empty())); // check for layouts without STGCs + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_rpcPrdKey.initialize()); + ATH_CHECK(m_cscPrdKey.initialize(!m_cscPrdKey.empty())); // check for layouts without CSCs + ATH_CHECK(m_tgcPrdKey.initialize()); + ATH_CHECK(m_mdtPrdKey.initialize()); + ATH_CHECK(m_mmPrdKey.initialize(!m_mmPrdKey.empty())); // check for layouts without MicroMegas + ATH_CHECK(m_stgcPrdKey.initialize(!m_stgcPrdKey.empty())); // check for layouts without STGCs + ATH_CHECK(m_DetectorManagerKey.initialize()); - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } void @@ -102,16 +90,23 @@ std::pair<const Trk::TrkDetElementBase*, const Trk::PrepRawData*> const PrepRawData* prd = 0; const Identifier& id = rioOnTrack.identify(); - if ( m_muonMgr!=0) { + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return std::pair<const Trk::TrkDetElementBase*, const Trk::PrepRawData*>(detEl,prd); + } + + if ( MuonDetMgr!=0) { //TODO Check that these are in the most likely ordering, for speed. EJWM. if (m_idHelperSvc->isRpc(id)){ - detEl = m_muonMgr->getRpcReadoutElement( id ) ; + detEl = MuonDetMgr->getRpcReadoutElement( id ) ; if (m_manuallyFindPRDs) prd = rpcClusterLink(id, rioOnTrack.idDE()); } else if(m_idHelperSvc->isCsc(id)){ - detEl = m_muonMgr->getCscReadoutElement( id ) ; + detEl = MuonDetMgr->getCscReadoutElement( id ) ; if (m_manuallyFindPRDs) prd = cscClusterLink(id, rioOnTrack.idDE()); } else if(m_idHelperSvc->isTgc(id)){ - detEl = m_muonMgr->getTgcReadoutElement( id ) ; + detEl = MuonDetMgr->getTgcReadoutElement( id ) ; if ( m_manuallyFindPRDs) prd = tgcClusterLink(id, rioOnTrack.idDE()); if ( m_fixTGCs && !rioOnTrack.prepRawData() ) { // Okay, so we might have hit the nasty issue that the TGC EL is broken in some samples @@ -121,13 +116,13 @@ std::pair<const Trk::TrkDetElementBase*, const Trk::PrepRawData*> el.resetWithKeyAndIndex(m_tgcPrdKey.key(), el.index()); } }else if(m_idHelperSvc->isMdt(id)){ - detEl = m_muonMgr->getMdtReadoutElement( id ) ; + detEl = MuonDetMgr->getMdtReadoutElement( id ) ; if (m_manuallyFindPRDs) prd = mdtDriftCircleLink(id, rioOnTrack.idDE()); } else if(m_idHelperSvc->isMM(id)){ - detEl = m_muonMgr->getMMReadoutElement( id ) ; + detEl = MuonDetMgr->getMMReadoutElement( id ) ; if (m_manuallyFindPRDs) prd = mmClusterLink(id, rioOnTrack.idDE()); } else if(m_idHelperSvc->issTgc(id)){ - detEl = m_muonMgr->getsTgcReadoutElement( id ) ; + detEl = MuonDetMgr->getsTgcReadoutElement( id ) ; if (m_manuallyFindPRDs) prd = stgcClusterLink(id, rioOnTrack.idDE()); }else{ ATH_MSG_WARNING( "Unknown type of Muon detector from identifier :"<< id); @@ -193,21 +188,28 @@ Muon::MuonEventCnvTool::getDetectorElement(const Identifier& id) const { const Trk::TrkDetElementBase* detEl = 0; - if ( m_muonMgr!=0 ) + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return detEl; + } + + if ( MuonDetMgr!=0 ) { //TODO Check that these are in the most likely ordering, for speed. EJWM. if (m_idHelperSvc->isRpc(id)) { - detEl = m_muonMgr->getRpcReadoutElement( id ) ; + detEl = MuonDetMgr->getRpcReadoutElement( id ) ; }else if(m_idHelperSvc->isCsc(id)){ - detEl = m_muonMgr->getCscReadoutElement( id ) ; + detEl = MuonDetMgr->getCscReadoutElement( id ) ; }else if(m_idHelperSvc->isTgc(id)){ - detEl = m_muonMgr->getTgcReadoutElement( id ) ; + detEl = MuonDetMgr->getTgcReadoutElement( id ) ; }else if(m_idHelperSvc->isMdt(id)) { - detEl = m_muonMgr->getMdtReadoutElement( id ) ; + detEl = MuonDetMgr->getMdtReadoutElement( id ) ; }else if(m_idHelperSvc->issTgc(id)){ - detEl = m_muonMgr->getsTgcReadoutElement( id ) ; + detEl = MuonDetMgr->getsTgcReadoutElement( id ) ; }else if(m_idHelperSvc->isMM(id)){ - detEl = m_muonMgr->getMMReadoutElement( id ) ; + detEl = MuonDetMgr->getMMReadoutElement( id ) ; } } diff --git a/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.h b/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.h index a0dec367c8e0d89f40dfbe6d060cca3e04c43dd0..8d9b958830b4b6d207d2969794ee7986c049a4a5 100755 --- a/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.h +++ b/MuonSpectrometer/MuonCnv/MuonEventCnvTools/src/MuonEventCnvTool.h @@ -16,16 +16,13 @@ #include "MuonPrepRawData/sTgcPrepDataContainer.h" #include "GaudiKernel/ServiceHandle.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include <string> class Identifier; class IdentifierHash; -namespace MuonGM { - class MuonDetectorManager; -} - namespace Trk { class RIO_OnTrack; class PrepRawData; @@ -74,7 +71,9 @@ namespace Muon { private: - const MuonGM::MuonDetectorManager* m_muonMgr; //!<Muon detector manager + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h index 1d56e516be3d3bef1c5bbf1c509653132e598541..efe2a51ff65093b528ab0fbc970d2d3263df65b6 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/MuonJiveXML/TrigRpcDataRetriever.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef JIVEXML_TRIGRPCDATARETRIEVER_H @@ -57,7 +57,9 @@ namespace JiveXML { ToolHandle<Muon::IRPC_RDO_Decoder> m_rpcDecoder; ///Geo Model - const MuonGM::MuonDetectorManager* m_muonMgr; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; }; } diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CSCClusterRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CSCClusterRetriever.cxx index 6f0c6468f1816d40e01a987df95602efcd246f8a..689c260f966a3d7512f98f35c6ddf94ef8e41fe8 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CSCClusterRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CSCClusterRetriever.cxx @@ -1,11 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "MuonJiveXML/CSCClusterRetriever.h" #include "MuonJiveXML/MuonFullIDHelper.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/CscIdHelper.h" namespace JiveXML { @@ -28,22 +27,12 @@ namespace JiveXML { declareProperty("StoreGateKey", m_sgKey = "CSC_Clusters", "Name of the CSC_ClusterCollection"); } - /** - * Initialize before event loop - * - get the MuonDetectorManager - */ + StatusCode CSCClusterRetriever::initialize(){ //be verbose if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initializing retriever for " << dataTypeName() << endmsg; - //Retrieve the CSC ID helper - const MuonGM::MuonDetectorManager* muon_mgr; - if ( detStore()->retrieve(muon_mgr).isFailure()){ - if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Could not retrieve MuonDetectorManager!" << endmsg; - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx index 85df8ab99f64f9c89a04b4f956b27364fc3431b4..75c8a2e4ddc48d1d3b5bb7b246d6b04d722cde20 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "MuonJiveXML/TrigRpcDataRetriever.h" @@ -67,12 +67,7 @@ namespace JiveXML { } else msg(MSG::INFO) << "Retrieved Tool " << m_rpcDecoder << endmsg; - // retrieve the muon detector manager - sc = detStore()->retrieve(m_muonMgr); - if (sc.isFailure()) { - if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Can't retrieve the muon detector manager" << endmsg; - return StatusCode::FAILURE; - } + ATH_CHECK(m_DetectorManagerKey.initialize()); return StatusCode::SUCCESS; } @@ -127,6 +122,14 @@ namespace JiveXML { double time = 0. ; double time1 = 0. ; + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + + //loop on pad const DataHandle<RpcPad> itColl(firstRdoColl); for (; itColl!=lastRdoColl; ++itColl){ @@ -190,7 +193,7 @@ namespace JiveXML { Identifier stripOfflineId = *it_list; if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " cablingId " << m_muonIdHelperTool->rpcIdHelper().show_to_string(stripOfflineId)<< endmsg; - const MuonGM::RpcReadoutElement* element = m_muonMgr->getRpcReadoutElement(stripOfflineId); + const MuonGM::RpcReadoutElement* element = MuonDetMgr->getRpcReadoutElement(stripOfflineId); char ChID[100]; snprintf(ChID, 100, "SL%d-Pad%d-CM%d-ijk%d-ch%d-time%d",sectorId,padId,cmaId, rpcChan->ijk(),rpcChan->channel(),8*rpcChan->bcid()+rpcChan->time()); @@ -241,7 +244,7 @@ namespace JiveXML { Identifier stripOfflineId1 = *it_list1; if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " cablingId1 " << m_muonIdHelperTool->rpcIdHelper().show_to_string(stripOfflineId1)<< endmsg; - const MuonGM::RpcReadoutElement* element1 = m_muonMgr->getRpcReadoutElement(stripOfflineId1); + const MuonGM::RpcReadoutElement* element1 = MuonDetMgr->getRpcReadoutElement(stripOfflineId1); char ChID1[100]; snprintf(ChID1,100, "SL%d-Pad%d-CM%d-ijk%d-ch%d-time%d",sectorId,padId,cmaId, diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.h index 0a6d3f1dad997ef4f11e83f181b0fd896c60ba8a..6a692cbbf7cfff34aa3970b076e42d4f0ce502ec 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.h @@ -2,50 +2,50 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOL_H -#define MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOL_H - -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" +#ifndef MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOL_H +#define MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOL_H + +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" #include "MDT_RawDataProviderToolCore.h" -#include <vector> -#include <string> +#include <vector> +#include <string> #include "MuonRDO/MdtCsm_Cache.h" -namespace Muon -{ - -/** @class MDT_RawDataProviderTool - @author Edward Moyse <Edward.Moyse@cern.ch> +namespace Muon +{ + +/** @class MDT_RawDataProviderTool + @author Edward Moyse <Edward.Moyse@cern.ch> @author Mark Owen <markowen@cern.ch> -*/ - -class MDT_RawDataProviderTool : virtual public IMuonRawDataProviderTool, public MDT_RawDataProviderToolCore -{ - public: - MDT_RawDataProviderTool(const std::string&,const std::string&,const IInterface*); - - /** default destructor */ - virtual ~MDT_RawDataProviderTool (); - - /** standard Athena-Algorithm method */ - virtual StatusCode initialize(); - - /** standard Athena-Algorithm method */ - virtual StatusCode finalize (); - - /** Convert method - declared in Muon::IMuonRdoToPrepDataTool*/ - virtual StatusCode convert( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs); - virtual StatusCode convert( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs, const std::vector<IdentifierHash>&); - /** the new ones */ - virtual StatusCode convert(); //!< for the entire event - virtual StatusCode convert(const std::vector<IdentifierHash>& HashVec); - virtual StatusCode convert(const std::vector<uint32_t>& robIds);//!< for a particular vector of ROBId's - - -}; -} - -#endif +*/ + +class MDT_RawDataProviderTool : virtual public IMuonRawDataProviderTool, public MDT_RawDataProviderToolCore +{ + public: + MDT_RawDataProviderTool(const std::string&,const std::string&,const IInterface*); + + /** default destructor */ + virtual ~MDT_RawDataProviderTool (); + + /** standard Athena-Algorithm method */ + virtual StatusCode initialize(); + + /** standard Athena-Algorithm method */ + virtual StatusCode finalize (); + + /** Convert method - declared in Muon::IMuonRdoToPrepDataTool*/ + virtual StatusCode convert( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs); + virtual StatusCode convert( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs, const std::vector<IdentifierHash>&); + /** the new ones */ + virtual StatusCode convert(); //!< for the entire event + virtual StatusCode convert(const std::vector<IdentifierHash>& HashVec); + virtual StatusCode convert(const std::vector<uint32_t>& robIds);//!< for a particular vector of ROBId's + + +}; +} + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolCore.cxx index 5432a5f58ae57ce3029d121895bfedbef9f9a152..cc29a4b90f66cfdd2bf7beb1b6ebd304d724e663 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolCore.cxx @@ -4,7 +4,6 @@ #include "MDT_RawDataProviderToolCore.h" #include "MuonRDO/MdtCsmContainer.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "GaudiKernel/IJobOptionsSvc.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" @@ -16,7 +15,6 @@ Muon::MDT_RawDataProviderToolCore::MDT_RawDataProviderToolCore(const std::string : AthAlgTool(t,n,p), m_decoder("MdtROD_Decoder/MdtROD_Decoder", this), - m_muonMgr(0), m_robDataProvider ("ROBDataProviderSvc",n) { // template for property declaration @@ -29,7 +27,7 @@ Muon::MDT_RawDataProviderToolCore::~MDT_RawDataProviderToolCore() StatusCode Muon::MDT_RawDataProviderToolCore::initialize() { - ATH_MSG_VERBOSE("Starting init"); + ATH_MSG_VERBOSE("Starting init"); ATH_MSG_VERBOSE("Getting m_robDataProvider"); @@ -40,15 +38,9 @@ StatusCode Muon::MDT_RawDataProviderToolCore::initialize() } else ATH_MSG_INFO("Retrieved service " << m_robDataProvider); - ATH_MSG_VERBOSE("Getting MuonDetectorManager"); + ATH_CHECK(m_idHelperSvc.retrieve()); - if (detStore()->retrieve(m_muonMgr).isFailure()) - { - ATH_MSG_ERROR("Cannot retrieve MuonDetectorManager"); - return StatusCode::FAILURE; - } - - ATH_MSG_VERBOSE("Getting m_decoder"); + ATH_MSG_VERBOSE("Getting m_decoder"); // Retrieve decoder if (m_decoder.retrieve().isFailure()) { @@ -58,8 +50,8 @@ StatusCode Muon::MDT_RawDataProviderToolCore::initialize() ATH_MSG_INFO("Retrieved tool " << m_decoder); - m_maxhashtoUse = m_muonMgr->mdtIdHelper()->stationNameIndex("BME") != -1 ? - m_muonMgr->mdtIdHelper()->detectorElement_hash_max() : m_muonMgr->mdtIdHelper()->module_hash_max(); + m_maxhashtoUse = m_idHelperSvc->mdtIdHelper().stationNameIndex("BME") != -1 ? + m_idHelperSvc->mdtIdHelper().detectorElement_hash_max() : m_idHelperSvc->mdtIdHelper().module_hash_max(); ATH_CHECK( m_rdoContainerKey.initialize() ); ATH_CHECK( m_readKey.initialize() ); diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolCore.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolCore.h index 22a5806be4db348ed9f5482f95df0a01dc9dc43c..341a53779ec6febe4079366a439d46e025a692b3 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolCore.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolCore.h @@ -2,70 +2,70 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOLCORE_H -#define MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOLCORE_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "ByteStreamData/RawEvent.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include "MdtROD_Decoder.h" -#include <vector> -#include <set> -#include <string> +#ifndef MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOLCORE_H +#define MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOLCORE_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "ByteStreamData/RawEvent.h" +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MdtROD_Decoder.h" +#include <vector> +#include <set> +#include <string> + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonCablingData/MuonMDT_CablingMap.h" #include "StoreGate/ReadCondHandleKey.h" #include "MuonRDO/MdtCsm_Cache.h" - -class MdtCsmContainer; -class IROBDataProviderSvc; - -namespace MuonGM { - class MuonDetectorManager; -} - -namespace Muon -{ - -/** @class MDT_RawDataProviderToolCore - @author Edward Moyse <Edward.Moyse@cern.ch> + +class MdtCsmContainer; +class IROBDataProviderSvc; + +namespace Muon +{ + +/** @class MDT_RawDataProviderToolCore + @author Edward Moyse <Edward.Moyse@cern.ch> @author Mark Owen <markowen@cern.ch> -*/ - -class MDT_RawDataProviderToolCore : public AthAlgTool -{ - public: - MDT_RawDataProviderToolCore(const std::string&,const std::string&,const IInterface*); - - /** default destructor */ - virtual ~MDT_RawDataProviderToolCore (); - - /** standard Athena-Algorithm method */ - virtual StatusCode initialize(); - - /** standard Athena-Algorithm method */ - virtual StatusCode finalize (); - +*/ + +class MDT_RawDataProviderToolCore : public AthAlgTool +{ + public: + MDT_RawDataProviderToolCore(const std::string&,const std::string&,const IInterface*); + + /** default destructor */ + virtual ~MDT_RawDataProviderToolCore (); + + /** standard Athena-Algorithm method */ + virtual StatusCode initialize(); + + /** standard Athena-Algorithm method */ + virtual StatusCode finalize (); + /** Convert method */ - virtual StatusCode convertIntoContainer( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs, MdtCsmContainer& mdtContainer); + virtual StatusCode convertIntoContainer( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs, MdtCsmContainer& mdtContainer); - protected: + protected: - ToolHandle<MdtROD_Decoder> m_decoder; + ToolHandle<MdtROD_Decoder> m_decoder; SG::WriteHandleKey<MdtCsmContainer> m_rdoContainerKey{ - this, "RdoLocation", "MDTCSM", "Name of the MDTCSM produced by RawDataProvider"}; - const MuonGM::MuonDetectorManager* m_muonMgr; - unsigned int m_maxhashtoUse; + this, "RdoLocation", "MDTCSM", "Name of the MDTCSM produced by RawDataProvider"}; + + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + + unsigned int m_maxhashtoUse; - // Rob Data Provider handle - ServiceHandle<IROBDataProviderSvc> m_robDataProvider; + // Rob Data Provider handle + ServiceHandle<IROBDataProviderSvc> m_robDataProvider; SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; - -}; -} - -#endif + +}; +} + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolMT.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolMT.h index 014af14709f5194acf2c1df433667680ffeb272c..baea3aec274b2c6048e0326fa85849225a6a025e 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderToolMT.h @@ -2,54 +2,54 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOLMT_H -#define MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOLMT_H - -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" +#ifndef MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOLMT_H +#define MUONMDTCNVTOOLS_MUONMDTRAWDATAPROVIDERTOOLMT_H + +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" #include "MDT_RawDataProviderToolCore.h" -#include <vector> -#include <string> +#include <vector> +#include <string> #include "MuonRDO/MdtCsm_Cache.h" -namespace Muon -{ - -/** @class MDT_RawDataProviderToolMT +namespace Muon +{ + +/** @class MDT_RawDataProviderToolMT @author Mark Owen <markowen@cern.ch> -*/ - -class MDT_RawDataProviderToolMT : virtual public IMuonRawDataProviderTool, public MDT_RawDataProviderToolCore -{ - public: - MDT_RawDataProviderToolMT(const std::string&,const std::string&,const IInterface*); - - /** default destructor */ +*/ + +class MDT_RawDataProviderToolMT : virtual public IMuonRawDataProviderTool, public MDT_RawDataProviderToolCore +{ + public: + MDT_RawDataProviderToolMT(const std::string&,const std::string&,const IInterface*); + + /** default destructor */ virtual ~MDT_RawDataProviderToolMT () { } - - /** standard Athena-Algorithm method */ - virtual StatusCode initialize(); - - /** standard Athena-Algorithm method */ - virtual StatusCode finalize (); - - /** Convert method - declared in Muon::IMuonRdoToPrepDataTool*/ - virtual StatusCode convert( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs); - virtual StatusCode convert( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs, const std::vector<IdentifierHash>&); - /** the new ones */ - virtual StatusCode convert(); //!< for the entire event - virtual StatusCode convert(const std::vector<IdentifierHash>& HashVec); - virtual StatusCode convert(const std::vector<uint32_t>& robIds);//!< for a particular vector of ROBId's - - private: + + /** standard Athena-Algorithm method */ + virtual StatusCode initialize(); + + /** standard Athena-Algorithm method */ + virtual StatusCode finalize (); + + /** Convert method - declared in Muon::IMuonRdoToPrepDataTool*/ + virtual StatusCode convert( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs); + virtual StatusCode convert( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs, const std::vector<IdentifierHash>&); + /** the new ones */ + virtual StatusCode convert(); //!< for the entire event + virtual StatusCode convert(const std::vector<IdentifierHash>& HashVec); + virtual StatusCode convert(const std::vector<uint32_t>& robIds);//!< for a particular vector of ROBId's + + private: /// This is the key for the cache for the CSM containers, can be empty SG::UpdateHandleKey<MdtCsm_Cache> m_rdoContainerCacheKey ; - -}; -} - -#endif + +}; +} + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx index e878e3db3a35b17b41c66840a13e9eac2411e64c..ffb04572e13e8c1e33d8a26cefd3e67333c103a7 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx @@ -8,7 +8,6 @@ #include "MdtRdoToPrepDataTool.h" - Muon::MdtRdoToPrepDataTool::MdtRdoToPrepDataTool(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), @@ -57,4 +56,4 @@ Muon::MdtRdoToPrepDataTool::SetupMdtPrepDataContainerStatus Muon::MdtRdoToPrepDa m_mdtPrepDataContainer = const_cast<Muon::MdtPrepDataContainer*> (outputCollection_c); } return ALREADYCONTAINED; -} \ No newline at end of file +} diff --git a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataTool.h b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataTool.h index 3f629a001033c130c4e239dbe5b72133b1626832..c4e4d1a705e54b8cb6cd92b32e198f2e7f101b98 100644 --- a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataTool.h +++ b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataTool.h @@ -31,7 +31,6 @@ class MM_RawDataCollection; namespace MuonGM { - class MuonDetectorManager; class MMReadoutElement; } diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h index fc422a94e1f17206a9c2789fb6ba2714350f5484..7e361ec459b371ef32d2de7027336be6a29557df 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h +++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonIdCutTool.h @@ -21,11 +21,6 @@ class MsgStream; class MuonStationIntersectSvc; -namespace MuonGM { - class MuonDetectorManager; -} - - /** Implementation of an IMuonIdCutTool. diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonPrdSelectorAlg.h b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonPrdSelectorAlg.h index a955c1e6cd21f114833b5f68dd576dcd43d83318..ad897947614a3a1a851e84ddd801432a16a1f632 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonPrdSelectorAlg.h +++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/MuonPrdSelector/MuonPrdSelectorAlg.h @@ -39,10 +39,6 @@ */ -namespace MuonGM { - class MuonDetectorManager; -} - class MuonPrdSelectorAlg : public AthAlgorithm { public: MuonPrdSelectorAlg(const std::string &name,ISvcLocator *pSvcLocator); //!< Athena algorithm constructor diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx index 57596020b1a9fd5dc0e78ff647b345a97787113b..910b3b6b9bb6e1e59465b038b7cca7a5b42e284d 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonIdCutTool.cxx @@ -7,7 +7,6 @@ #include "MuonIdHelpers/RpcIdHelper.h" #include "MuonIdHelpers/CscIdHelper.h" #include "MuonIdHelpers/TgcIdHelper.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonCalibTools/IdToFixedIdTool.h" #include "MuonCalibIdentifier/MuonFixedId.h" diff --git a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx index fa98d528ccaa7a96c08ff9e8bbe0eead999cfbbe..08b95ee3a900a04e93f7151f442cba9e47678b47 100644 --- a/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx +++ b/MuonSpectrometer/MuonCnv/MuonPrdSelector/src/MuonPrdSelectorAlg.cxx @@ -13,7 +13,6 @@ #include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/MsgStream.h" #include "StoreGate/StoreGate.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "Identifier/IdentifierHash.h" #include "Identifier/Identifier.h" #include <iomanip> diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx index 050d06eefc98ec718a8ac4e5c00384bd4d7c19d3..85d26e13aabf7224f31719b4ac172d3674683bae 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderTool.cxx @@ -4,7 +4,6 @@ #include "RPC_RawDataProviderTool.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" #include "GaudiKernel/ServiceHandle.h" diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderToolMT.cxx index 983badd9b143bfb4e1c00bfd5a52fdaf21494168..bcf3568f3c4d5169c1c64309e139f1d63edf319c 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RPC_RawDataProviderToolMT.cxx @@ -4,7 +4,6 @@ #include "RPC_RawDataProviderToolMT.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" #include "GaudiKernel/ServiceHandle.h" diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx index 1c6f15b0e9a588f918edb659a05da67363745996..f380b7edcff561ca8c4df2cdd8047c229c4d0812 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.cxx @@ -12,7 +12,6 @@ #include "RPCcablingInterface/IRPCcablingSvc.h" #include "MuonIdHelpers/RpcIdHelper.h" #include "MuonDigitContainer/RpcDigit.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonRDO/RpcFiredChannel.h" @@ -34,35 +33,27 @@ StatusCode Muon::RpcRDO_Decoder::initialize() ATH_MSG_DEBUG ( "initialize"); ATH_CHECK( m_muonIdHelperTool.retrieve() ); - - // Get MuonDetectorManager - if (detStore()->retrieve( m_muonMgr ).isFailure()) - { - msg(MSG::ERROR) << "Can't retrieve MuonGM::MuonDetectorManager" - << endmsg; - } - else msg(MSG::DEBUG) << "Found MuonGM::MuonDetectorManager "<<endmsg; - // get RPC cablingSvc - const IRPCcablingServerSvc* RpcCabGet = 0; - StatusCode sc = service("RPCcablingServerSvc", RpcCabGet); - if (sc.isFailure()) { - msg (MSG::FATAL) << "Could not get RPCcablingServerSvc !" << endmsg; - return StatusCode::FAILURE; - } - else msg (MSG::VERBOSE) << " RPCcablingServerSvc retrieved" << endmsg; + // get RPC cablingSvc + const IRPCcablingServerSvc* RpcCabGet = 0; + StatusCode sc = service("RPCcablingServerSvc", RpcCabGet); + if (sc.isFailure()) { + msg (MSG::FATAL) << "Could not get RPCcablingServerSvc !" << endmsg; + return StatusCode::FAILURE; + } + else msg (MSG::VERBOSE) << " RPCcablingServerSvc retrieved" << endmsg; + + sc = RpcCabGet->giveCabling(m_cablingSvc); + if (sc.isFailure()) { + msg (MSG::FATAL) << "Could not get RPCcablingSvc from the Server !" << endmsg; + m_cablingSvc = 0; + return StatusCode::FAILURE; + } + else { + msg (MSG::VERBOSE) << " RPCcablingSvc obtained " << endmsg; + } - sc = RpcCabGet->giveCabling(m_cablingSvc); - if (sc.isFailure()) { - msg (MSG::FATAL) << "Could not get RPCcablingSvc from the Server !" << endmsg; - m_cablingSvc = 0; - return StatusCode::FAILURE; - } - else { - msg (MSG::VERBOSE) << " RPCcablingSvc obtained " << endmsg; - } - - return sc; + return sc; } diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h index b40d8bbd504b6ebb17c60ad3ab677674aa287ecc..07fac96f0e4d278681ab53d873a2a30b96123fd8 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRDO_Decoder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONBYTESTREAMRPCRDODECODER_H @@ -47,8 +47,6 @@ class RpcRDO_Decoder : virtual public IRPC_RDO_Decoder, public AthAlgTool private: - const MuonGM::MuonDetectorManager* m_muonMgr; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/STGC_RawDataProviderTool.cxx b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/STGC_RawDataProviderTool.cxx index d7729099ac8c2d7b0daff64bb51481c193b6f6cb..4f84874e090821707ef7130e9dd22b30d5a4215d 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/STGC_RawDataProviderTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/STGC_RawDataProviderTool.cxx @@ -17,8 +17,7 @@ Muon::STGC_RawDataProviderTool::STGC_RawDataProviderTool( const std::string& t, const std::string& n, const IInterface* p) : - AthAlgTool(t, n, p), - m_muonMgr(0) + AthAlgTool(t, n, p) { declareInterface<IMuonRawDataProviderTool>(this); } @@ -34,10 +33,6 @@ StatusCode Muon::STGC_RawDataProviderTool::initialize() { StatusCode sc = AthAlgTool::initialize(); - if(detStore()->retrieve(m_muonMgr).isFailure()) { - ATH_MSG_WARNING( "Cannot retrieve MuonDetectorManager" ); - return StatusCode::SUCCESS; - } return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/STGC_RawDataProviderTool.h b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/STGC_RawDataProviderTool.h index 9ad880a7782e550ecac784ab3fdf76ec61a0c8a2..94a722846fd99dddef4fb9775dd4a589b57a4ca6 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/STGC_RawDataProviderTool.h +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/STGC_RawDataProviderTool.h @@ -14,11 +14,6 @@ class ActiveStoreSvc; class IROBDataProviderSvc; class ITGCcablingSvc; -namespace MuonGM -{ - class MuonDetectorManager; -} - namespace Muon { class ISTGC_RodDecoder; @@ -51,8 +46,6 @@ namespace Muon virtual StatusCode convert(const std::vector<IdentifierHash>& rdoIdhVect) override; private: - /** MuonDectorManager is used to get tgcIdHelper */ - const MuonGM::MuonDetectorManager* m_muonMgr; }; } // end of namespace diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.h b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.h index 9ae3908fd45912c634f3d615594aad65d0833257..1d6501bb2c817cb373ab9b924e409f9f08d0d278 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.h +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataTool.h @@ -26,7 +26,6 @@ class ITGCcablingSvc; namespace MuonGM { - class MuonDetectorManager; class TgcReadoutElement; } diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx index 959ac6bef172f11f132cb392d718928881df1539..9d2c3cc9d06e3f6be65b79ccefcd6a4987aa540e 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderTool.cxx @@ -9,7 +9,6 @@ #include "TGC_RawDataProviderTool.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonRDO/TgcRdoContainer.h" //================ Constructor ================================================= diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.cxx index 6b088497b3361198648d9dead6c54eb36225e176..9d1445444c2a0ef447c757a3286e35be4caa77a0 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.cxx @@ -11,8 +11,6 @@ #include "MuonTGC_CnvTools/ITGC_RodDecoder.h" #include "MuonRDO/TgcRdoContainer.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - #include "TGCcablingInterface/ITGCcablingServerSvc.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" @@ -26,7 +24,6 @@ Muon::TGC_RawDataProviderToolCore::TGC_RawDataProviderToolCore( const std::string& n, const IInterface* p) : AthAlgTool(t, n, p), - m_muonMgr(0), m_decoder("Muon::TGC_RodDecoderReadout/TGC_RodDecoderReadout", this), m_cabling(0), m_robDataProvider("ROBDataProviderSvc",n) @@ -47,10 +44,7 @@ StatusCode Muon::TGC_RawDataProviderToolCore::initialize() if(sc.isFailure()) return sc; - if(detStore()->retrieve(m_muonMgr).isFailure()) { - ATH_MSG_WARNING( "Cannot retrieve MuonDetectorManager" ); - return StatusCode::SUCCESS; - } + ATH_CHECK(m_idHelperSvc.retrieve()); if(m_decoder.retrieve().isFailure()) { ATH_MSG_FATAL( "Failed to retrieve tool " << m_decoder ); @@ -67,7 +61,7 @@ StatusCode Muon::TGC_RawDataProviderToolCore::initialize() ATH_MSG_INFO( "Retrieved service " << m_robDataProvider ); } - m_maxhashtoUse = m_muonMgr->tgcIdHelper()->module_hash_max(); + m_maxhashtoUse = m_idHelperSvc->tgcIdHelper().module_hash_max(); ATH_CHECK(m_rdoContainerKey.initialize()); @@ -146,15 +140,14 @@ std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> Muon::TGC_RawDataPr } } - const TgcIdHelper* idHelper = m_muonMgr->tgcIdHelper(); - IdContext tgcContext = idHelper->module_context(); + IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context(); std::vector<uint32_t> robIds; unsigned int size = rdoIdhVect.size(); for(unsigned int i=0; i<size; ++i) { Identifier Id; - if(idHelper->get_id(rdoIdhVect[i], Id, &tgcContext)) { + if(m_idHelperSvc->tgcIdHelper().get_id(rdoIdhVect[i], Id, &tgcContext)) { ATH_MSG_WARNING( "Unable to get TGC Identifier from collection hash id " ); continue; } diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.h index d5f6b2cb2806ef2222244ed2d1d8339228c4337f..d9012911b507810fec7f2cc1376952b430f09fea 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolCore.h @@ -14,16 +14,13 @@ #include "TGC_Hid2RESrcID.h" #include "ByteStreamData/RawEvent.h" #include "Identifier/IdentifierHash.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class TgcRdoContainer; class IROBDataProviderSvc; class ITGCcablingSvc; -namespace MuonGM -{ - class MuonDetectorManager; -} - namespace Muon { class ITGC_RodDecoder; @@ -56,8 +53,8 @@ namespace Muon /** Function to get the ROB data from a vector of IdentifierHash **/ std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> getROBData(const std::vector<IdentifierHash>& rdoIdhVect); - /** MuonDectorManager is used to get tgcIdHelper */ - const MuonGM::MuonDetectorManager* m_muonMgr; + /** Get tgcIdHelper */ + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /** Decoder for ROB fragment RDO conversion */ ToolHandle<ITGC_RodDecoder> m_decoder; /** RDO container key */ diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.cxx index b3e2927f692d06b54c6a6af6ad0debcb38e68938..47d00f730063472c435fd7f4565e3e80e8d65366 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RawDataProviderToolMT.cxx @@ -9,7 +9,6 @@ #include "TGC_RawDataProviderToolMT.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonRDO/TgcRdoContainer.h" //================ Constructor ================================================= diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx index c7733e2535b7558f494df575fc52c79a27f42f24..b9bb337e2bac11886529835c39d997c978941d0d 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx @@ -8,7 +8,6 @@ #include "TgcPrepDataReplicationTool.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonCnvToolInterfaces/IDC_Helper.h" #include "MuonDigitContainer/TgcDigit.h" diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h index a108e0a44c3ab06e6288b080eba8889fd03cf587..4b8196fa1adaa4c3ff0a52a0824bd7c1a2a6fc3f 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h @@ -13,11 +13,6 @@ #include "MuonPrepRawData/TgcPrepDataContainer.h" #include "MuonIdHelpers/MuonIdHelperTool.h" -namespace MuonGM -{ - class MuonDetectorManager; -} - namespace Muon { class TgcPrepDataReplicationTool diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx index a476c5a53859b2ab216f8136d178175be2a7eb2a..20b26f56285ddebbf8115baf31a71a24416b113f 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx @@ -8,7 +8,6 @@ #include "TgcPrepDataReplicationTool3BCtoAllBC.h" #include "TgcPrepDataReplicationToolAllBCto3BC.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonCnvToolInterfaces/IDC_Helper.h" #include "MuonDigitContainer/TgcDigit.h" diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h index 58e80da95ac890be3cc85822e8bfe2669a7cdc5c..e93f5990125a26332d629d88219fc418ab86db46 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h @@ -14,11 +14,6 @@ #include "GaudiKernel/ToolHandle.h" #include "MuonIdHelpers/MuonIdHelperTool.h" -namespace MuonGM -{ - class MuonDetectorManager; -} - namespace Muon { class TgcPrepDataReplicationTool3BCtoAllBC diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx index 0caf82b29ed6b40281539174b39a85e6fcdb7768..5199e30dfc8d62745600a1bb4f6e810b075be9c3 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx @@ -8,7 +8,6 @@ #include "TgcPrepDataReplicationToolAllBCto3BC.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonCnvToolInterfaces/IDC_Helper.h" #include "MuonDigitContainer/TgcDigit.h" diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h index c06e183d15b0b6931b59d48edcdff0bd2ec13f40..28a54c966713480bef57443eba0fe4dbb8f6e8b4 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h @@ -14,11 +14,6 @@ #include "MuonPrepRawData/TgcPrepDataContainer.h" #include "MuonIdHelpers/MuonIdHelperTool.h" -namespace MuonGM -{ - class MuonDetectorManager; -} - namespace Muon { class TgcPrepDataReplicationToolAllBCto3BC diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h index 122c6ae8d3967dde94e75a74825a939b1be19179..d005d9e78afb1cdf1b75dcf099e342c0e856d679 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h @@ -10,7 +10,6 @@ #include "TgcRdoToPrepDataToolCore.h" - namespace Muon { /** @class TgcRdoToPrepDataTool diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/CMakeLists.txt b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/CMakeLists.txt index 39dd4e7db68f37f27cf086a6370a904fb2795139..648d56904d0b181ada670f7597b48019212501ad 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/CMakeLists.txt +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/CMakeLists.txt @@ -16,13 +16,14 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/Identifier ) # External dependencies: +find_package( Eigen ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( MuonCondTest src/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel MuonCondInterface MuonCondSvcLib MuonReadoutGeometry Identifier ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel MuonCondInterface MuonCondSvcLib MuonReadoutGeometry Identifier ) # Install files from the package: atlas_install_headers( MuonCondTest ) diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/AlignCondAthTest.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/AlignCondAthTest.h index b4d7cf51143146d3ba6d3771f83c27f40b6beaf0..36c796890e20d0f86552e0d336ae55cf426863b5 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/AlignCondAthTest.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/AlignCondAthTest.h @@ -9,22 +9,44 @@ #include "GaudiKernel/Algorithm.h" #include "AthenaBaseComps/AthAlgorithm.h" -///////////////////////////////////////////////////////////////////////////// +#include "StoreGate/ReadCondHandleKey.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + +#include <fstream> + +namespace MuonGM +{ + class MuonDetectorManager; + class MdtReadoutElement; +} class AlignCondAthTest:public AthAlgorithm { public: AlignCondAthTest (const std::string& name, ISvcLocator* pSvcLocator); public: -/////////////////////////////////// StatusCode initialize(); StatusCode execute(); StatusCode finalize(); private: -/////////////////////////////////// + const MuonGM::MuonDetectorManager* m_MuonDetMgrDS; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + + + StatusCode checkMdtGeometry(const MuonGM::MuonDetectorManager* manager, std::ofstream* fout); + StatusCode checkRpcGeometry(const MuonGM::MuonDetectorManager* manager, std::ofstream* fout); + StatusCode checkTgcGeometry(const MuonGM::MuonDetectorManager* manager, std::ofstream* fout); + StatusCode checkCscGeometry(const MuonGM::MuonDetectorManager* manager, std::ofstream* fout); + }; #endif diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/AlignCondAthTest.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/AlignCondAthTest.cxx index 97b4c546ae5b3df0874d8c4c4b1cc6134467d839..1b84f3e9653b21811d86bfbcc9596e897bc39b98 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/AlignCondAthTest.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/AlignCondAthTest.cxx @@ -3,8 +3,15 @@ */ -///////////////////////////////////////////////////////// #include "MuonCondTest/AlignCondAthTest.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "MuonReadoutGeometry/MdtReadoutElement.h" +#include "MuonReadoutGeometry/RpcReadoutElement.h" +#include "MuonReadoutGeometry/TgcReadoutElement.h" +#include "MuonReadoutGeometry/CscReadoutElement.h" +#include "Identifier/IdentifierHash.h" +#include "Identifier/Identifier.h" +#include "GeoPrimitives/GeoPrimitivesToStringConverter.h" AlignCondAthTest::AlignCondAthTest(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator){ @@ -14,8 +21,17 @@ StatusCode AlignCondAthTest::initialize(){ // ATH_MSG_INFO( "in initialize()" ); + if (StatusCode::SUCCESS != detStore()->retrieve(m_MuonDetMgrDS)) { + ATH_MSG_FATAL("Couldn't load MuonDetectorManager"); + return StatusCode::FAILURE; + } + + ATH_CHECK(m_idHelperSvc.retrieve()); + + ATH_CHECK(m_DetectorManagerKey.initialize()); + return StatusCode::SUCCESS; -// + } StatusCode AlignCondAthTest::execute() { @@ -23,6 +39,68 @@ StatusCode AlignCondAthTest::execute() { ATH_MSG_INFO( " AlignCondAthTest in execute()" ); + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + + bool MdtPrint = true; + bool RpcPrint = true; + bool TgcPrint = true; + bool CscPrint = true; + + if(MdtPrint) { + std::cout << "************************ BEGIN: MdtReadoutElements from Detector Store **************************" << std::endl; + std::ofstream* foutDS = new std::ofstream("MdtOut_DS.txt"); + if(checkMdtGeometry(m_MuonDetMgrDS, foutDS).isFailure()) return StatusCode::FAILURE; + foutDS->close(); delete foutDS; + std::cout << "************************ END: MdtReadoutElements from Detector Store **************************" << std::endl; + std::cout << "************************ BEGIN: MdtReadoutElements from Conditions Store **************************" << std::endl; + std::ofstream* foutCS = new std::ofstream("MdtOut_CS.txt"); + if(checkMdtGeometry(MuonDetMgr, foutCS).isFailure()) return StatusCode::FAILURE; + foutCS->close(); delete foutCS; + std::cout << "************************ END: MdtReadoutElements from Conditions Store **************************" << std::endl; + } + if(RpcPrint) { + std::cout << "************************ BEGIN: RpcReadoutElements from Detector Store **************************" << std::endl; + std::ofstream* foutDS = new std::ofstream("RpcOut_DS.txt"); + if(checkRpcGeometry(m_MuonDetMgrDS, foutDS).isFailure()) return StatusCode::FAILURE; + foutDS->close(); delete foutDS; + std::cout << "************************ END: RpcReadoutElements from Detector Store **************************" << std::endl; + std::cout << "************************ BEGIN: RpcReadoutElements from Conditions Store **************************" << std::endl; + std::ofstream* foutCS = new std::ofstream("RpcOut_CS.txt"); + if(checkRpcGeometry(MuonDetMgr, foutCS).isFailure()) return StatusCode::FAILURE; + foutCS->close(); delete foutCS; + std::cout << "************************ END: RpcReadoutElements from Conditions Store **************************" << std::endl; + } + if(TgcPrint) { + std::cout << "************************ BEGIN: TgcReadoutElements from Detector Store **************************" << std::endl; + std::ofstream* foutDS = new std::ofstream("TgcOut_DS.txt"); + if(checkTgcGeometry(m_MuonDetMgrDS, foutDS).isFailure()) return StatusCode::FAILURE; + foutDS->close(); delete foutDS; + std::cout << "************************ END: TgcReadoutElements from Detector Store **************************" << std::endl; + std::cout << "************************ BEGIN: TgcReadoutElements from Conditions Store **************************" << std::endl; + std::ofstream* foutCS = new std::ofstream("TgcOut_CS.txt"); + if(checkTgcGeometry(MuonDetMgr, foutCS).isFailure()) return StatusCode::FAILURE; + foutCS->close(); delete foutCS; + std::cout << "************************ END: TgcReadoutElements from Conditions Store **************************" << std::endl; + } + if(CscPrint) { + std::cout << "************************ BEGIN: CscReadoutElements from Detector Store **************************" << std::endl; + std::ofstream* foutDS = new std::ofstream("CscOut_DS.txt"); + if(checkCscGeometry(m_MuonDetMgrDS, foutDS).isFailure()) return StatusCode::FAILURE; + foutDS->close(); delete foutDS; + std::cout << "************************ END: CscReadoutElements from Detector Store **************************" << std::endl; + std::cout << "************************ BEGIN: CscReadoutElements from Conditions Store **************************" << std::endl; + std::ofstream* foutCS = new std::ofstream("CscOut_CS.txt"); + if(checkCscGeometry(MuonDetMgr, foutCS).isFailure()) return StatusCode::FAILURE; + foutCS->close(); delete foutCS; + std::cout << "************************ END: CscReadoutElements from Conditions Store **************************" << std::endl; + } + // if(checkCscGeometry().isFailure()) return StatusCode::FAILURE; + return StatusCode::SUCCESS; // } @@ -35,4 +113,140 @@ StatusCode AlignCondAthTest::finalize() { return StatusCode::SUCCESS; // } - + +StatusCode AlignCondAthTest::checkMdtGeometry(const MuonGM::MuonDetectorManager* manager, std::ofstream* fout) +{ + for( int i1 = 0;i1 < manager->NMdtStatType; ++i1 ){ + for( int i2 = 0;i2 < manager->NMdtStatEta; ++i2 ){ + for( int i3 = 0;i3 < manager->NMdtStatPhi; ++i3 ){ + for( int i4 = 0;i4 < manager->NMdtMultilayer; ++i4 ){ + const MuonGM::MdtReadoutElement* detEl = manager->getMdtReadoutElement(i1,i2,i3,i4); + if( !detEl ) continue; + const std::vector<const Trk::Surface*>& Nsurf = detEl->surfaces(); + (*fout) << " New " << m_idHelperSvc->mdtIdHelper().print_to_string(detEl->identify()) + << " nlayers " << detEl->getNLayers() << " ntubes " << detEl->getNtubesperlayer() << " Nsurf " << Nsurf.size() << std::endl + << Amg::toString( detEl->transform(),6 ) << std::endl; + + for( int tl = 0; tl<detEl->getNLayers();++tl ){ + for( int t = 0; t<detEl->getNtubesperlayer();++t ){ + const Trk::Surface& surf = detEl->surface(tl+1,t+1); + (*fout) << " New tube: layer " << tl << " tube " << t << std::endl + << " X, Y, Z: " << detEl->tubePos(i4+1, tl+1, t+1).x() << ", " << detEl->tubePos(i4+1, tl+1, t+1).y() << ", " << detEl->tubePos(i4+1, tl+1, t+1).z() << std::endl + << " Local X, Y, Z: " << detEl->localTubePos(i4+1, tl+1, t+1).x() << ", " << detEl->localTubePos(i4+1, tl+1, t+1).y() << ", " << detEl->localTubePos(i4+1, tl+1, t+1).z() << std::endl + << " Cent X, Y, Z: " << detEl->center(tl+1, t+1).x() << ", " << detEl->center(tl+1, t+1).y() << ", " << detEl->center(tl+1, t+1).z() << std::endl + << " Norm X, Y, Z: " << detEl->normal(tl+1, t+1).x() << ", " << detEl->normal(tl+1, t+1).y() << ", " << detEl->normal(tl+1, t+1).z() << std::endl + << " TNor X, Y, Z: " << detEl->tubeNormal(tl+1, t+1).x() << ", " << detEl->tubeNormal(tl+1, t+1).y() << ", " << detEl->tubeNormal(tl+1, t+1).z() << std::endl + << Amg::toString( surf.transform(),6 ) + << Amg::toString( detEl->fromIdealToDeformed(i4, tl+1, t+1),6 ) + << detEl->bounds(tl+1, t+1) + << Amg::toString( detEl->transform(tl+1, t+1),6 ) << std::endl; + } + } + } + } + } + } + + return StatusCode::SUCCESS; +} + +StatusCode AlignCondAthTest::checkRpcGeometry(const MuonGM::MuonDetectorManager* manager, std::ofstream* fout) +{ + + for( int i1 = 0;i1<manager->NRpcStatType; ++i1 ){ + for( int i2 = 0;i2<manager->NRpcStatEta; ++i2 ){ + for( int i3 = 0;i3<manager->NRpcStatPhi; ++i3 ){ + for( int i4 = 0;i4<manager->NDoubletR; ++i4 ){ + for( int i5 = 0;i5<manager->NDoubletZ; ++i5 ){ + const MuonGM::RpcReadoutElement* detEl = manager->getRpcReadoutElement(i1,i2,i3,i4,i5); + if( !detEl ) continue; + + Identifier id = detEl->identify(); + const Amg::Vector3D stripPos = detEl->stripPos(id); + const Amg::Vector3D localStripPos = detEl->localStripPos(id); + (*fout) << " New " << m_idHelperSvc->rpcIdHelper().print_to_string(detEl->identify()) + << " NphiStripPanels " << detEl->NphiStripPanels() << std::endl + << " X, Y, Z: " << stripPos.x() << ", " << stripPos.y() << ", " << stripPos.z() << std::endl + << " Local X, Y, Z: " << localStripPos.x() << ", " << localStripPos.y() << ", " << localStripPos.z() << std::endl + << Amg::toString( detEl->transform(),6 ) << std::endl; + + for( int dbPhi=1;dbPhi<=detEl->NphiStripPanels();++dbPhi ){ + for( int gp = 1; gp<=2;++gp ){ + for( int mp = 0; mp<2;++mp ){ + const Trk::Surface& surf = detEl->surface( detEl->surfaceHash(dbPhi,gp,mp) ); + (*fout) << " New layer " << dbPhi << " gp " << gp << " measPhi " << mp << std::endl + << Amg::toString( surf.transform(),6 ) << std::endl; + } + } + } + } + } + } + } + } + + return StatusCode::SUCCESS; +} + +StatusCode AlignCondAthTest::checkTgcGeometry(const MuonGM::MuonDetectorManager* manager, std::ofstream* fout) +{ + + for( int i1 = 0;i1<manager->NTgcStatType; ++i1 ){ + for( int i2 = 0;i2<manager->NTgcStatEta; ++i2 ){ + for( int i3 = 0;i3<manager->NTgcStatPhi; ++i3 ){ + + const MuonGM::TgcReadoutElement* detEl = manager->getTgcReadoutElement(i1,i2,i3); + if( !detEl ) continue; + + Identifier id = detEl->identify(); + const Amg::Vector3D stripPos = detEl->stripPos(id); + const Amg::Vector3D localStripPos = detEl->localStripPos(id); + (*fout) << " New " << m_idHelperSvc->tgcIdHelper().print_to_string(detEl->identify()) << std::endl + << " X, Y, Z: " << stripPos.x() << ", " << stripPos.y() << ", " << stripPos.z() << std::endl + << " Local X, Y, Z: " << localStripPos.x() << ", " << localStripPos.y() << ", " << localStripPos.z() << std::endl + << Amg::toString( detEl->transform(),6 ) << std::endl; + + for( int gp = 0; gp<2;++gp ){ + for( int mp = 0; mp<2;++mp ){ + const Trk::Surface& surf = detEl->surface(2*gp+mp); + (*fout) << " New layer: gp " << gp << " measPhi " << mp << std::endl + << Amg::toString( surf.transform(),6 ) << std::endl; + } + } + } + } + } + + return StatusCode::SUCCESS; +} + +StatusCode AlignCondAthTest::checkCscGeometry(const MuonGM::MuonDetectorManager* manager, std::ofstream* fout) +{ + for( int i1 = 0;i1<manager->NCscStatType; ++i1 ){ + for( int i2 = 0;i2<manager->NCscStatEta; ++i2 ){ + for( int i3 = 0;i3<manager->NCscStatPhi; ++i3 ){ + const MuonGM::CscReadoutElement* detEl = manager->getCscReadoutElement(i1,i2,i3,1); + if( !detEl ) continue; + + Identifier id = detEl->identify(); + const Amg::Vector3D stripPos = detEl->stripPos(id); + const Amg::Vector3D localStripPos = detEl->localStripPos(id); + (*fout) << " New " << m_idHelperSvc->tgcIdHelper().print_to_string(detEl->identify()) << std::endl + << " X, Y, Z: " << stripPos.x() << ", " << stripPos.y() << ", " << stripPos.z() << std::endl + << " Local X, Y, Z: " << localStripPos.x() << ", " << localStripPos.y() << ", " << localStripPos.z() << std::endl + << Amg::toString( detEl->transform(),6 ) << std::endl; + + for( int gp = 0; gp<4;++gp ){ + for( int mp = 0; mp<2;++mp ){ + const Trk::Surface& surf = detEl->surface(2*gp+mp); + (*fout) << " New layer: gp " << gp << " measPhi " << mp << std::endl + << Amg::toString( surf.transform(),6 ) << std::endl; + } + } + } + } + } + + return StatusCode::SUCCESS; +} + diff --git a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py index 1cc99ee19dd366334dd81d2d643581ba3dd883f6..f99e319e97165cbc337803ca89834290b3d172dc 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py @@ -50,7 +50,7 @@ def MuonGeoModelCfg(flags): "/MUONALIGN/TGC/SIDEC"] acc.addCondAlgo(MuonAlign) - + # Condition DB is needed only if A-lines or B-lines are requested if not (not flags.Muon.Align.UseALines and flags.Muon.Align.UseBLines=='none'): detTool.UseConditionDb = 1 @@ -67,21 +67,23 @@ def MuonGeoModelCfg(flags): # here define if I-lines (CSC internal alignment) are enabled if flags.Muon.Align.UseILines: - detTool.EnableCscInternalAlignment = True if 'HLT' in flags.IOVDb.GlobalTag: #logMuon.info("Reading CSC I-Lines from layout - special configuration for COMP200 in HLT setup.") MuonAlign.ILinesFromCondDB = False detTool.UseIlinesFromGM = True + detTool.EnableCscInternalAlignment = False else : #logMuon.info("Reading CSC I-Lines from conditions database.") if (flags.Common.isOnline and not flags.Input.isMC): acc.merge(addFolders( flags, ['/MUONALIGN/Onl/CSC/ILINES'], 'MUONALIGN', className='CondAttrListCollection')) + detTool.EnableCscInternalAlignment = True else: acc.merge(addFolders( flags, ['/MUONALIGN/CSC/ILINES'], 'MUONALIGN_OFL', className='CondAttrListCollection')) MuonAlign.ParlineFolders += ["/MUONALIGN/CSC/ILINES"] MuonAlign.ILinesFromCondDB = True detTool.UseIlinesFromGM = False + detTool.EnableCscInternalAlignment = True # here define if As-Built (MDT chamber alignment) are enabled if flags.Muon.Align.UseAsBuilt: @@ -119,6 +121,11 @@ def MuonGeoModelCfg(flags): # turn on/off caching of MdtReadoutElement surfaces detTool.CachingFlag = 1 + from MuonGeoModel.MuonGeoModelConf import MuonDetectorCondAlg + MuonDetectorManagerCond = MuonDetectorCondAlg() + MuonDetectorManagerCond.MuonDetectorTool = detTool + acc.addCondAlgo(MuonDetectorManagerCond) + gms.DetectorTools += [ detTool ] acc.addService( Muon__MuonIdHelperSvc("MuonIdHelperSvc", diff --git a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h index 27d95633824ae0bbe9235e1e66cca24c35e22904..78c837f4c1ddbcf5109caf4824e301e491239883 100755 --- a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h +++ b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h @@ -9,9 +9,10 @@ #include "StoreGate/WriteCondHandleKey.h" #include "StoreGate/ReadCondHandleKey.h" #include "GaudiKernel/ICondSvc.h" -#include "GeoModelInterfaces/IGeoModelTool.h" #include "MuonAlignmentData/CorrContainer.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "GaudiKernel/ToolHandle.h" +#include "MuonGeoModel/MuonDetectorTool.h" class MuonDetectorCondAlg : public AthAlgorithm { @@ -31,10 +32,7 @@ public: private: ServiceHandle<ICondSvc> m_condSvc; - ToolHandle<IGeoModelTool> m_iGeoModelTool {this, "SelectionTool", "MuonDetectorTool", "The selection tool"}; - - bool m_applyCscIntAlignment = false; - bool m_applyMdtAsBuiltParams = false; + ToolHandle<MuonDetectorTool> m_iGeoModelTool {this, "MuonDetectorTool", "MuonDetectorTool", "The MuonDetector tool"}; // Read Handles SG::ReadCondHandleKey<ALineMapContainer> m_readALineKey {this, "ReadALineKey", diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx index d36ecb0b076c69572553ae680a8193fef14c614e..19aa8bcb56662858403ef5fe4304c79fb9b0285f 100755 --- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx @@ -26,7 +26,7 @@ MuonDetectorCondAlg::initialize() ATH_CHECK(m_condSvc.retrieve()); // Retrieve the MuonDetectorManager from the detector store to get - // the m_applyCscIntAlignment and m_applyMdtAsBuiltParams flags + // the applyCscIntAlignment() and applyMdtAsBuiltParams() flags std::string managerName="Muon"; const MuonGM::MuonDetectorManager* MuonDetMgrDS; if (detStore()->retrieve(MuonDetMgrDS).isFailure()) { @@ -34,18 +34,13 @@ MuonDetectorCondAlg::initialize() return StatusCode::FAILURE; } else { ATH_MSG_DEBUG(" Found the MuonGeoModel Manager from the Detector Store" );} - m_applyCscIntAlignment = MuonDetMgrDS->applyCscIntAlignment(); - m_applyMdtAsBuiltParams = MuonDetMgrDS->applyMdtAsBuiltParams(); - - std::cout << "m_applyCscIntAlignment " << m_applyCscIntAlignment << " m_applyMdtAsBuiltParams " << m_applyMdtAsBuiltParams << std::endl; - // Read Handles ATH_CHECK( m_iGeoModelTool.retrieve() ); ATH_CHECK(m_readALineKey.initialize()); ATH_CHECK(m_readBLineKey.initialize()); - ATH_CHECK(m_readILineKey.initialize(m_applyCscIntAlignment)); - ATH_CHECK(m_readAsBuiltKey.initialize(m_applyMdtAsBuiltParams)); + ATH_CHECK(m_readILineKey.initialize(MuonDetMgrDS->applyCscIntAlignment())); + ATH_CHECK(m_readAsBuiltKey.initialize(MuonDetMgrDS->applyMdtAsBuiltParams())); // Write Handles // std::string ThisKey = "MuonDetectorManager"; @@ -78,7 +73,7 @@ StatusCode MuonDetectorCondAlg::execute() // ======================= // Create the MuonDetectorManager by calling the MuonDetectorFactory001 // ======================= - MuonDetectorTool* MuDetTool = dynamic_cast<MuonDetectorTool*>(m_iGeoModelTool.get()); + MuonDetectorTool* MuDetTool = m_iGeoModelTool.get(); MuonGM::MuonDetectorFactory001 theFactory(detStore().operator->()); if(MuDetTool->createFactory(theFactory).isFailure()){ ATH_MSG_FATAL("unable to create MuonDetectorFactory001 "); @@ -121,7 +116,7 @@ StatusCode MuonDetectorCondAlg::execute() // Update CSC Internal Alignment if requested // ======================= - if (m_applyCscIntAlignment) { + if (MuonMgrData->applyCscIntAlignment()) { SG::ReadCondHandle<CscInternalAlignmentMapContainer> readILinesHandle{m_readILineKey}; const CscInternalAlignmentMapContainer* readILinesCdo{*readILinesHandle}; if(readILinesCdo==nullptr){ @@ -138,7 +133,7 @@ StatusCode MuonDetectorCondAlg::execute() // ======================= // Update MdtAsBuiltMapContainer // ======================= - if (m_applyMdtAsBuiltParams) { + if (MuonMgrData->applyMdtAsBuiltParams()) { SG::ReadCondHandle<MdtAsBuiltMapContainer> readAsBuiltHandle{m_readAsBuiltKey}; const MdtAsBuiltMapContainer* readAsBuiltCdo{*readAsBuiltHandle}; if(readAsBuiltCdo==nullptr){ diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.cxx index 52d37216b7fc34adb5b3aa2ead4382bf3e8c17fc..6f769bee7270fca34a622ae13fe482fe0e00fb85 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.cxx @@ -7,8 +7,6 @@ #include "CalibCscStripFitter.h" #include "CscCalibTools/ICscCalibTool.h" #include "MuonPrepRawData/CscStripPrepData.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/CscIdHelper.h" #include "cmath" using std::string; @@ -22,7 +20,6 @@ typedef ICscStripFitter::ChargeList ChargeList; CalibCscStripFitter:: CalibCscStripFitter(string type, string aname, const IInterface* parent) : AthAlgTool(type, aname, parent),m_noiseOption(rms), - m_pmuon_detmgr(0), m_phelper(0), m_cscCalibTool("CscCalibTool/CscCalibTool", this) { declareInterface<ICscStripFitter>(this); @@ -74,12 +71,7 @@ StatusCode CalibCscStripFitter::initialize() { } // Retrieve the detector descriptor. - if ( detStore()->retrieve(m_pmuon_detmgr).isFailure() ) { - ATH_MSG_ERROR ( " Cannot retrieve MuonGeoModel " ); - return StatusCode::RECOVERABLE; - } - ATH_MSG_DEBUG ( "Retrieved geometry." ); - m_phelper = m_pmuon_detmgr->cscIdHelper(); + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -106,20 +98,20 @@ Result CalibCscStripFitter::fit(const ChargeList& chgs, // double errorScaler = 4300./4151.06; // 1.03588 IdentifierHash stripHash; - if (m_phelper->get_channel_hash(stripId, stripHash)){ + if (m_idHelperSvc->cscIdHelper().get_channel_hash(stripId, stripHash)){ ATH_MSG_WARNING ( "Unable to get CSC striphash id " << " the identifier is " ); stripId.show(); } - int zsec = m_phelper->stationEta(stripId); - int phisec = m_phelper->stationPhi(stripId); - int station = m_phelper->stationName(stripId) - 49; + int zsec = m_idHelperSvc->cscIdHelper().stationEta(stripId); + int phisec = m_idHelperSvc->cscIdHelper().stationPhi(stripId); + int station = m_idHelperSvc->cscIdHelper().stationName(stripId) - 49; int sector = zsec*(2*phisec-station+1); - int wlay = m_phelper->wireLayer(stripId); - int measphi = m_phelper->measuresPhi(stripId); - int istrip = m_phelper->strip(stripId); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(stripId); + int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(stripId); + int istrip = m_idHelperSvc->cscIdHelper().strip(stripId); double ped = m_cscCalibTool->stripPedestal(stripHash); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.h index c5ee3629082c47ee6b0d15c5ea6211f8d1d15cfe..8a9a5b5db26fe18f058f5405e778a9cdfc68cadc 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CalibCscStripFitter.h @@ -15,6 +15,7 @@ #include <vector> #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "CscClusterization/ICscStripFitter.h" class ICscCalibTool; @@ -22,10 +23,6 @@ class CscIdHelper; namespace Muon { class CscStripPrepData; } -namespace MuonGM -{ - class MuonDetectorManager; -} class CalibCscStripFitter : virtual public ICscStripFitter, public AthAlgTool { @@ -75,9 +72,8 @@ private: // data std::string m_noiseOptionStr; NoiseOption m_noiseOption; - // Pointer to muon geometry manager. - const MuonGM::MuonDetectorManager* m_pmuon_detmgr; - const CscIdHelper* m_phelper; + // Pointer to MuonIdHelperSvc. + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // Calibration tool. ToolHandle<ICscCalibTool> m_cscCalibTool; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx index 25184d3717ba500bae8e5180e0423315eb0b384d..1acbcdca39f31910fd64f939f245f99bc232d4fd 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx @@ -3,7 +3,6 @@ */ #include "SimpleMMClusterBuilderTool.h" #include "MuonPrepRawData/MMPrepData.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/MmIdHelper.h" using namespace Muon; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h index 66fdd59b72168f3c96ae16c19c491239d8dd9ae6..d137b41bf5bc93f91ffc7ce3217f198c41332683 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h @@ -10,11 +10,6 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "MuonIdHelpers/MuonIdHelperTool.h" -namespace MuonGM -{ - class MuonDetectorManager; -} - // // Simple clusterization tool for MicroMegas // diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.h index 346748e53308d1c5d7372332904cb58d77e2014c..aa15e8d15cc718ee4f0094317bb6abf6f1ba8fff 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/UTPCMMClusterBuilderTool.h @@ -21,11 +21,6 @@ #include "TFitResultPtr.h" #include "TMatrixDSym.h" -namespace MuonGM -{ - class MuonDetectorManager; -} - // // Simple clusterization tool for MicroMegas // diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h index ecdec7a3c84b7d6a73bfdd99bca07edf5c871c0e..4afec932b45b66e55ef543991ca04193a6f9d6dc 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h @@ -11,6 +11,7 @@ // Base class #include "AthenaBaseComps/AthAlgorithm.h" +#include "StoreGate/ReadCondHandleKey.h" #include "TrkTrack/Track.h" #include "TrkExInterfaces/IExtrapolator.h" #include "TrkGeometry/TrackingGeometry.h" @@ -63,21 +64,21 @@ public: StatusCode execute(); StatusCode finalize(); - StatusCode retrieveMeasurements(); + StatusCode retrieveMeasurements(const MuonGM::MuonDetectorManager* MuonDetMgr); StatusCode storeMeasurements(); StatusCode storeSegments(); private: - std::vector<PairOfLayerPrd*>* createMdtHitCollectionLayers() const; - std::vector<PairOfLayerPrd*>* createRpcHitCollectionLayers() const; - std::vector<PairOfLayerPrd*>* createCscHitCollectionLayers() const; - std::vector<PairOfLayerPrd*>* createTgcHitCollectionLayers() const; + std::vector<PairOfLayerPrd*>* createMdtHitCollectionLayers(const MuonGM::MuonDetectorManager* MuonDetMgr) const; + std::vector<PairOfLayerPrd*>* createRpcHitCollectionLayers(const MuonGM::MuonDetectorManager* MuonDetMgr) const; + std::vector<PairOfLayerPrd*>* createCscHitCollectionLayers(const MuonGM::MuonDetectorManager* MuonDetMgr) const; + std::vector<PairOfLayerPrd*>* createTgcHitCollectionLayers(const MuonGM::MuonDetectorManager* MuonDetMgr) const; StatusCode createStationHitCollection() const; - StatusCode createStationSegmentCollection() const; - void createStationMap(const Trk::TrackingVolume* vol) const; + StatusCode createStationSegmentCollection(const MuonGM::MuonDetectorManager* MuonDetMgr) const; + void createStationMap(const Trk::TrackingVolume* vol, const MuonGM::MuonDetectorManager* MuonDetMgr) const; void misAlignStations() const; void reAlignStations() const; - const Trk::Layer* associatedLayer(int techn, Identifier id) const; + const Trk::Layer* associatedLayer(int techn, Identifier id, const MuonGM::MuonDetectorManager* MuonDetMgr) const; const Trk::Layer* associatedLayer(const Trk::TrackingVolume* trVol, Identifier id) const; Identifier getStationId( Identifier id ) const; @@ -101,7 +102,9 @@ private: ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager* m_muonMgr; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; std::string m_inputSegmentCollectionMoore; std::string m_inputSegmentCollectionMoMu; @@ -124,7 +127,7 @@ private: mutable std::vector<std::pair<Identifier, Amg::Transform3D> > m_misAlignDiff; // vector holding required misalignment }; - inline StatusCode MuonTGMeasAssocAlg::retrieveMeasurements() { + inline StatusCode MuonTGMeasAssocAlg::retrieveMeasurements(const MuonGM::MuonDetectorManager* MuonDetMgr) { // Get the messaging service, print where you are ATH_MSG_DEBUG( "MuonTGMeasAssocAlg::retrieveMeasurements()" ); // @@ -134,10 +137,10 @@ private: if (m_cscHits) delete m_cscHits; if (m_tgcHits) delete m_tgcHits; - if (m_mdtIn) m_mdtHits = createMdtHitCollectionLayers(); - if (m_rpcIn) m_rpcHits = createRpcHitCollectionLayers(); - if (m_cscIn) m_cscHits = createCscHitCollectionLayers(); - if (m_tgcIn) m_tgcHits = createTgcHitCollectionLayers(); + if (m_mdtIn) m_mdtHits = createMdtHitCollectionLayers(MuonDetMgr); + if (m_rpcIn) m_rpcHits = createRpcHitCollectionLayers(MuonDetMgr); + if (m_cscIn) m_cscHits = createCscHitCollectionLayers(MuonDetMgr); + if (m_tgcIn) m_tgcHits = createTgcHitCollectionLayers(MuonDetMgr); ATH_CHECK( createStationHitCollection() ); ATH_MSG_DEBUG( "MuonTGMeasAssocAlg::collected hits from " << m_allHits->size() << " stations" ); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx index b85c60ba743df4a4e3099e3cd7493952c5eddf5b..cddcea80976364b8b208dcd7fbec8a741c387663 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -53,7 +53,6 @@ Muon::MuonTGMeasAssocAlg::MuonTGMeasAssocAlg(const std::string &name, ISvcLocato m_trackingGeometry(0), m_trackingGeometryName("AtlasTrackingGeometry"), m_muonTgTool("Muon::MuonTGMeasurementTool/MuonTGMeasurementTool"), - m_muonMgr(0), m_inputSegmentCollectionMoore("MooreSegments"), m_inputSegmentCollectionMoMu("MuonSegments_MoMu"), m_inputSegmentCollectionMBoy("ConvertedMBoySegments"), @@ -101,6 +100,8 @@ StatusCode Muon::MuonTGMeasAssocAlg::initialize() // Get the messaging service, print where you are ATH_MSG_INFO("MuonTGMeasAssocAlg::initialize()"); + ATH_CHECK(m_DetectorManagerKey.initialize()); + StatusCode sc; // Get an Identifier helper object @@ -110,13 +111,6 @@ StatusCode Muon::MuonTGMeasAssocAlg::initialize() return StatusCode::FAILURE; } - sc = detStore()->retrieve(m_muonMgr); - if (sc.isFailure()) - { - ATH_MSG_ERROR("Cannot retrieve MuonDetectorManager..."); - return sc; - } - sc = m_muonIdHelperTool.retrieve(); if (sc.isFailure()) { @@ -173,6 +167,13 @@ StatusCode Muon::MuonTGMeasAssocAlg::execute() // Get the messaging service, print where you are ATH_MSG_INFO("MuonTGMeasAssocAlg::execute()"); + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + StatusCode sc; if (!m_trackingGeometry) { @@ -189,7 +190,7 @@ StatusCode Muon::MuonTGMeasAssocAlg::execute() if (!m_stationMap.size()) { const Trk::TrackingVolume* vol = m_trackingGeometry->highestTrackingVolume(); ATH_MSG_INFO("creating station map "); - createStationMap(vol); + createStationMap(vol, MuonDetMgr); ATH_MSG_INFO("station map created with "<<m_stationMap.size()<<" members "); // pass the map to the MuonTGMeasurementTool // if (m_muonTgTool) m_muonTgTool->getMuonStationMap(&m_stationMap); @@ -200,12 +201,12 @@ StatusCode Muon::MuonTGMeasAssocAlg::execute() // realign if (m_reAlign) reAlignStations(); - sc = retrieveMeasurements(); + sc = retrieveMeasurements(MuonDetMgr); if ( !sc.isFailure() && m_writeTgHits ) sc = storeMeasurements(); if ( m_segmentsIn ) { - sc = createStationSegmentCollection(); + sc = createStationSegmentCollection(MuonDetMgr); if ( !sc.isFailure() && m_writeTgSegments ) sc = storeSegments(); } @@ -365,7 +366,7 @@ StatusCode Muon::MuonTGMeasAssocAlg::storeSegments() { } - StatusCode Muon::MuonTGMeasAssocAlg::createStationSegmentCollection() const + StatusCode Muon::MuonTGMeasAssocAlg::createStationSegmentCollection(const MuonGM::MuonDetectorManager* MuonDetMgr) const { // Get the messaging service, print where you are ATH_MSG_DEBUG("MuonTGMeasAssocAlg::createStationSegmentCollection()" ); @@ -435,16 +436,16 @@ StatusCode Muon::MuonTGMeasAssocAlg::storeSegments() { Identifier id = rots[0]->identify(); Amg::Vector3D pos(0., 0., 0.); if (m_muonIdHelperTool->mdtIdHelper().is_mdt(id)) { - const MuonGM::MdtReadoutElement* mdtROE = m_muonMgr->getMdtReadoutElement(id); + const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(id); pos = mdtROE->tubePos(id); } else if ( m_muonIdHelperTool->mdtIdHelper().is_rpc(id)) { - const MuonGM::RpcReadoutElement* rpcROE = m_muonMgr->getRpcReadoutElement(id); + const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(id); pos = rpcROE->stripPos(id); } else if ( m_muonIdHelperTool->mdtIdHelper().is_csc(id)) { - const MuonGM::CscReadoutElement* cscROE = m_muonMgr->getCscReadoutElement(id); + const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(id); pos = cscROE->stripPos(id); } else if ( m_muonIdHelperTool->mdtIdHelper().is_tgc(id)) { - const MuonGM::TgcReadoutElement* tgcROE = m_muonMgr->getTgcReadoutElement(id); + const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id); pos = tgcROE->channelPos(id); } const Trk::Layer* lay = m_trackingGeometry->associatedLayer(pos); @@ -514,7 +515,8 @@ StatusCode Muon::MuonTGMeasAssocAlg::storeSegments() { } -std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*>* Muon::MuonTGMeasAssocAlg::createMdtHitCollectionLayers() const +std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*>* +Muon::MuonTGMeasAssocAlg::createMdtHitCollectionLayers(const MuonGM::MuonDetectorManager* MuonDetMgr) const { // Get the messaging service, print where you are ATH_MSG_DEBUG( "MuonTGMeasAssocAlg::createHitCollectionLayers()" ); @@ -546,7 +548,7 @@ std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*> Identifier dig_id = (*mdtPrd)->identify(); - const Trk::Layer* layer = associatedLayer(0,dig_id); + const Trk::Layer* layer = associatedLayer(0,dig_id,MuonDetMgr); if (!layer) { ATH_MSG_ERROR( "MuonTGMeasAssocAlg::No layer associated with this MDT hit! (digit = " << dig_id << ")" ); @@ -601,7 +603,8 @@ std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*> return vec_alllayer; } -std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*>* Muon::MuonTGMeasAssocAlg::createRpcHitCollectionLayers() const +std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*>* +Muon::MuonTGMeasAssocAlg::createRpcHitCollectionLayers(const MuonGM::MuonDetectorManager* MuonDetMgr) const { // Get the messaging service, print where you are ATH_MSG_DEBUG( "MuonTGMeasAssocAlg::createRpcHitCollectionLayers()" ); @@ -634,7 +637,7 @@ std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*> Identifier dig_id = (*rpcPrd)->identify(); - const Trk::Layer* layer = associatedLayer(1,dig_id); + const Trk::Layer* layer = associatedLayer(1,dig_id,MuonDetMgr); if (!layer) { ATH_MSG_ERROR( " No layer associated with this RPC hit! (digit = " << dig_id << ")" ); @@ -702,7 +705,8 @@ std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*> return vec_alllayer; } -std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*>* Muon::MuonTGMeasAssocAlg::createCscHitCollectionLayers() const +std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*>* +Muon::MuonTGMeasAssocAlg::createCscHitCollectionLayers(const MuonGM::MuonDetectorManager* MuonDetMgr) const { // Get the messaging service, print where you are ATH_MSG_DEBUG( "MuonTGMeasAssocAlg::createHitCollectionLayers()" ); @@ -731,7 +735,7 @@ std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*> Identifier dig_id = (*cscPrd)->identify(); - const Trk::Layer* layer = associatedLayer(3,dig_id); + const Trk::Layer* layer = associatedLayer(3,dig_id,MuonDetMgr); if (!layer) { ATH_MSG_ERROR( " No layer associated with this CSC hit! (digit = " << dig_id << ")" ); @@ -794,7 +798,8 @@ std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*> return vec_alllayer; } -std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*>* Muon::MuonTGMeasAssocAlg::createTgcHitCollectionLayers() const +std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*>* +Muon::MuonTGMeasAssocAlg::createTgcHitCollectionLayers(const MuonGM::MuonDetectorManager* MuonDetMgr) const { // Get the messaging service, print where you are ATH_MSG_DEBUG( "MuonTGMeasAssocAlg::createHitCollectionLayers():TGC" ); @@ -827,7 +832,7 @@ std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*> Identifier dig_id = (*tgcPrd)->identify(); - const Trk::Layer* layer = associatedLayer(2,dig_id); + const Trk::Layer* layer = associatedLayer(2,dig_id,MuonDetMgr); if (!layer) { ATH_MSG_ERROR( " No layer associated with this TGC hit! (digit = " << dig_id << ")" ); @@ -891,12 +896,12 @@ std::vector<std::pair<const Trk::Layer*,std::vector<const Trk::PrepRawData*>*>*> } -void Muon::MuonTGMeasAssocAlg::createStationMap(const Trk::TrackingVolume* vol) const +void Muon::MuonTGMeasAssocAlg::createStationMap(const Trk::TrackingVolume* vol, const MuonGM::MuonDetectorManager* MuonDetMgr) const { if (vol->confinedVolumes()) { const std::vector<const Trk::TrackingVolume*> subVols = vol->confinedVolumes()->arrayObjects(); std::vector<const Trk::TrackingVolume*>::const_iterator iter = subVols.begin(); - for (;iter!=subVols.end();iter++) createStationMap(*iter); + for (;iter!=subVols.end();iter++) createStationMap(*iter, MuonDetMgr); } if (vol->confinedDetachedVolumes()) { @@ -906,21 +911,21 @@ void Muon::MuonTGMeasAssocAlg::createStationMap(const Trk::TrackingVolume* vol) if ( (*dter)->layerRepresentation() && (*dter)->layerRepresentation()->layerType()>0 ) { Identifier id((*dter)->layerRepresentation()->layerType()); const MuonGM::MuonStation* mStation = 0; - if (m_muonIdHelperTool->mdtIdHelper().is_mdt(id)) mStation = m_muonMgr->getMdtReadoutElement(id)->parentMuonStation(); - if (m_muonIdHelperTool->rpcIdHelper().is_rpc(id)) mStation = m_muonMgr->getRpcReadoutElement(id)->parentMuonStation(); + if (m_muonIdHelperTool->mdtIdHelper().is_mdt(id)) mStation = MuonDetMgr->getMdtReadoutElement(id)->parentMuonStation(); + if (m_muonIdHelperTool->rpcIdHelper().is_rpc(id)) mStation = MuonDetMgr->getRpcReadoutElement(id)->parentMuonStation(); if (m_muonIdHelperTool->tgcIdHelper().is_tgc(id)) { - if ( !m_muonMgr->getTgcReadoutElement(id) ) { // tgc readout element not found, get any active layer to recover + if ( !MuonDetMgr->getTgcReadoutElement(id) ) { // tgc readout element not found, get any active layer to recover const Trk::Layer* lay = associatedLayer((*dter)->trackingVolume(),Identifier(0)); - if (lay) mStation = m_muonMgr->getTgcReadoutElement(Identifier(lay->layerType()))->parentMuonStation(); + if (lay) mStation = MuonDetMgr->getTgcReadoutElement(Identifier(lay->layerType()))->parentMuonStation(); } else { - mStation = m_muonMgr->getTgcReadoutElement(id)->parentMuonStation(); + mStation = MuonDetMgr->getTgcReadoutElement(id)->parentMuonStation(); } } if (m_muonIdHelperTool->cscIdHelper().is_csc(id)) { - if ( !m_muonMgr->getCscReadoutElement(id) ) { + if ( !MuonDetMgr->getCscReadoutElement(id) ) { const Trk::Layer* lay = associatedLayer((*dter)->trackingVolume(),Identifier(0)); - if (lay) mStation = m_muonMgr->getCscReadoutElement(Identifier(lay->layerType()))->parentMuonStation(); - } else mStation = m_muonMgr->getCscReadoutElement(id)->parentMuonStation(); + if (lay) mStation = MuonDetMgr->getCscReadoutElement(Identifier(lay->layerType()))->parentMuonStation(); + } else mStation = MuonDetMgr->getCscReadoutElement(id)->parentMuonStation(); } // coming across station repeatedly if (mStation && !m_stationMap[id].second ) @@ -963,14 +968,14 @@ void Muon::MuonTGMeasAssocAlg::reAlignStations() const ATH_MSG_DEBUG( moved << " stations realigned "); } -const Trk::Layer* Muon::MuonTGMeasAssocAlg::associatedLayer(int techn, Identifier id) const +const Trk::Layer* Muon::MuonTGMeasAssocAlg::associatedLayer(int techn, Identifier id, const MuonGM::MuonDetectorManager* MuonDetMgr) const { const Trk::Layer* layer = 0; const MuonGM::MuonStation* mStation = 0; - if ( techn==0 ) mStation = m_muonMgr->getMdtReadoutElement(id)->parentMuonStation(); - if ( techn==1 ) mStation = m_muonMgr->getRpcReadoutElement(id)->parentMuonStation(); - if ( techn==2 ) mStation = m_muonMgr->getTgcReadoutElement(id)->parentMuonStation(); - if ( techn==3 ) mStation = m_muonMgr->getCscReadoutElement(id)->parentMuonStation(); + if ( techn==0 ) mStation = MuonDetMgr->getMdtReadoutElement(id)->parentMuonStation(); + if ( techn==1 ) mStation = MuonDetMgr->getRpcReadoutElement(id)->parentMuonStation(); + if ( techn==2 ) mStation = MuonDetMgr->getTgcReadoutElement(id)->parentMuonStation(); + if ( techn==3 ) mStation = MuonDetMgr->getCscReadoutElement(id)->parentMuonStation(); if (!mStation ) ATH_MSG_ERROR( "no associated GM station found for hit id:"<< id << ","<< techn ); if (!mStation ) return layer; @@ -985,7 +990,7 @@ const Trk::Layer* Muon::MuonTGMeasAssocAlg::associatedLayer(int techn, Identifie ATH_MSG_WARNING(m_muonIdHelperTool->tgcIdHelper().stationName(id)<<","<<m_muonIdHelperTool->tgcIdHelper().stationEta(id)<< ","<<m_muonIdHelperTool->tgcIdHelper().stationPhi(id)); //Get the TgcReadoutElement and the tube position from it - const MuonGM::TgcReadoutElement* tgcROE = m_muonMgr->getTgcReadoutElement(id); + const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id); Amg::Vector3D pos = tgcROE->channelPos(id); std::vector<const Trk::DetachedTrackingVolume*>* detVols = m_trackingGeometry->lowestDetachedTrackingVolumes(pos); for (unsigned int i = 0;i<detVols->size();i++) { diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/RpcClusterization/RpcClusterBuilderPRD.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/RpcClusterization/RpcClusterBuilderPRD.h index 4b4220a40810341c8e40eac12268421f6d8797b3..46919f86edd6c693b0bb28b17283fbd0383e5775 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/RpcClusterization/RpcClusterBuilderPRD.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/RpcClusterization/RpcClusterBuilderPRD.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef RpcClusterBuilderPRD_H @@ -7,6 +7,9 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "Identifier/Identifier.h" +#include "GaudiKernel/ServiceHandle.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonPrepRawData/RpcPrepData.h" @@ -35,7 +38,7 @@ private: StatusCode fill_rpcClusterContainer(); - void buildClusters(Identifier elementId); + void buildClusters(Identifier elementId, const MuonGM::MuonDetectorManager* MuonDetMgr); int buildPatterns(const Muon::RpcPrepDataCollection* rpcCollection); void push_back(Muon::RpcPrepData *& newCluster); @@ -53,8 +56,12 @@ private: protected: Muon::RpcPrepDataContainer * m_rpcClusterContainer; - const MuonGM::MuonDetectorManager * m_muonMgr; - const RpcIdHelper * m_rpcId; + + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/src/RpcClusterBuilderPRD.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/src/RpcClusterBuilderPRD.cxx index ba4678f92ac103884c71a5af168694cb5fd57d36..288f4aae74f828f43791816d60cb5e4696d7bb72 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/src/RpcClusterBuilderPRD.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/RpcClusterization/src/RpcClusterBuilderPRD.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -25,8 +25,7 @@ ///////////////////////////////////////////////////////////////////////////// RpcClusterBuilderPRD::RpcClusterBuilderPRD(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator), m_temp_coll(NULL), m_rpcClusterContainer(NULL), - m_muonMgr(NULL), m_rpcId(NULL) + AthAlgorithm(name, pSvcLocator), m_temp_coll(nullptr), m_rpcClusterContainer(nullptr) { // Declare the properties @@ -38,12 +37,12 @@ RpcClusterBuilderPRD::RpcClusterBuilderPRD(const std::string& name, ISvcLocator* StatusCode RpcClusterBuilderPRD::initialize(){ - ATH_CHECK( detStore()->retrieve( m_muonMgr ) ); + ATH_CHECK(m_DetectorManagerKey.initialize()); - m_rpcId = m_muonMgr->rpcIdHelper(); + ATH_CHECK(m_idHelperSvc.retrieve()); // Create an empty cluster container - // m_rpcClusterContainer = new Muon::RpcPrepDataContainer(m_rpcId->module_hash_max()); + // m_rpcClusterContainer = new Muon::RpcPrepDataContainer(m_idHelperSvc->rpcIdHelper().module_hash_max()); // m_rpcClusterContainer->addRef(); return StatusCode::SUCCESS; @@ -52,7 +51,7 @@ StatusCode RpcClusterBuilderPRD::initialize(){ StatusCode RpcClusterBuilderPRD::execute() { - m_rpcClusterContainer = new Muon::RpcPrepDataContainer(m_rpcId->module_hash_max()); + m_rpcClusterContainer = new Muon::RpcPrepDataContainer(m_idHelperSvc->rpcIdHelper().module_hash_max()); // m_rpcClusterContainer->cleanup(); ATH_CHECK( evtStore()->record(m_rpcClusterContainer,m_colKey) ); @@ -79,6 +78,13 @@ StatusCode RpcClusterBuilderPRD::finalize() { StatusCode RpcClusterBuilderPRD::fill_rpcClusterContainer() { + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + const Muon::RpcPrepDataContainer* container; StatusCode sc = evtStore()->retrieve(container,m_colKeyIn); if (sc.isFailure()) { @@ -106,11 +112,11 @@ StatusCode RpcClusterBuilderPRD::fill_rpcClusterContainer() { // create temp collection for clusters - Identifier elementId = m_rpcId->elementID(theCollection->identify()); - IdContext rpcContext = m_rpcId->module_context(); + Identifier elementId = m_idHelperSvc->rpcIdHelper().elementID(theCollection->identify()); + IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context(); IdentifierHash rpcHashId; - if (m_rpcId->get_hash(elementId, rpcHashId, &rpcContext)) { + if (m_idHelperSvc->rpcIdHelper().get_hash(elementId, rpcHashId, &rpcContext)) { ATH_MSG_ERROR("Unable to get RPC hash id from CSC PreDataCollection collection id" << "context begin_index = " << rpcContext.begin_index() << " context end_index = " << rpcContext.end_index() @@ -124,7 +130,7 @@ StatusCode RpcClusterBuilderPRD::fill_rpcClusterContainer() { // build the patterns - if(buildPatterns(theCollection)) buildClusters(elementId); + if(buildPatterns(theCollection)) buildClusters(elementId, MuonDetMgr); } //clear map at each collection @@ -175,15 +181,15 @@ int RpcClusterBuilderPRD::buildPatterns(const Muon::RpcPrepDataCollection* rpcCo if(!(rpcDigit->triggerInfo())){ // remove trigger patterns. temporary Identifier id=rpcDigit->identify(); - int nstrip=m_rpcId->strip(id); - int doubletZ=m_rpcId->doubletZ(id); - int doubletPhi=m_rpcId->doubletPhi(id); - int gasGap=m_rpcId->gasGap(id); - int measPhi=m_rpcId->measuresPhi(id); + int nstrip=m_idHelperSvc->rpcIdHelper().strip(id); + int doubletZ=m_idHelperSvc->rpcIdHelper().doubletZ(id); + int doubletPhi=m_idHelperSvc->rpcIdHelper().doubletPhi(id); + int gasGap=m_idHelperSvc->rpcIdHelper().gasGap(id); + int measPhi=m_idHelperSvc->rpcIdHelper().measuresPhi(id); // use Id of first strip to identify a panel. - Identifier panelId=m_rpcId->channelID(eleId,doubletZ,doubletPhi,gasGap,measPhi,1); + Identifier panelId=m_idHelperSvc->rpcIdHelper().channelID(eleId,doubletZ,doubletPhi,gasGap,measPhi,1); if(m_digits.find(panelId)==m_digits.end()){ // first hit on this panel @@ -212,7 +218,7 @@ int RpcClusterBuilderPRD::buildPatterns(const Muon::RpcPrepDataCollection* rpcCo } -void RpcClusterBuilderPRD::buildClusters(Identifier elementId) { +void RpcClusterBuilderPRD::buildClusters(Identifier elementId, const MuonGM::MuonDetectorManager* MuonDetMgr) { // loop over existing patterns @@ -222,12 +228,10 @@ void RpcClusterBuilderPRD::buildClusters(Identifier elementId) { Identifier panelId=(*patt_it).first; // this is the panel id - int measphi=m_rpcId->measuresPhi(panelId); + int measphi=m_idHelperSvc->rpcIdHelper().measuresPhi(panelId); //int clusteropen=0; - //const RpcReadoutElement* descriptor=m_muonMgr->getRpcReadoutElement(elementId); - std::map<int, Muon::RpcPrepData*, std::less<int> >::iterator dig_it=m_digits[panelId].begin(); std::vector<Identifier> theIDs; @@ -244,7 +248,7 @@ void RpcClusterBuilderPRD::buildClusters(Identifier elementId) { for(;dig_it!=m_digits[panelId].end();++dig_it){ // loop over patterns - const MuonGM::RpcReadoutElement* descriptor=m_muonMgr->getRpcReadoutElement((*dig_it).second->identify()); + const MuonGM::RpcReadoutElement* descriptor=MuonDetMgr->getRpcReadoutElement((*dig_it).second->identify()); if(lastStrip==-999){ // first hit of a cluster.. @@ -308,9 +312,9 @@ void RpcClusterBuilderPRD::buildClusters(Identifier elementId) { // DV->push_back(digitsInCluster[k]); // } - IdContext rpcContext = m_rpcId->module_context(); + IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context(); IdentifierHash rpcHashId; - m_rpcId->get_hash(elementId, rpcHashId, &rpcContext); + m_idHelperSvc->rpcIdHelper().get_hash(elementId, rpcHashId, &rpcContext); Amg::Vector2D pointLocPos ; descriptor->surface(panelId).globalToLocal(globalPosition,globalPosition,pointLocPos); @@ -369,9 +373,9 @@ void RpcClusterBuilderPRD::buildClusters(Identifier elementId) { // std::cout<<"decision is "<<clusAmbFlag<<std::endl; - IdContext rpcContext = m_rpcId->module_context(); + IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context(); IdentifierHash rpcHashId; - m_rpcId->get_hash(elementId, rpcHashId, &rpcContext); + m_idHelperSvc->rpcIdHelper().get_hash(elementId, rpcHashId, &rpcContext); //std::cout<<" closing2 the cluster "<<std::endl; localPosition=localPosition*(1/(float)theIDs.size()); @@ -424,13 +428,13 @@ void RpcClusterBuilderPRD::push_back(Muon::RpcPrepData *& newCluster){ m_temp_coll->push_back(newCluster); - // Identifier elementId = m_rpcId->elementID(newCluster->identify()); - // IdContext rpcContext = m_rpcId->module_context(); + // Identifier elementId = m_idHelperSvc->rpcIdHelper().elementID(newCluster->identify()); + // IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context(); // Muon::RpcPrepDataContainer::KEY key = m_rpcClusterContainer->key(elementId); // if (!evtStore()->contains<Muon::RpcPrepDataCollection>(key)) { // IdentifierHash rpcHashId; -// if (m_rpcId->get_hash(elementId, rpcHashId, &rpcContext)) { +// if (m_idHelperSvc->rpcIdHelper().get_hash(elementId, rpcHashId, &rpcContext)) { // ATH_MSG_ERROR("Unable to get RPC hash id from RPC PreDataCollection collection id" // << "context begin_index = " << rpcContext.begin_index() // << " context end_index = " << rpcContext.end_index() @@ -475,7 +479,7 @@ StatusCode RpcClusterBuilderPRD::retrieve_rpcClusterContainer() const { const Muon::RpcPrepData* cluster = *beginCluster; Amg::Vector3D position = cluster->globalPosition(); ATH_MSG_INFO("RPC Cluster ID, Position (mm), size = " - << m_rpcId->show_to_string(cluster->identify()) << " [" + << m_idHelperSvc->rpcIdHelper().show_to_string(cluster->identify()) << " [" << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << position.x() << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << position.y() << std::setiosflags(std::ios::fixed) << std::setprecision(3) << std::setw(12) << position.z() diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h index 1509779461d484afbbd189c98c08a26f32648860..2e04077e4f646ad9275b0870eab31788c34fc87c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h @@ -27,10 +27,6 @@ class TFile; class MuonHoughHitContainer; class IMuonHoughPatternTool; -namespace MuonGM { - class MuonDetectorManager; -} - namespace Muon { class MuonEDMPrinterTool; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx index 69b1e9dd805a469140d375b17fd715bff5cc355c..b1b3c656a93ad9f7ea5a94e555d7ef875d45d953 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx @@ -11,9 +11,6 @@ #include "TrkSurfaces/Surface.h" -//#include "MuonGeoModel/MuonDetectorManager.h" -//#include "MuonGeoModel/MdtReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonIdHelpers/MdtIdHelper.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternTool.cxx index 0252b35a82da3eabb7de89f34e1b354e40557ba2..78b8dcf6a18ec9aecc28cae33eaed4a93b389c1e 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternTools/MuonHoughPatternTool.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.cxx b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.cxx index ae2974c2b95f83bfbd046b2214379beb9e1ae7b8..f4f6172b2121a629fb3560871770d33436d4e12c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.cxx @@ -39,7 +39,6 @@ namespace Muon { CscClusterOnTrackCreator::CscClusterOnTrackCreator (const std::string& ty,const std::string& na,const IInterface* pa) : AthAlgTool(ty,na,pa), - m_muonMgr(0), m_stripFitter("CalibCscStripFitter/CalibCscStripFitter", this), m_clusterFitter("QratCscClusterFitter/QratCscClusterFitter", this), m_clusterUtilTool("CscClusterUtilTool/CscClusterUtilTool", this), @@ -74,11 +73,6 @@ namespace Muon { return StatusCode::FAILURE; } - if ( detStore()->retrieve( m_muonMgr ).isFailure() ) { - ATH_MSG_ERROR ( " Cannot retrieve MuonGeoModel " ); - return StatusCode::FAILURE; - } - ATH_CHECK( m_idHelperSvc.retrieve() ); if (!m_idHelperSvc->hasCSC()) { diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.h b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.h index 2b447caf07e05750180115eafd2748efa2254502..53037136b5c991ce63da802a5f4326ad67a44600 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/CscClusterOnTrackCreator.h @@ -16,7 +16,6 @@ #include "MuonRecToolInterfaces/ICscClusterOnTrackCreator.h" #include "MuonRIO_OnTrack/MuonClusterOnTrack.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "TrkPrepRawData/PrepRawDataCLASS_DEF.h" #include "TrkParameters/TrackParameters.h" #include "MuonRIO_OnTrack/MuonEtaPhiRIO_OnTrackErrorScaling.h" @@ -95,7 +94,7 @@ namespace Muon { private: - const MuonGM::MuonDetectorManager* m_muonMgr; // Muon GeoModel + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle<ICscStripFitter> m_stripFitter; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MuonClusterOnTrackCreator.h b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MuonClusterOnTrackCreator.h index 086d25e1f8d49e84ff9ef3fd6f30b4a599ab07ec..52779f7e4cd256b5e3766191d31bd3c14a78b379 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MuonClusterOnTrackCreator.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MuonClusterOnTrackCreator.h @@ -16,7 +16,6 @@ #include "MuonRIO_OnTrack/MuonClusterOnTrack.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "TrkPrepRawData/PrepRawDataCLASS_DEF.h" #include "TrkParameters/TrackParameters.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonAlignConfig.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonAlignConfig.py index 904e51edcdc9e352eb85412d5377811804018fd3..bb1a24f2cdcf878ec923ceaa368641f892ee7855 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonAlignConfig.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonAlignConfig.py @@ -36,6 +36,9 @@ conddb.addFolderSplitOnline('MUONALIGN','/MUONALIGN/Onl/MDT/ENDCAP/SIDEC','/MUON conddb.addFolderSplitOnline('MUONALIGN','/MUONALIGN/Onl/TGC/SIDEA','/MUONALIGN/TGC/SIDEA',className='CondAttrListCollection') conddb.addFolderSplitOnline('MUONALIGN','/MUONALIGN/Onl/TGC/SIDEC','/MUONALIGN/TGC/SIDEC',className='CondAttrListCollection') +from AtlasGeoModel.MuonGM import GeoModelSvc +MuonDetectorTool = GeoModelSvc.DetectorTools[ "MuonDetectorTool" ] + condSequence = AthSequencer("AthCondSeq") from MuonCondAlg.MuonCondAlgConf import MuonAlignmentCondAlg @@ -47,9 +50,6 @@ MuonAlignAlg.ParlineFolders = ["/MUONALIGN/MDT/BARREL", "/MUONALIGN/TGC/SIDEA", "/MUONALIGN/TGC/SIDEC"] -from AtlasGeoModel.MuonGM import GeoModelSvc -MuonDetectorTool = GeoModelSvc.DetectorTools[ "MuonDetectorTool" ] - # Disable caching. This will have some memory impact (TBC) but is necessary for the moment to make this thread safe. MuonDetectorTool.FillCacheInitTime = 1 @@ -68,14 +68,15 @@ if not (muonAlignFlags.UseAlines=='none' and muonAlignFlags.UseBlines=='none'): # here define if I-lines (CSC internal alignment) are enabled if muonAlignFlags.UseIlines: - MuonDetectorTool.EnableCscInternalAlignment = True if 'HLT' in globalflags.ConditionsTag() : logMuon.info("Reading CSC I-Lines from layout - special configuration for COMP200 in HLT setup.") MuonDetectorTool.UseIlinesFromGM = True + MuonDetectorTool.EnableCscInternalAlignment = False else : logMuon.info("Reading CSC I-Lines from conditions database.") conddb.addFolderSplitOnline('MUONALIGN','/MUONALIGN/Onl/CSC/ILINES','/MUONALIGN/CSC/ILINES',className='CondAttrListCollection') MuonDetectorTool.UseIlinesFromGM = False + MuonDetectorTool.EnableCscInternalAlignment = True MuonAlignAlg.ParlineFolders += ["/MUONALIGN/CSC/ILINES"] MuonAlignAlg.ILinesFromCondDB = True @@ -97,3 +98,8 @@ if conddb.dbdata != 'COMP200' and conddb.dbmc != 'COMP200' and \ conddb.addFolder("MUONALIGN_OFL","/MUONALIGN/ERRS",className='CondAttrListCollection') condSequence += MuonAlignmentErrorDbAlg("MuonAlignmentErrorDbAlg") + +from MuonGeoModel.MuonGeoModelConf import MuonDetectorCondAlg +MuonDetectorManagerCond = MuonDetectorCondAlg() +MuonDetectorManagerCond.MuonDetectorTool = MuonDetectorTool +condSequence+=MuonDetectorManagerCond diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/MuonEDMPrinterTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/MuonEDMPrinterTool.h index cc38a6207421cc6149d027fd06bd29a203286a01..9978da88d4e9be55f3d3ccf0e5e193f16740155d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/MuonEDMPrinterTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/MuonEDMPrinterTool.h @@ -19,6 +19,7 @@ #include "TrkToolInterfaces/IResidualPullCalculator.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include <string> @@ -145,6 +146,10 @@ namespace Muon{ ToolHandle<Trk::ITrackSummaryHelperTool> m_summaryHelper; ToolHandle<Trk::IResidualPullCalculator> m_pullCalculator; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + }; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/src/MuonEDMPrinterTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/src/MuonEDMPrinterTool.cxx index 25159cd47951216b098828ddaeb6c89bc025fbed..e0389715728dabe7337851cecc1d7d1141a108e4 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/src/MuonEDMPrinterTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/src/MuonEDMPrinterTool.cxx @@ -77,6 +77,8 @@ namespace Muon { ATH_MSG_WARNING("Could not get " << m_summaryHelper); return StatusCode::FAILURE; } + + ATH_CHECK(m_DetectorManagerKey.initialize()); return StatusCode::SUCCESS; } @@ -697,16 +699,18 @@ namespace Muon { if( isMdt && detEls.empty() ){ - const MuonGM::MuonDetectorManager* detMgr = 0; - if( !detStore()->retrieve( detMgr ) || !detMgr ){ - ATH_MSG_DEBUG("Cannot retrieve DetectorManager "); - }else{ + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_DEBUG("Cannot retrieve DetectorManager "); + } else { + Identifier idml1 = m_idHelper->mdtIdHelper().channelID(id,1,1,1); Identifier idml2 = m_idHelper->mdtIdHelper().channelID(id,2,1,1); - const MuonGM::MdtReadoutElement* detEl1 = detMgr->getMdtReadoutElement( idml1 ); + const MuonGM::MdtReadoutElement* detEl1 = MuonDetMgr->getMdtReadoutElement( idml1 ); const MuonGM::MdtReadoutElement* detEl2 = 0; if (m_idHelper->mdtIdHelper().numberOfMultilayers(id) == 2){ - detEl2 = detMgr->getMdtReadoutElement( idml2 ); + detEl2 = MuonDetMgr->getMdtReadoutElement( idml2 ); }else{ ATH_MSG_DEBUG("A single multilayer for this station " << m_idHelper->toString(id)); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonHolesOnTrackTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonHolesOnTrackTool.h index 106aceeaa71e9de86c5fa37601790d3eb4eb7509..2315792b0b7b35fabfb9ad4218f5deec50a0278b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonHolesOnTrackTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonHolesOnTrackTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -26,7 +26,6 @@ #include <fstream> #include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonPrepRawData/MdtPrepData.h" #include "MuonPrepRawData/RpcPrepData.h" #include "MuonTGRecTools/IMuonTGMeasTool.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGHitNtuple.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGHitNtuple.h index 696ddbd190a6b0013e15ea58aa3906292433aabe..680ab92776eef51ebc695476ea6a0f20f091f5dd 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGHitNtuple.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGHitNtuple.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONTGRECTOOLS_MUONTGHITNTUPLE_H @@ -66,15 +66,16 @@ class MuonTGHitNtuple : public AthAlgorithm private: - void fillFatras() const; - void fillSimNtuple() const; - void fillRecNtuple(const TrackCollection*) const; - void fillHoles(const TrackCollection*) const; + void fillFatras(const MuonGM::MuonDetectorManager* MuonDetMgr) const; + void fillSimNtuple(const MuonGM::MuonDetectorManager* MuonDetMgr) const; + void fillRecNtuple(const TrackCollection*, const MuonGM::MuonDetectorManager* MuonDetMgr) const; + void fillHoles(const TrackCollection*, const MuonGM::MuonDetectorManager* MuonDetMgr) const; - const TrackCollection* holesFromSim() const; + const TrackCollection* holesFromSim(const MuonGM::MuonDetectorManager* MuonDetMgr) const; const Trk::TrackStateOnSurface* createHole(const Trk::TrackParameters*,const Trk::Layer*, bool) const; - bool layerMatch(Identifier id1, Identifier id2) const; - const std::vector< std::pair<const Trk::Layer*, std::vector<Identifier> > >* getOrderedSimLayers(int index, Amg::Vector3D mom) const; + bool layerMatch(Identifier id1, Identifier id2, const MuonGM::MuonDetectorManager* MuonDetMgr) const; + const std::vector< std::pair<const Trk::Layer*, std::vector<Identifier> > >* getOrderedSimLayers(int index, Amg::Vector3D mom, + const MuonGM::MuonDetectorManager* MuonDetMgr) const; Identifier getRpcId(const RPCSimHit*) const; Identifier getCscId(const CSCSimHit*) const; Identifier getTgcId(const TGCSimHit*) const; @@ -85,8 +86,9 @@ class MuonTGHitNtuple : public AthAlgorithm CscHitIdHelper* m_cscHelper; TgcHitIdHelper* m_tgcHelper; - - const MuonGM::MuonDetectorManager* m_muonMgr; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGMeasurementTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGMeasurementTool.h index ed0ce23d8da72227b381c44aaa76d1c099f4cd1f..6f0833c0a53a1f96767f5f079253de38f746768f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGMeasurementTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/MuonTGRecTools/MuonTGMeasurementTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -27,7 +27,6 @@ #include <fstream> #include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonPrepRawData/MdtPrepData.h" #include "MuonPrepRawData/RpcPrepData.h" #include "MuonTGHits.h" @@ -92,7 +91,9 @@ private: ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager* m_muonMgr; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; // -- algorithm members mutable MuonTGHits* m_hits; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGHitNtuple.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGHitNtuple.cxx index 6ec5c6b18ed03cb9f18778590826ccb466eca517..8099d7c5977ceac000b901ccd40a1080ca004350 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGHitNtuple.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGHitNtuple.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "MuonTGRecTools/MuonTGHitNtuple.h" @@ -44,7 +44,6 @@ Muon::MuonTGHitNtuple::MuonTGHitNtuple(const std::string &name, ISvcLocator *pSv m_rpcHelper(0), m_cscHelper(0), m_tgcHelper(0), - m_muonMgr(0), m_holesTool("Muon::MuonHolesOnTrackTool/MuonHolesOnTrackTool"), m_measTool("Muon::MuonTGMeasurementTool/MuonTGMeasurementTool"), m_trackingGeometry(0), @@ -90,7 +89,7 @@ Muon::MuonTGHitNtuple::MuonTGHitNtuple(const std::string &name, ISvcLocator *pSv StatusCode Muon::MuonTGHitNtuple::initialize() { ATH_MSG_INFO("MuonTGHitNtuple::initialize()"); - + StatusCode sc; // create new root file @@ -177,7 +176,7 @@ StatusCode Muon::MuonTGHitNtuple::initialize() m_cscHelper = CscHitIdHelper::GetHelper(); m_tgcHelper = TgcHitIdHelper::GetHelper(); - ATH_CHECK( detStore()->retrieve(m_muonMgr) ); + ATH_CHECK(m_DetectorManagerKey.initialize()); // get holes-on-track tool if (m_processHoles) { @@ -223,8 +222,15 @@ StatusCode Muon::MuonTGHitNtuple::initialize() StatusCode Muon::MuonTGHitNtuple::execute() { ATH_MSG_INFO("filling ntuple"); + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } - fillSimNtuple(); + fillSimNtuple(MuonDetMgr); if (m_processFatras) { // get input fatras tracks @@ -239,7 +245,7 @@ StatusCode Muon::MuonTGHitNtuple::execute() m_inputFatrasTracks = 0; } - fillFatras(); + fillFatras(MuonDetMgr); } @@ -257,17 +263,17 @@ StatusCode Muon::MuonTGHitNtuple::execute() if (m_inputTracks) { - fillRecNtuple(m_inputTracks); + fillRecNtuple(m_inputTracks, MuonDetMgr); - if (m_processHoles) fillHoles(m_inputTracks); + if (m_processHoles) fillHoles(m_inputTracks, MuonDetMgr); } else if (!m_inputTracks && m_processHoles) { - m_inputTracks = holesFromSim(); + m_inputTracks = holesFromSim(MuonDetMgr); if (m_inputTracks) { - fillRecNtuple(m_inputTracks); + fillRecNtuple(m_inputTracks, MuonDetMgr); // record the new track collection StatusCode sc = m_StoreGate->record(m_inputTracks,"HolesFromSim"); @@ -295,7 +301,7 @@ StatusCode Muon::MuonTGHitNtuple::finalize() return StatusCode::SUCCESS; } -void Muon::MuonTGHitNtuple::fillFatras() const +void Muon::MuonTGHitNtuple::fillFatras(const MuonGM::MuonDetectorManager* MuonDetMgr) const { // Trk::Perigee* peri = 0; @@ -353,7 +359,7 @@ void Muon::MuonTGHitNtuple::fillFatras() const // extrapolate gen. track to get residual if (peri) { // destination surface - const MuonGM::MdtReadoutElement* mdtROE = m_muonMgr->getMdtReadoutElement(iMdt); + const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(iMdt); if ( mdtROE ) { const Trk::TrackParameters* trPar = m_extrapolator->extrapolate(*peri,mdtROE->surface(iMdt), Trk::alongMomentum,false,Trk::muon) ; @@ -392,7 +398,7 @@ void Muon::MuonTGHitNtuple::fillFatras() const // extrapolate gen. track to get residual if (peri) { // destination surface - const MuonGM::RpcReadoutElement* rpcROE = m_muonMgr->getRpcReadoutElement(iRpc); + const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(iRpc); if ( rpcROE ) { const Trk::TrackParameters* trPar = m_extrapolator->extrapolate(*peri,rpcROE->surface(iRpc), Trk::alongMomentum,false,Trk::muon) ; @@ -454,7 +460,7 @@ void Muon::MuonTGHitNtuple::fillFatras() const m_fsim_hit_station_phi[m_nFSim] = -1; //for (unsigned int i=0;i<3;i++) m_fsim_hit_pos[m_nFSim][i] = (*ci)->localPosition()[i]; //std::cout << "fatras tgc sim hit time:position:dir:"<<iTgc<<","<<(*ci)->globalTime()<<","<< (*ci)->localPosition() << ","<< (*ci)->localDireCos() << std::endl; - //std::cout << "number of gas gaps :"<<m_muonMgr->getTgcReadoutElement(iTgc)->Ngasgaps()<< std::endl; + //std::cout << "number of gas gaps :"<<MuonDetMgr->getTgcReadoutElement(iTgc)->Ngasgaps()<< std::endl; m_fsim_hit_residual[m_nFSim] = 10000.; @@ -490,7 +496,7 @@ void Muon::MuonTGHitNtuple::fillFatras() const // calculate residual as distance of layer intersection from tube/strip center ( check of nearest detEl identification ) m_fhit_residual[m_nFHit] = 10000.; // dummy default if (m_fhit_techn[m_nFHit]==0) { - const MuonGM::MdtReadoutElement* mdtROE = m_muonMgr->getMdtReadoutElement(dig_id); + const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(dig_id); if (mdtROE){ const Amg::Vector3D tubeposition=mdtROE->globalToLocalCoords(mdtROE->tubePos(dig_id), dig_id ); const Amg::Vector3D localhit=mdtROE->globalToLocalCoords((*iter)->trackParameters()->position(), dig_id); @@ -498,7 +504,7 @@ void Muon::MuonTGHitNtuple::fillFatras() const } } if (m_fhit_techn[m_nFHit]==1 || m_fhit_techn[m_nFHit]==11) { // rpc hits - const MuonGM::RpcReadoutElement* rpcROE = m_muonMgr->getRpcReadoutElement(dig_id); + const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(dig_id); if (rpcROE){ const Amg::Vector3D stripposition=rpcROE->surface(dig_id).transform().inverse()*rpcROE->stripPos(dig_id); const Amg::Vector3D localhit=rpcROE->surface(dig_id).transform().inverse()*(*iter)->trackParameters()->position(); @@ -507,7 +513,7 @@ void Muon::MuonTGHitNtuple::fillFatras() const } } if (m_fhit_techn[m_nFHit]==2 || m_fhit_techn[m_nFHit]==12) { // tgc hits - const MuonGM::TgcReadoutElement* tgcROE = m_muonMgr->getTgcReadoutElement(dig_id); + const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(dig_id); if (tgcROE){ const Amg::Vector3D stripposition=tgcROE->surface(dig_id).transform().inverse()*tgcROE->channelPos(dig_id); const Amg::Vector3D localhit=tgcROE->surface(dig_id).transform().inverse()*(*iter)->trackParameters()->position(); @@ -522,7 +528,7 @@ void Muon::MuonTGHitNtuple::fillFatras() const } } if (m_fhit_techn[m_nFHit]==3 || m_fhit_techn[m_nFHit]==13) { // csc hits - const MuonGM::CscReadoutElement* cscROE = m_muonMgr->getCscReadoutElement(dig_id); + const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(dig_id); if (cscROE){ const Amg::Vector3D stripposition=cscROE->surface(dig_id).transform().inverse()*cscROE->stripPos(dig_id); const Amg::Vector3D localhit=cscROE->surface(dig_id).transform().inverse()*(*iter)->trackParameters()->position(); @@ -537,7 +543,7 @@ void Muon::MuonTGHitNtuple::fillFatras() const } } -void Muon::MuonTGHitNtuple::fillRecNtuple(const TrackCollection* tracks ) const +void Muon::MuonTGHitNtuple::fillRecNtuple(const TrackCollection* tracks, const MuonGM::MuonDetectorManager* MuonDetMgr ) const { m_nRec = 0; @@ -622,7 +628,7 @@ void Muon::MuonTGHitNtuple::fillRecNtuple(const TrackCollection* tracks ) const m_hole_residual[m_nHole] = 10000.; for (int is=0; is < m_nSimHit; is++) { Identifier sim_id(m_sim_hit_id[is]); - if ( m_sim_hit_techn[is]==m_hole_techn[m_nHole] && layerMatch(sim_id,dig_id) ) { + if ( m_sim_hit_techn[is]==m_hole_techn[m_nHole] && layerMatch(sim_id,dig_id,MuonDetMgr) ) { m_hole_match[m_nHole] = is; m_sim_hole_match[is] = m_nHole; if (m_hole_techn[m_nHole]==0 && layer && holeLayer) m_hole_residual[m_nHole] = @@ -665,7 +671,7 @@ void Muon::MuonTGHitNtuple::fillRecNtuple(const TrackCollection* tracks ) const ATH_MSG_DEBUG("number of unmatched simHit, recHits, holes, in this event:" << unmatched_sim <<","<< unmatched_hit<<"," << unmatched_hole ); } -void Muon::MuonTGHitNtuple::fillSimNtuple() const +void Muon::MuonTGHitNtuple::fillSimNtuple(const MuonGM::MuonDetectorManager* MuonDetMgr) const { m_nSim = 0; const McEventCollection* McEventCollection = 0; @@ -770,7 +776,7 @@ void Muon::MuonTGHitNtuple::fillSimNtuple() const m_sim_hit_residual[m_nSimHit] = 10000.; if (peri) { // destination surface - const MuonGM::MdtReadoutElement* mdtROE = m_muonMgr->getMdtReadoutElement(iMdt); + const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(iMdt); if ( mdtROE ) { const Trk::TrackParameters* trPar = m_extrapolator->extrapolate(*peri,mdtROE->surface(iMdt), Trk::alongMomentum,false,Trk::muon) ; @@ -809,7 +815,7 @@ void Muon::MuonTGHitNtuple::fillSimNtuple() const m_sim_hit_residual[m_nSimHit] = 10000.; if (peri) { // destination surface - const MuonGM::RpcReadoutElement* rpcROE = m_muonMgr->getRpcReadoutElement(iRpc); + const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(iRpc); if ( rpcROE ) { const Trk::TrackParameters* trPar = m_extrapolator->extrapolate(*peri,rpcROE->surface(iRpc), Trk::alongMomentum,false,Trk::muon) ; @@ -843,7 +849,7 @@ void Muon::MuonTGHitNtuple::fillSimNtuple() const m_sim_hit_station_phi[m_nSimHit] = -1; //for (unsigned int i=0;i<3;i++) m_sim_hit_pos[m_nSimHit][i] = (*ci)->localPosition()[i]; //if (barcode>0) std::cout << "tgc sim hit time:position:dir:"<< iTgc<< ","<<(*ci)->globalTime()<<","<<(*ci)->localPosition()<<","<< (*ci)->localDireCos() << std::endl; - //const MuonGM::TgcReadoutElement* tgcROE = m_muonMgr->getTgcReadoutElement(iTgc); + //const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(iTgc); //if (tgcROE) std::cout << "number of gas gaps :"<<tgcROE->Ngasgaps()<< std::endl; //else std::cout << "tgc ROE not found!" << std::endl; @@ -884,7 +890,7 @@ void Muon::MuonTGHitNtuple::fillSimNtuple() const if(peri) { delete peri; peri = NULL; } } -void Muon::MuonTGHitNtuple::fillHoles(const TrackCollection* tracks) const +void Muon::MuonTGHitNtuple::fillHoles(const TrackCollection* tracks, const MuonGM::MuonDetectorManager* MuonDetMgr) const { if (!tracks) return; @@ -916,7 +922,7 @@ void Muon::MuonTGHitNtuple::fillHoles(const TrackCollection* tracks) const m_hole_station_phi[m_nHole] = m_muonIdHelperTool->mdtIdHelper().stationPhi(idh); for (int is=0; is < m_nSimHit; is++) { Identifier ids(m_sim_hit_id[is]); - if ( m_sim_hit_techn[is]==m_hole_techn[m_nHole] && layerMatch(ids,idh) ) { + if ( m_sim_hit_techn[is]==m_hole_techn[m_nHole] && layerMatch(ids,idh,MuonDetMgr) ) { m_hole_match[m_nHole] = is; m_sim_hole_match[is] = m_nHole; } @@ -986,7 +992,7 @@ void Muon::MuonTGHitNtuple::fillHoles(const TrackCollection* tracks) const } -const TrackCollection* Muon::MuonTGHitNtuple::holesFromSim() const +const TrackCollection* Muon::MuonTGHitNtuple::holesFromSim(const MuonGM::MuonDetectorManager* MuonDetMgr) const { TrackCollection* htracks = 0; @@ -1014,7 +1020,7 @@ const TrackCollection* Muon::MuonTGHitNtuple::holesFromSim() const if (m_sim_pdg[isim]<0) q=-q; Trk::Perigee* peri = new Trk::Perigee(pos,mom,q,origin); // get ordered sim layers - const std::vector<std::pair< const Trk::Layer*,std::vector<Identifier> > >* simLayers = getOrderedSimLayers(m_sim_index[isim],mom); + const std::vector<std::pair< const Trk::Layer*,std::vector<Identifier> > >* simLayers = getOrderedSimLayers(m_sim_index[isim],mom,MuonDetMgr); std::vector<std::pair< const Trk::Layer*,std::vector<Identifier> > >::const_iterator sIter = simLayers->begin(); DataVector<const Trk::TrackStateOnSurface>* holes= new DataVector<const Trk::TrackStateOnSurface>; @@ -1120,7 +1126,7 @@ const Trk::TrackStateOnSurface* Muon::MuonTGHitNtuple::createHole(const Trk::Tra return hole; } -bool Muon::MuonTGHitNtuple::layerMatch(Identifier id1, Identifier id2) const +bool Muon::MuonTGHitNtuple::layerMatch(Identifier id1, Identifier id2, const MuonGM::MuonDetectorManager* MuonDetMgr) const { if ( m_muonIdHelperTool->mdtIdHelper().stationName(id1) == m_muonIdHelperTool->mdtIdHelper().stationName(id2) && m_muonIdHelperTool->mdtIdHelper().stationEta(id1) == m_muonIdHelperTool->mdtIdHelper().stationEta(id2) @@ -1146,7 +1152,7 @@ bool Muon::MuonTGHitNtuple::layerMatch(Identifier id1, Identifier id2) const if ( m_muonIdHelperTool->tgcIdHelper().is_tgc(id1) == m_muonIdHelperTool->tgcIdHelper().is_tgc(id2) ) { if ( m_muonIdHelperTool->tgcIdHelper().gasGap(id1) == m_muonIdHelperTool->tgcIdHelper().gasGap(id2) && m_muonIdHelperTool->tgcIdHelper().isStrip(id1) == m_muonIdHelperTool->tgcIdHelper().isStrip(id2) - && m_muonMgr->getTgcReadoutElement(id1) == m_muonMgr->getTgcReadoutElement(id2) ) + && MuonDetMgr->getTgcReadoutElement(id1) == MuonDetMgr->getTgcReadoutElement(id2) ) return true; else return false; @@ -1155,7 +1161,8 @@ bool Muon::MuonTGHitNtuple::layerMatch(Identifier id1, Identifier id2) const return false; } -const std::vector<std::pair<const Trk::Layer*,std::vector<Identifier> > >* Muon::MuonTGHitNtuple::getOrderedSimLayers(int index, Amg::Vector3D mom) const +const std::vector<std::pair<const Trk::Layer*,std::vector<Identifier> > >* Muon::MuonTGHitNtuple::getOrderedSimLayers(int index, Amg::Vector3D mom, + const MuonGM::MuonDetectorManager* MuonDetMgr) const { const std::vector<std::pair<const Trk::Layer*,std::vector<Identifier> > >* simLayers = 0; @@ -1168,7 +1175,7 @@ const std::vector<std::pair<const Trk::Layer*,std::vector<Identifier> > >* Muon: if (m_muonIdHelperTool->mdtIdHelper().is_mdt(ids)) { //Get the MdtReadoutElement and the tube position from it - const MuonGM::MdtReadoutElement* mdtROE = m_muonMgr->getMdtReadoutElement(ids); + const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(ids); Amg::Vector3D pos = mdtROE->tubePos(ids); // associated MTG layer const Trk::Layer* lay = m_trackingGeometry->associatedLayer(pos); @@ -1194,7 +1201,7 @@ const std::vector<std::pair<const Trk::Layer*,std::vector<Identifier> > >* Muon: if (m_muonIdHelperTool->rpcIdHelper().is_rpc(ids)) { //Get the RpcReadoutElement and the strip position from it - const MuonGM::RpcReadoutElement* rpcROE = m_muonMgr->getRpcReadoutElement(ids); + const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(ids); Amg::Vector3D pos = rpcROE->stripPos(ids); // associated MTG layer const Trk::Layer* lay = m_trackingGeometry->associatedLayer(pos); @@ -1220,7 +1227,7 @@ const std::vector<std::pair<const Trk::Layer*,std::vector<Identifier> > >* Muon: if (m_muonIdHelperTool->tgcIdHelper().is_tgc(ids)) { //Get the TgcReadoutElement and the strip position from it - const MuonGM::TgcReadoutElement* tgcROE = m_muonMgr->getTgcReadoutElement(ids); + const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(ids); Amg::Vector3D pos = tgcROE->channelPos(ids); // associated MTG layer const Trk::Layer* lay = m_trackingGeometry->associatedLayer(pos); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGMeasurementTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGMeasurementTool.cxx index 65a1d41a4cf37282c2d4fa4f0f22752c6422b09b..d8b0a287540aea0300fcd96dd73223beea272d1e 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGMeasurementTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonTGMeasurementTool.cxx @@ -45,6 +45,7 @@ #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "MuonReadoutGeometry/CscReadoutElement.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonPrepRawData/MdtPrepData.h" #include "MuonPrepRawData/RpcPrepData.h" #include "MuonPrepRawData/CscPrepData.h" @@ -80,7 +81,7 @@ StatusCode Muon::MuonTGMeasurementTool::initialize() ATH_MSG_INFO("MuonTGMeasurementTool::initialize()"); ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_CHECK( detStore()->retrieve(m_muonMgr) ); + ATH_CHECK(m_DetectorManagerKey.initialize()); // define projection matrices m_tgcProjEta = new AmgMatrix(5,5); @@ -253,6 +254,13 @@ const std::vector<const Trk::Segment*>* Muon::MuonTGMeasurementTool::getSegments const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk::Layer* lay, const Trk::TrackParameters* parm, Identifier id) const { + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + // return StatusCode::FAILURE; + } + // Get the messaging service, print where you are ATH_MSG_DEBUG("MuonTGMeasurementTool::layerToDetEl"); const Trk::TrackParameters* projPar = 0; @@ -296,7 +304,7 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: //std::cout << "layerToDetEl::hit type:" << hitType << std::endl; if ( hitType == 1) { - const MuonGM::MdtReadoutElement* mdtROE = m_muonMgr->getMdtReadoutElement(id); + const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(id); if (!mdtROE) { ATH_MSG_WARNING( name() << "MDT readout element not found"); return projPar; @@ -358,7 +366,7 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: if ( hitType == 2) { // - const MuonGM::RpcReadoutElement* rpcROE = m_muonMgr->getRpcReadoutElement(id); + const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(id); if (!rpcROE) return projPar; const Trk::PlaneSurface* stripSurf = dynamic_cast<const Trk::PlaneSurface*> (&(rpcROE->surface(id))); if (!stripSurf) return projPar; @@ -416,7 +424,7 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: if ( hitType == 3) { // local position of detEl - const MuonGM::CscReadoutElement* cscROE = m_muonMgr->getCscReadoutElement(id); + const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(id); if (!cscROE) { ATH_MSG_WARNING( name() << "CSC readout element not found"); return projPar; @@ -477,7 +485,7 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::layerToDetEl(const Trk: //const Amg::Vector2D locLay; // bool onSurface = lay->surfaceRepresentation().globalToLocal(parm->position(),locLay,locLay); // local position of detEl - const MuonGM::TgcReadoutElement* tgcROE = m_muonMgr->getTgcReadoutElement(id); + const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id); if (!tgcROE) { ATH_MSG_WARNING( name() << "TGC readout element not found"); return projPar; @@ -759,6 +767,12 @@ const Trk::TrackParameters* Muon::MuonTGMeasurementTool::detElToLayer(const Trk: const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Layer* lay, const Trk::TrackParameters* parm, const Trk::RIO_OnTrack* rio) const { + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + // return StatusCode::FAILURE; + } // Get the messaging service, print where you are ATH_MSG_DEBUG("MuonTGMeasurementTool::measToLayer"); const Trk::RIO_OnTrack* projRIO = 0; @@ -812,7 +826,7 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye double locLay = A_ND * rio->localParameters()[Trk::locR] + locWire[1]; // create (fake!) rio ( rio image on TG layer ) IdentifierHash idHash(0); - const MuonGM::MdtReadoutElement* mdtROE = m_muonMgr->getMdtReadoutElement(id); + const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(id); Amg::MatrixX* cov = new Amg::MatrixX(); *cov = A_ND*A_ND*rio->localCovariance(); Muon::MdtDriftCircleStatus status = Muon::MdtStatusDriftTime; @@ -840,7 +854,7 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye if ( m_muonIdHelperTool->rpcIdHelper().measuresPhi(id) ) locPos += sign*ref; else locPos *= zswap; // - const MuonGM::RpcReadoutElement* rpcROE = m_muonMgr->getRpcReadoutElement(id); + const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(id); const IdentifierHash idHash(0); std::vector<Identifier> rdoList; rdoList.push_back(id); @@ -882,7 +896,7 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye locPos = rio->localParameters()[Trk::locX]+locCorrLay[Trk::locY]+csc_shift[Trk::locY]; } // - const MuonGM::CscReadoutElement* cscROE = m_muonMgr->getCscReadoutElement(id); + const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(id); IdentifierHash idHash(0); std::vector<Identifier> rdoList; rdoList.push_back(id); @@ -912,7 +926,7 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye } */ // - const MuonGM::TgcReadoutElement* tgcROE = m_muonMgr->getTgcReadoutElement(id); + const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id); IdentifierHash idHash(0); std::vector<Identifier> rdoList; rdoList.push_back(id); @@ -939,6 +953,12 @@ const Trk::RIO_OnTrack* Muon::MuonTGMeasurementTool::measToLayer(const Trk::Laye const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay, const Trk::TrackParameters* parm, bool measPhi,double& pitch) const { + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + // return StatusCode::FAILURE; + } // Get the messaging service, print where you are ATH_MSG_DEBUG("MuonTGMeasurementTool::nearestDetEl"); Identifier nid(0); @@ -966,7 +986,7 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay } if ( hitType == 1) { - const MuonGM::MdtReadoutElement* mdtROE = m_muonMgr->getMdtReadoutElement(layId); + const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(layId); if (!mdtROE) return nid; int tMax = mdtROE->getNtubesperlayer(); // local position at layer @@ -1018,7 +1038,7 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay doubletPhi, m_muonIdHelperTool->rpcIdHelper().gasGap(layId), 1,1); - rpcROE = m_muonMgr->getRpcReadoutElement(refPhi1); + rpcROE = MuonDetMgr->getRpcReadoutElement(refPhi1); if (!rpcROE) return nid; if (!m_muonIdHelperTool->rpcIdHelper().valid(refPhi1)) return nid; int nStripPhi = rpcROE->Nstrips(1); @@ -1080,7 +1100,7 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay doubletPhi, m_muonIdHelperTool->rpcIdHelper().gasGap(layId), 0,1); - rpcROE = m_muonMgr->getRpcReadoutElement(refEta1); + rpcROE = MuonDetMgr->getRpcReadoutElement(refEta1); if (!rpcROE) return nid; if (!m_muonIdHelperTool->rpcIdHelper().valid(refEta1)) return nid; int nStrips = rpcROE->Nstrips(0); @@ -1144,7 +1164,7 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay const Trk::TrackParameters* refPar = layerToDetEl(lay,parm,refId); if (!refPar) return nid; // - const MuonGM::CscReadoutElement* cscROE = m_muonMgr->getCscReadoutElement(refId); + const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(refId); if (!cscROE) {delete refPar; return nid;} pitch = cscROE->StripPitch(measPhi); int nStrips = m_muonIdHelperTool->cscIdHelper().stripMax(refId); @@ -1197,7 +1217,7 @@ const Identifier Muon::MuonTGMeasurementTool::nearestDetEl(const Trk::Layer* lay const Trk::TrackParameters* refPar = layerToDetEl(lay,parm,refId); if (!refPar) return nid; // - const MuonGM::TgcReadoutElement* tgcROE = m_muonMgr->getTgcReadoutElement(layId); + const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(layId); if (!tgcROE) {delete refPar; return nid;} int nStrips = m_muonIdHelperTool->tgcIdHelper().channelMax(refId); @@ -1445,6 +1465,13 @@ double Muon::MuonTGMeasurementTool::residual( const Trk::Layer* layer, const Trk double Muon::MuonTGMeasurementTool::residual( const Trk::Layer* layer, const Trk::TrackParameters* layPar, Identifier id) const { + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + // return StatusCode::FAILURE; + } + double res = 10000.; if (!layer || !layPar || !id.get_identifier32().get_compact()) return res; @@ -1453,17 +1480,17 @@ double Muon::MuonTGMeasurementTool::residual( const Trk::Layer* layer, const Trk if (m_muonIdHelperTool->mdtIdHelper().is_mdt(id)) { res = detElPar->localPosition()[Trk::locR] ; } else if (m_muonIdHelperTool->rpcIdHelper().is_rpc(id)) { - const MuonGM::RpcReadoutElement* rpcROE = m_muonMgr->getRpcReadoutElement(id); + const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(id); if (rpcROE) res = detElPar->localPosition()[Trk::locX] - (detElPar->associatedSurface().transform().inverse()*(rpcROE->stripPos(id)))[Trk::locX]; } else if (m_muonIdHelperTool->cscIdHelper().is_csc(id)) { - const MuonGM::CscReadoutElement* cscROE = m_muonMgr->getCscReadoutElement(id); + const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(id); if (cscROE) res = detElPar->localPosition()[Trk::locX] - (detElPar->associatedSurface().transform().inverse()*(cscROE->stripPos(id)))[0]; } else if (m_muonIdHelperTool->tgcIdHelper().is_tgc(id)) { if ( m_muonIdHelperTool->tgcIdHelper().isStrip(id) && m_muonIdHelperTool->tgcIdHelper().gasGap(id)==2 && m_muonIdHelperTool->tgcIdHelper().gasGapMax(id)==3 ) { delete detElPar; return res; // no phi strips here } - const MuonGM::TgcReadoutElement* tgcROE = m_muonMgr->getTgcReadoutElement(id); + const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id); if (tgcROE) { Amg::Vector2D locPos; const Amg::Vector3D globPos = tgcROE->channelPos(id); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx index 5eac3180ca1756327ce085b580cb3a9f10aec90f..cc11e328847919239a2a22217a21feffc5b9bb6b 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx @@ -47,10 +47,7 @@ Muon::MuonTrackSummaryHelperTool::~MuonTrackSummaryHelperTool() StatusCode Muon::MuonTrackSummaryHelperTool::initialize() { - if ( detStore()->retrieve( m_detMgr ).isFailure() ) { - ATH_MSG_ERROR(" Cannot retrieve MuonDetDescrMgr "); - return StatusCode::FAILURE; - } + ATH_CHECK(m_DetectorManagerKey.initialize()); if( m_calculateCloseHits && !m_extrapolator.empty() ){ if (m_extrapolator.retrieve().isSuccess()){ @@ -163,6 +160,13 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track return; } + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + ATH_MSG_DEBUG("Adding detailed muon track summary"); ATH_MSG_DEBUG(track.info()); // loop over track and get chamber Identifiers @@ -388,7 +392,7 @@ void Muon::MuonTrackSummaryHelperTool::addDetailedTrackSummary( const Trk::Track if( isMdt && pars ) { double rDrift = fabs(meas->localParameters()[Trk::locR]); double rTrack = fabs(pars->parameters()[Trk::locR]); - double innerRadius = m_detMgr->getMdtReadoutElement(id)->innerTubeRadius(); + double innerRadius = MuonDetMgr->getMdtReadoutElement(id)->innerTubeRadius(); if( rTrack > rDrift && rTrack < innerRadius ) { ++proj.ndeltas; continue; @@ -434,12 +438,19 @@ void Muon::MuonTrackSummaryHelperTool::updateHoleContent( Trk::MuonTrackSummary: return; } + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + bool isCsc = m_idHelperTool->isCsc(chamberHitSummary.chamberId()); int neta = isCsc ? 4 : 2; int nphi = isCsc ? 4 : 2; if( m_idHelperTool->isTgc(chamberHitSummary.chamberId()) ){ - const MuonGM::TgcReadoutElement* detEl = m_detMgr->getTgcReadoutElement(chamberHitSummary.chamberId()); + const MuonGM::TgcReadoutElement* detEl = MuonDetMgr->getTgcReadoutElement(chamberHitSummary.chamberId()); if( !detEl ){ ATH_MSG_WARNING(" No detector element found for " << m_idHelperTool->toStringChamber(chamberHitSummary.chamberId()) ); return; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h index a182474f26695c8b4513232f0e62fdfbc18e9c1c..78cb549077ebe82c901c36e7a3827f0d0ca3041e 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h @@ -127,7 +127,9 @@ private: /** storegate key of MdtPrepDataContainer */ SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_mdtKey{this,"MdtPrepDataContainer","MDT_DriftCircles","MDT PRDs"}; - const MuonGM::MuonDetectorManager* m_detMgr{nullptr}; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; }; } #endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx index 9b1fb690475c9a434f9f6f0c9b97cd8d811a6ce1..7e21a13e33a16ad092993ec6c7a8357ab4c9e6e4 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx @@ -75,7 +75,6 @@ std::string chamber(int istation, int zsec, int phi) { Csc2dSegmentMaker:: Csc2dSegmentMaker(const std::string& type, const std::string& aname, const IInterface* parent) : AthAlgTool(type, aname, parent), - m_pgm(0), m_phelper(0), m_segmentTool("CscSegmentUtilTool/CscSegmentUtilTool", this), m_cscClusterOnTrackCreator("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator", this), m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), @@ -106,13 +105,7 @@ StatusCode Csc2dSegmentMaker::initialize(){ ATH_MSG_DEBUG ( " SegmentTool: " << m_segmentTool.typeAndName() ); ATH_MSG_DEBUG ( " Input cscdig key: " << m_cscdig_sg_inkey ); - // Retrieve the detector descriptor. - if ( detStore()->retrieve(m_pgm).isFailure() ) { - ATH_MSG_FATAL ( " Cannot retrieve MuonReadoutGeometry " ); - return StatusCode::FAILURE; - } - - m_phelper = m_pgm->cscIdHelper(); + ATH_CHECK(m_idHelperSvc.retrieve()); if ( m_segmentTool.retrieve().isFailure() ) { ATH_MSG_ERROR ( "Unable to retrieve CscSegmentUtilTool " << m_segmentTool ); @@ -222,10 +215,10 @@ MuonSegmentCombination* Csc2dSegmentMaker::findSegmentCombination(const CscPrepD //ATH_MSG_DEBUG("get hashes for "<<detEl->maxNumberOfStrips(iPhi)<<" strips "); for(int iStrip=0;iStrip<detEl->maxNumberOfStrips(iPhi);iStrip++){ ATH_MSG_DEBUG("get strip quality for "<<isPhi<<" layer "<<iLay<<" strip "<<iStrip); - Identifier stripId=m_phelper->channelID(redName,stationEta,stationPhi,chamberLayer,iLay+1,iPhi,iStrip+1); - //ATH_MSG_DEBUG("just-constructed id corresponds to chamberLayer "<<m_phelper->chamberLayer(stripId)<<", wire layer "<<m_phelper->wireLayer(stripId)<<", strip "<<m_phelper->strip(stripId)); + Identifier stripId=m_idHelperSvc->cscIdHelper().channelID(redName,stationEta,stationPhi,chamberLayer,iLay+1,iPhi,iStrip+1); + //ATH_MSG_DEBUG("just-constructed id corresponds to chamberLayer "<<m_idHelperSvc->cscIdHelper().chamberLayer(stripId)<<", wire layer "<<m_idHelperSvc->cscIdHelper().wireLayer(stripId)<<", strip "<<m_idHelperSvc->cscIdHelper().strip(stripId)); IdentifierHash hashID; - m_phelper->get_channel_hash(stripId,hashID); + m_idHelperSvc->cscIdHelper().get_channel_hash(stripId,hashID); //ATH_MSG_DEBUG("get strip status with hash "<<hashID); if(!m_segmentTool->isGood(hashID)){ ATH_MSG_DEBUG("bad strip"); @@ -243,11 +236,11 @@ MuonSegmentCombination* Csc2dSegmentMaker::findSegmentCombination(const CscPrepD for ( CscPrepDataCollection::const_iterator iclu=clus.begin(); iclu!=clus.end(); ++iclu ) { const CscPrepData* pclu = *iclu; Identifier id = pclu->identify(); - int station = m_phelper->stationName(id) - 49; - int eta = m_phelper->stationEta(id); - int phisec = m_phelper->stationPhi(id); - int iwlay = m_phelper->wireLayer(id); - bool measphi = m_phelper->measuresPhi(id); + int station = m_idHelperSvc->cscIdHelper().stationName(id) - 49; + int eta = m_idHelperSvc->cscIdHelper().stationEta(id); + int phisec = m_idHelperSvc->cscIdHelper().stationPhi(id); + int iwlay = m_idHelperSvc->cscIdHelper().wireLayer(id); + bool measphi = m_idHelperSvc->cscIdHelper().measuresPhi(id); if ( iclu == clus.begin() ) { col_station = station; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h index 518136f6a84f079f1dd53b8032cb8d279ef7df55..3eaae8e34293d8fb2762885a0f65cd7326094287 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h @@ -16,6 +16,7 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" // separately... #include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "Identifier/Identifier.h" #include "CscSegmentMakers/ICscSegmentFinder.h" //#include "MuonCondInterface/CscICoolStrSvc.h" @@ -27,9 +28,6 @@ class ICscStripFitter; class ICscSegmentUtilTool; class ICSCConditionsSvc; -namespace MuonGM { - class MuonDetectorManager; -} namespace Muon { class IMuonClusterOnTrackCreator; @@ -70,13 +68,10 @@ private: // methods private: // data - // Pointer muon geometry manager. - const MuonGM::MuonDetectorManager* m_pgm; - // Output container. // MuonSegmentCombinationCollection* m_psegs; - const CscIdHelper* m_phelper; - + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + std::string m_cscdig_sg_inkey; ToolHandle<ICscSegmentUtilTool> m_segmentTool; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.cxx index 2998fd6f6117a2a0e6db54138f60839c65d70d4e..20060cefeb6aa96374b32fcea12a0cf70df0ec32 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.cxx @@ -58,7 +58,7 @@ using Muon::MdtDriftCircleOnTrack; Csc4dSegmentMaker:: Csc4dSegmentMaker(const std::string& type, const std::string& aname, const IInterface* parent) : AthAlgTool(type, aname, parent), - m_dumped(0), m_dump(false), m_pgm(0), m_phelper(0), + m_dumped(0), m_dump(false), m_segmentTool("CscSegmentUtilTool/CscSegmentUtilTool"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool") { @@ -93,15 +93,6 @@ StatusCode Csc4dSegmentMaker::initialize(){ ATH_MSG_DEBUG ( " Max segments/chamber: " << m_max_seg_per_chamber ); ATH_MSG_DEBUG ( " SegmentTool: " << m_segmentTool.typeAndName() ); - // Retrieve the detector descriptor. - if ( detStore()->retrieve(m_pgm).isFailure() ) { - ATH_MSG_FATAL ( " Cannot retrieve MuonReadoutGeometry " ); - return StatusCode::FAILURE; - } - - m_phelper = m_pgm->cscIdHelper(); - - if ( m_segmentTool.retrieve().isFailure() ) { ATH_MSG_ERROR ( "Unable to retrieve CscSegmentUtilTool " << m_segmentTool ); return StatusCode::FAILURE; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.h index d146d935f25b1d50cb51deb5d08a1d0686afa25c..7e2602a938ed9f948196b5d923495cb961c9ff92 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc4dSegmentMaker.h @@ -14,6 +14,7 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "Identifier/Identifier.h" #include "CscSegmentMakers/ICscSegmentFinder.h" //including MuonSegmentCombination(Collection).h CscPrepDataContainer.h" @@ -21,10 +22,6 @@ class ICscSegmentUtilTool; -namespace MuonGM { - class MuonDetectorManager; -} - namespace Track { class TrackRaod; class RIO_OnTrack; @@ -69,10 +66,6 @@ private: // data double m_max_slope_phi; double m_max_seg_per_chamber; - // Pointer muon geometry manager. - const MuonGM::MuonDetectorManager* m_pgm; - const CscIdHelper* m_phelper; - ToolHandle<ICscSegmentUtilTool> m_segmentTool; ToolHandle<Muon::MuonEDMPrinterTool> m_printer; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx index 649c3c67b44bf42ba8c4404d4474f7b1b709be95..97821d31fd4ed86eba38e7bf210fc071e616627d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "CscSegmentUtilTool.h" @@ -95,7 +95,7 @@ namespace { // Constructor. CscSegmentUtilTool::CscSegmentUtilTool (const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type,name,parent), m_gm(0), m_phelper(0), + : AthAlgTool(type,name,parent), m_rotCreator("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator"), m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_cscCoolStrSvc("MuonCalib::CscCoolStrSvc", name) @@ -155,13 +155,6 @@ StatusCode CscSegmentUtilTool::initialize() if (m_x5data) ATH_MSG_DEBUG (" Things for X5Data analysis is applied such as alignment "); - if (detStore()->retrieve(m_gm).isFailure() ) { - ATH_MSG_WARNING ( " Cannot retrieve MuonReadoutGeometry " ); - return StatusCode::SUCCESS; - } - - m_phelper = m_gm->cscIdHelper(); - if ( m_rotCreator.retrieve().isFailure() ) { ATH_MSG_ERROR ( "Could not get " << m_rotCreator ); return StatusCode::FAILURE; @@ -179,6 +172,10 @@ StatusCode CscSegmentUtilTool::initialize() return StatusCode::FAILURE; } + ATH_CHECK(m_DetectorManagerKey.initialize()); + + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_eventInfo.initialize()); return StatusCode::SUCCESS; @@ -343,11 +340,11 @@ fit_detailCalcPart1(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vecto const CscPrepData* prd = clu->prepRawData(); Identifier id = clu->identify(); - measphi = m_phelper->measuresPhi(id); + measphi = m_idHelperSvc->cscIdHelper().measuresPhi(id); // Cluster position. double y = cl.locY(); if (m_x5data) { - y = y - alignConst(measphi, m_phelper->wireLayer(id)); + y = y - alignConst(measphi, m_idHelperSvc->cscIdHelper().wireLayer(id)); } double x = cl.locX(); @@ -413,11 +410,11 @@ fit_detailCalcPart1(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vecto const CscPrepData* prd = clu->prepRawData(); Identifier id = clu->identify(); - measphi = m_phelper->measuresPhi(id); + measphi = m_idHelperSvc->cscIdHelper().measuresPhi(id); // Cluster position. double y = cl.locY(); if (m_x5data) { - y = y - alignConst(measphi, m_phelper->wireLayer(id)); + y = y - alignConst(measphi, m_idHelperSvc->cscIdHelper().wireLayer(id)); } double x = cl.locX(); @@ -571,7 +568,6 @@ void CscSegmentUtilTool:: fit_residual(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lpos000, unsigned int irclu, double& res, double& dres) const { ATH_MSG_DEBUG ( "CscSegmentUtilTool::fit_residual called " ); - // const CscIdHelper* phelper = m_gm->cscIdHelper(); ICscSegmentFinder::TrkClusters fitclus; for ( unsigned int iclu=0; iclu<clus.size(); ++iclu ) { @@ -588,7 +584,7 @@ fit_residual(const ICscSegmentFinder::TrkClusters& clus, const Amg::Vector3D& lp double y = clus[irclu].locY(); if (m_x5data) { const Identifier& id = cot->identify(); - y = y - alignConst(m_phelper->measuresPhi(id), m_phelper->wireLayer(id)); + y = y - alignConst(m_idHelperSvc->cscIdHelper().measuresPhi(id), m_idHelperSvc->cscIdHelper().wireLayer(id)); } double x = clus[irclu].locX(); // Error in cluster position. @@ -635,7 +631,6 @@ fit_rio_segment(const Trk::PlaneSurface& ssrf, bool /*dump*/, double& d0, double& d1, double& d01, double& chsq, double& zshift) const { ATH_MSG_DEBUG ( "CscSegmentUtilTool::fit_rio_segment called: " ); - // const CscIdHelper* phelper = m_gm->cscIdHelper(); // measure zshift @@ -649,7 +644,7 @@ fit_rio_segment(const Trk::PlaneSurface& ssrf, bool /*dump*/, const Trk::LocalParameters& msmt = rio.localParameters(); double y = msmt[iloc]; if (m_x5data) { - y = y - alignConst(m_phelper->measuresPhi(rio.identify()), m_phelper->wireLayer(rio.identify())); + y = y - alignConst(m_idHelperSvc->cscIdHelper().measuresPhi(rio.identify()), m_idHelperSvc->cscIdHelper().wireLayer(rio.identify())); } // Fetch the measurement error. const Amg::MatrixX& cov = rio.localCovariance(); @@ -692,7 +687,7 @@ fit_rio_segment(const Trk::PlaneSurface& ssrf, bool /*dump*/, const Trk::LocalParameters& msmt = rio.localParameters(); double y = msmt[iloc]; if (m_x5data) { - y = y - alignConst(m_phelper->measuresPhi(rio.identify()), m_phelper->wireLayer(rio.identify())); + y = y - alignConst(m_idHelperSvc->cscIdHelper().measuresPhi(rio.identify()), m_idHelperSvc->cscIdHelper().wireLayer(rio.identify())); } // Fetch the measurement error. // Fetch the measurement error. @@ -741,7 +736,6 @@ fit_rio_residual(const Trk::PlaneSurface& ssrf, bool dump, ) const { ATH_MSG_DEBUG ( "CscSegmentUtilTool::fit_rio_segment called " ); - // const CscIdHelper* phelper = m_gm->cscIdHelper(); ICscSegmentFinder::RioList fitrios; ICscSegmentFinder::RioList fitrios3pt; @@ -763,7 +757,7 @@ fit_rio_residual(const Trk::PlaneSurface& ssrf, bool dump, const Trk::LocalParameters& msmt = rio.localParameters(); double y = msmt[iloc]; if (m_x5data) { - y = y - alignConst(m_phelper->measuresPhi(rio.identify()), m_phelper->wireLayer(rio.identify())); + y = y - alignConst(m_idHelperSvc->cscIdHelper().measuresPhi(rio.identify()), m_idHelperSvc->cscIdHelper().wireLayer(rio.identify())); } const Amg::MatrixX& cov = rio.localCovariance(); int dim = cov.rows(); @@ -879,7 +873,6 @@ spoiled_count(const ICscSegmentFinder::RioList& rios, int& nspoil, int& nunspoil nspoil = 0; nunspoil = 0; spoilmap =0; - // const CscIdHelper* phelper = m_gm->cscIdHelper(); for ( ICscSegmentFinder::RioList::const_iterator irio=rios.begin(); irio!=rios.end(); ++irio ) { @@ -888,7 +881,7 @@ spoiled_count(const ICscSegmentFinder::RioList& rios, int& nspoil, int& nunspoil if (pclu) { if ( IsUnspoiled ( pclu->status()) ) ++nunspoil; else { - int wlay = m_phelper->wireLayer(pclu->identify()); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(pclu->identify()); ++nspoil; spoilmap += int(std::pow(2,wlay-1)); } @@ -927,7 +920,13 @@ build_segment(const ICscSegmentFinder::Segment& seg, bool measphi, Identifier ch const double pi = acos(-1.0); const double pi2 = 0.5*pi; - const CscReadoutElement* pro = m_gm->getCscReadoutElement(chid); + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return nullptr; + } + const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(chid); Amg::Transform3D gToLocal = pro->GlobalToAmdbLRSTransform(); Amg::Vector3D lpos000 = gToLocal*Amg::Vector3D(0.0, 0.0, 0.0); Amg::Transform3D lToGlobal = gToLocal.inverse(); @@ -1361,15 +1360,15 @@ void CscSegmentUtilTool::add_2dsegments(ICscSegmentFinder::Segments &segs4, ICsc iiseg++; const Muon::CscClusterOnTrack* cot = iseg->clus[0].cl; Identifier id = cot->identify(); - if(!m_phelper->measuresPhi(id) && iseg->nunspoil < m_nunspoil) { + if(!m_idHelperSvc->cscIdHelper().measuresPhi(id) && iseg->nunspoil < m_nunspoil) { ATH_MSG_DEBUG(" seg4 eta segment rejected with nclusters too few unspoiled hits " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil); isegs4OK[iiseg] = 0; } if( isegs4OK[iiseg] == 1 && segs4.size()< m_max_seg_per_chamber ) { segs4.push_back(*iseg); - ATH_MSG_DEBUG(" seg4 segment accepted with nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " measuresPhi " << m_phelper->measuresPhi(id) ); + ATH_MSG_DEBUG(" seg4 segment accepted with nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " measuresPhi " << m_idHelperSvc->cscIdHelper().measuresPhi(id) ); } else { - ATH_MSG_DEBUG(" seg4 segment rejected with nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " measuresPhi " << m_phelper->measuresPhi(id) ) ; + ATH_MSG_DEBUG(" seg4 segment rejected with nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " measuresPhi " << m_idHelperSvc->cscIdHelper().measuresPhi(id) ) ; } } int segs4Size = segs4.size(); @@ -1425,15 +1424,15 @@ void CscSegmentUtilTool::add_2dsegments(ICscSegmentFinder::Segments &segs4, ICsc iiseg++; const Muon::CscClusterOnTrack* cot = iseg->clus[0].cl; Identifier id = cot->identify(); - if(!m_phelper->measuresPhi(id) && iseg->nunspoil < m_nunspoil) { + if(!m_idHelperSvc->cscIdHelper().measuresPhi(id) && iseg->nunspoil < m_nunspoil) { ATH_MSG_DEBUG(" seg3 eta segment rejected with nclusters too few unspoiled hits " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil); isegs3OK[iiseg] = 0; } if( isegs3OK[iiseg] == 1 && segs4.size()< m_max_seg_per_chamber ) { segs4.push_back(*iseg); - ATH_MSG_DEBUG(" seg3 segment accepted with nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " measuresPhi " << m_phelper->measuresPhi(id) ); + ATH_MSG_DEBUG(" seg3 segment accepted with nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " measuresPhi " << m_idHelperSvc->cscIdHelper().measuresPhi(id) ); } else { - ATH_MSG_DEBUG(" seg3 segment rejected with nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " measuresPhi " << m_phelper->measuresPhi(id) ) ; + ATH_MSG_DEBUG(" seg3 segment rejected with nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " measuresPhi " << m_idHelperSvc->cscIdHelper().measuresPhi(id) ) ; } } ATH_MSG_DEBUG(" Total seg3 segment size " << segs4.size() - segs4Size ); @@ -1522,7 +1521,7 @@ void CscSegmentUtilTool::add_2dseg2hits(ICscSegmentFinder::Segments &segs, ICscS if(isegs2OK[iiseg2]==0) continue; //already rejected this segment for (int iclus=0; iclus<iseg->nclus; iclus++) { const Muon::CscClusterOnTrack* cot = iseg->clus[iclus].cl; - int wlay=m_phelper->wireLayer(cot->identify()); + int wlay=m_idHelperSvc->cscIdHelper().wireLayer(cot->identify()); if((layStat%(int)pow(10,wlay+1))/(int)pow(10,wlay)==1){ //this 3-layer segment has a hit in a bad layer: dump it nhits_common=-1; break; @@ -1550,9 +1549,9 @@ void CscSegmentUtilTool::add_2dseg2hits(ICscSegmentFinder::Segments &segs, ICscS Identifier id = cot->identify(); if( isegs2OK[iiseg] == 1 && segs.size()< m_max_seg_per_chamber ) { segs.push_back(*iseg); - ATH_MSG_DEBUG(" seg2 accepted, nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " mPhi " << m_phelper->measuresPhi(id) ); + ATH_MSG_DEBUG(" seg2 accepted, nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " mPhi " << m_idHelperSvc->cscIdHelper().measuresPhi(id) ); } else { - ATH_MSG_DEBUG(" seg2 rejected, nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " mPhi " << m_phelper->measuresPhi(id) ) ; + ATH_MSG_DEBUG(" seg2 rejected, nclusters " << iseg->nclus << " chi2 " << iseg->chsq << " unspoiled " << iseg->nunspoil << " mPhi " << m_idHelperSvc->cscIdHelper().measuresPhi(id) ) ; } } ATH_MSG_DEBUG(" Total seg2 accepted: " << segs.size() ); @@ -1948,7 +1947,6 @@ make_4dMuonSegment(const MuonSegment& rsg, const MuonSegment& psg, bool use2LayS ATH_MSG_DEBUG("make_4dMuonSegment called"); // if(use2LaySegs) std::cout<<"make 4d segment"<<std::endl; - // const CscIdHelper* phelper = m_gm->cscIdHelper(); double rpos = rsg.localParameters()[Trk::locX]; double rdir = rsg.localDirection().angleXZ(); @@ -2059,8 +2057,8 @@ make_4dMuonSegment(const MuonSegment& rsg, const MuonSegment& psg, bool use2LayS // ECC figure out wire layer. Identifier id_eta = etapold->identify(); Identifier id_phi = phipold->identify(); - int iw_eta = m_phelper->wireLayer(id_eta); - int iw_phi = m_phelper->wireLayer(id_phi); + int iw_eta = m_idHelperSvc->cscIdHelper().wireLayer(id_eta); + int iw_phi = m_idHelperSvc->cscIdHelper().wireLayer(id_phi); // Check to see if these are the same layers. // if(use2LaySegs) std::cout<<" id_eta: " << m_idHelper->toString(id_eta) << " " <<" id_phi: " << m_idHelper->toString(id_phi)<<std::endl; @@ -2250,12 +2248,11 @@ get2dSegments( Identifier eta_id, Identifier phi_id, ATH_MSG_WARNING("in get2dSegments: got two invalid identifiers" ); return; } - // const CscIdHelper* phelper = m_gm->cscIdHelper(); // check whether Id is valid Identifier chId = eta_id.is_valid() ? eta_id : phi_id; - int col_station = m_phelper->stationName(chId) - 49; - int col_eta = m_phelper->stationEta(chId); - int col_phisec = m_phelper->stationPhi(chId); + int col_station = m_idHelperSvc->cscIdHelper().stationName(chId) - 49; + int col_eta = m_idHelperSvc->cscIdHelper().stationEta(chId); + int col_phisec = m_idHelperSvc->cscIdHelper().stationPhi(chId); ATH_MSG_DEBUG ( "get2dSegments called " << eta_id << " " << phi_id << " " << col_station << " " << col_eta << " " << col_phisec << " " @@ -2390,7 +2387,13 @@ double CscSegmentUtilTool:: getDefaultError (Identifier id, bool measphi, const CscPrepData *prd ) const { const std::vector<Identifier>& strip_ids = prd->rdoList(); unsigned int nstrip = strip_ids.size(); - const CscReadoutElement* pro = m_gm->getCscReadoutElement(id); + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return 0.; + } + const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(id); double pitch = pro->cathodeReadoutPitch(0, measphi); // Assign position error. double wmeas = pitch*nstrip; @@ -2405,8 +2408,6 @@ getDefaultError (Identifier id, bool measphi, const CscPrepData *prd ) const { double CscSegmentUtilTool:: matchLikelihood(const MuonSegment& rsg, const MuonSegment& psg) const { - // const CscIdHelper* phelper = m_gm->cscIdHelper(); - // Loop over eta and phi segments. const ICscSegmentFinder::RioList& etarios = rsg.containedROTs(); const ICscSegmentFinder::RioList& phirios = psg.containedROTs(); @@ -2442,8 +2443,8 @@ matchLikelihood(const MuonSegment& rsg, const MuonSegment& psg) const { // Figure out the layer for each view Identifier eta_sid = eta_prd->identify(); Identifier phi_sid = phi_prd->identify(); - int eta_wlay = m_phelper->wireLayer(eta_sid); - int phi_wlay = m_phelper->wireLayer(phi_sid); + int eta_wlay = m_idHelperSvc->cscIdHelper().wireLayer(eta_sid); + int phi_wlay = m_idHelperSvc->cscIdHelper().wireLayer(phi_sid); // Calculate the charge ratio for same eta & phi layers if (eta_wlay == phi_wlay) { diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h index b4d10378cc06f1a1a92a8e4b77143cbc926c44b4..9be71d07aec75c10d0d86e3e095a04709a48dd32 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h @@ -10,6 +10,8 @@ #include <vector> #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" // separately... +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRIO_OnTrack/CscClusterOnTrack.h" #include "CscSegmentMakers/ICscSegmentUtilTool.h" #include "CscClusterization/ICscClusterUtilTool.h" @@ -93,8 +95,7 @@ public: private: // data - const MuonGM::MuonDetectorManager* m_gm; - const CscIdHelper* m_phelper; + double m_max_chisquare_tight; double m_max_chisquare_loose; double m_max_chisquare; @@ -119,9 +120,14 @@ private: // data ToolHandle<Muon::MuonIdHelperTool> m_idHelper; ServiceHandle<MuonCalib::CscICoolStrSvc> m_cscCoolStrSvc; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this,"EventInfo","EventInfo","event info"}; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + // Convert a local 2D segment to MuonSegment Muon::MuonSegment* build_segment(const ICscSegmentFinder::Segment& seg, bool measphi, Identifier chid, bool use2Lay) const; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx index 776fb278a8cffe56231ce569fe6e2961ec34ce93..ce85bab95505672ee823eae2617d2434d64f85b2 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx @@ -76,7 +76,6 @@ namespace Muon { DCMathSegmentMaker::DCMathSegmentMaker( const std::string& t, const std::string& n, const IInterface* p ) : AthAlgTool(t,n,p), - m_detMgr(0), m_intersectSvc("MuonStationIntersectSvc", name()), m_mdtCreator("Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator", this), m_mdtCreatorT0("Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator", this), @@ -145,7 +144,7 @@ namespace Muon { { // retrieve MuonDetectorManager - ATH_CHECK( detStore()->retrieve(m_detMgr,"Muon") ); + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_intersectSvc.retrieve() ); ATH_CHECK( m_mdtCreator.retrieve() ); ATH_CHECK( m_mdtCreatorT0.retrieve() ); @@ -1636,8 +1635,15 @@ namespace Muon { int isSmallMdt = m_idHelperTool->mdtIdHelper().isSmallMdt(chid); TrkDriftCircleMath::MdtStationId stationId( isSmallMdt, isBarrel, name, eta, phi ); + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + // return 0; + } + // get detEL for first ml (always there) - const MuonGM::MdtReadoutElement* detEl1 = m_detMgr->getMdtReadoutElement( m_idHelperTool->mdtIdHelper().channelID( name,eta,phi,1,1,1 ) ); + const MuonGM::MdtReadoutElement* detEl1 = MuonDetMgr->getMdtReadoutElement( m_idHelperTool->mdtIdHelper().channelID( name,eta,phi,1,1,1 ) ); const MuonGM::MdtReadoutElement* detEl2 = 0; int ntube2 = 0; // number of multilayers in chamber @@ -1646,7 +1652,7 @@ namespace Muon { // treament of chambers with two ml if( nml == 2 ){ Identifier firstIdml1 = m_idHelperTool->mdtIdHelper().channelID( name,eta,phi,2,1,1 ); - detEl2 = m_detMgr->getMdtReadoutElement( firstIdml1 ); + detEl2 = MuonDetMgr->getMdtReadoutElement( firstIdml1 ); firstTubeMl1 = gToStation*(detEl2->surface( firstIdml1 ).center()); ntube2 = detEl2->getNtubesperlayer(); } @@ -2294,7 +2300,15 @@ namespace Muon { dbData=readHandle.cptr(); } else dbData=nullptr; //for online running - const MuonStationIntersect intersect = m_intersectSvc->tubesCrossedByTrack(chid, gpos, gdir, dbData, m_detMgr ); + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + // return 0; + } + + const MuonStationIntersect intersect = m_intersectSvc->tubesCrossedByTrack(chid, gpos, gdir, dbData, MuonDetMgr ); // set to identify the hit on the segment @@ -2341,7 +2355,7 @@ namespace Muon { bool notBetweenHits = layer < firstLayer || layer > lastLayer; double distanceCut = hasMeasuredCoordinate ? -20 : -200.; - double innerRadius = m_detMgr->getMdtReadoutElement(id)->innerTubeRadius(); + double innerRadius = MuonDetMgr->getMdtReadoutElement(id)->innerTubeRadius(); if( notBetweenHits && ( fabs(tint.rIntersect) > innerRadius || (!m_allMdtHoles && tint.xIntersect > distanceCut) ) ) { if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " not counting tube: distance to wire " << tint.rIntersect << " dist to tube end " << tint.xIntersect << " " << m_idHelperTool->toString(tint.tubeId) << std::endl; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h index 856c6795f240eaebd3f8b76f0d67bccdd05e4674..6eee52c3525e0a16e33a49ea1304a8c8a3c258e4 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h @@ -396,7 +396,10 @@ class MdtDriftCircleOnTrack; /** pointers to IdHelpers */ - const MuonGM::MuonDetectorManager* m_detMgr; //<! pointer to detector manager + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + ServiceHandle<MuonStationIntersectSvc> m_intersectSvc; //<! pointer to hole search service ToolHandle<IMdtDriftCircleOnTrackCreator> m_mdtCreator; //<! mdt rio ontrack creator diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternCalibration.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternCalibration.h index f9291205327c7f63251bfd5aed7ea7942f16d297..88c141b8736a4ab8e7e58fc867289f4de83f760f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternCalibration.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternCalibration.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_MUONPATTERNCALIBRATION_H #define MUON_MUONPATTERNCALIBRATION_H @@ -40,10 +40,6 @@ class StoreGateSvc; class Identifier; -namespace MuonGM { - class MuonDetectorManager; -} - namespace Trk { class RIO_OnTrack; class PrepRawData; @@ -145,9 +141,6 @@ namespace Muon { StoreGateSvc* m_storeGate; //!< Pointer to store gate - const MuonGM::MuonDetectorManager* m_detMgr; - - MsgStream* m_log; //<! pointer to message stream bool m_debug; bool m_verbose; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h index 1a7c9202ad251378b7f27c0de540b47b963a3826..343dcd0367bfc5390c80085fd7a290be5fb4be43 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/MuonPatternSegmentMaker/MuonPatternSegmentMaker.h @@ -39,10 +39,6 @@ class StoreGateSvc; class Identifier; -namespace MuonGM { - class MuonDetectorManager; -} - namespace Trk { class RIO_OnTrack; class PrepRawData; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx index 86e1d08e3f3d37002f68e30cac09143e4894ebaa..e8be5ec4a153f7c6ac0ef31f65aa29cd02b806e6 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "MuonPatternSegmentMaker/MuonPatternCalibration.h" @@ -77,17 +77,6 @@ namespace Muon { StoreGateSvc* detStore=0; sc = serviceLocator()->service("DetectorStore", detStore); - if ( sc.isSuccess() ) { - sc = detStore->retrieve( m_detMgr ); - if ( sc.isFailure() ) { - *m_log << MSG::ERROR << " Cannot retrieve MuonDetDescrMgr " << endmsg; - } else { - *m_log << MSG::DEBUG << " Retrieved IdHelpers: (mdt, csc, rpc and tgc) " << endmsg; - } - } else { - *m_log << MSG::ERROR << " MuonDetDescrMgr not found in DetectorStore " << endmsg; - } - if( m_mdtCreator.retrieve().isSuccess() ){ *m_log<<MSG::DEBUG << "Retrieved " << m_mdtCreator << endmsg; }else{ diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx index 77dccf29dc6dcf689b9d744c19fd87a585c72a63..dba1cb4741562cd5ca691ed57e8e50db1889a8d6 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx @@ -23,7 +23,6 @@ #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "MuonReadoutGeometry/CscReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/MdtIdHelper.h" #include "MuonIdHelpers/RpcIdHelper.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.cxx index b2ca456802c54578866a16c11503f27ea122d012..a8f7e1cc1ec194091d44d13b1ec695e725148b1a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.cxx @@ -15,7 +15,6 @@ #include "MuonSegment/MuonSegmentQuality.h" #include <map> -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "StoreGate/StoreGateSvc.h" #include "MuonIdHelpers/MdtIdHelper.h" @@ -25,8 +24,7 @@ namespace Muon { MuonSegmentHitSummaryTool::MuonSegmentHitSummaryTool(const std::string& ty,const std::string& na,const IInterface* pa) : AthAlgTool(ty,na,pa), m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), - m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_detMgr(0) + m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool") { declareInterface<IMuonSegmentHitSummaryTool>(this); @@ -44,16 +42,7 @@ namespace Muon { return StatusCode::FAILURE; } - StoreGateSvc* detStore=0; - if( serviceLocator()->service("DetectorStore", detStore).isSuccess() ) { - if ( detStore->retrieve( m_detMgr ).isFailure() ) { - ATH_MSG_ERROR( " Cannot retrieve MuonDetDescrMgr "); - return StatusCode::FAILURE; - } - } else { - ATH_MSG_ERROR(" MuonDetDescrMgr not found in DetectorStore "); - return StatusCode::FAILURE; - } + ATH_CHECK(m_DetectorManagerKey.initialize()); if(m_edmHelperSvc.retrieve().isFailure()){ ATH_MSG_ERROR("Could not get " << m_edmHelperSvc); @@ -83,6 +72,12 @@ namespace Muon { HitCounts hitCounts; + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return hitCounts; + } // calculate shortest channel double shortestTube = 1e9; @@ -122,7 +117,7 @@ namespace Muon { const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(*mit); if( mdt ){ - const MuonGM::MdtReadoutElement* detEl = mdt->prepRawData() ? mdt->prepRawData()->detectorElement() : m_detMgr->getMdtReadoutElement(id); + const MuonGM::MdtReadoutElement* detEl = mdt->prepRawData() ? mdt->prepRawData()->detectorElement() : MuonDetMgr->getMdtReadoutElement(id); if( !detEl ){ ATH_MSG_WARNING(" could not get MdtReadoutElement for tube " << m_idHelperTool->toString(id)); continue; @@ -182,7 +177,7 @@ namespace Muon { ++layIntersect.nholes; if( transformIsSet ){ - const MuonGM::MdtReadoutElement* detEl = m_detMgr->getMdtReadoutElement(id); + const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(id); if( !detEl ){ ATH_MSG_WARNING(" could not get MdtReadoutElement for tube " << m_idHelperTool->toString(id)); continue; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.h index 76cb3b1b4e0ce8234ddded6f6d7846473cb36e2a..425c83debf0e10a7bd794101f4270c587ebf3734 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentHitSummaryTool.h @@ -13,6 +13,7 @@ #include "Identifier/Identifier.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" class MsgStream; @@ -25,10 +26,6 @@ namespace Muon { } -namespace MuonGM { - class MuonDetectorManager; -} - namespace Muon { @@ -59,7 +56,10 @@ namespace Muon { "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; //!< EDM Helper tool ToolHandle<Muon::MuonEDMPrinterTool> m_printer; //!< EDM printer tool - const MuonGM::MuonDetectorManager* m_detMgr; + + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; double m_positionAlongTubeCut; //!< cut on the distance from the tube wall use for hole count double m_lowerADCBound; //!< lower bound for good MDT hits diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.h index 094e4b22c13618d6a8453e18e2adbe4e577d9876..73ada4a72b4b010bd0b5b5db5e53de156b430a1f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentSelectionTools/src/MuonSegmentSelectionTool.h @@ -22,10 +22,6 @@ namespace Muon { class IMuonSegmentHitSummaryTool; } -namespace MuonGM { - class MuonDetectorManager; -} - namespace Muon { diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx index 888406e81299a870f51355aaf83a9fb4663763a4..c66547a0885cfe6325f53f16774a150ab76d92f3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx @@ -87,7 +87,7 @@ namespace Muon { StatusCode MuonChamberHoleRecoveryTool::initialize() { - ATH_CHECK( detStore()->retrieve( m_detMgr ) ); + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_edmHelperSvc.retrieve() ); ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_printer.retrieve() ); @@ -471,7 +471,14 @@ namespace Muon { std::set<Identifier>& layIds, std::vector< std::pair<bool, const Trk::TrackStateOnSurface* > >& states ) const { // get detector element - const MuonGM::sTgcReadoutElement* detEl = m_detMgr->getsTgcReadoutElement(detElId); + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + + const MuonGM::sTgcReadoutElement* detEl = MuonDetMgr->getsTgcReadoutElement(detElId); if ( !detEl ) { ATH_MSG_WARNING(" No detector element found for " << m_idHelperSvc->toStringChamber(detElId) ); return; @@ -541,7 +548,14 @@ namespace Muon { std::set<Identifier>& layIds, std::vector< std::pair<bool, const Trk::TrackStateOnSurface* > >& states ) const { // get detector element - const MuonGM::MMReadoutElement* detEl = m_detMgr->getMMReadoutElement(detElId); + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + + const MuonGM::MMReadoutElement* detEl = MuonDetMgr->getMMReadoutElement(detElId); if ( !detEl ) { ATH_MSG_WARNING(" No detector element found for " << m_idHelperSvc->toStringChamber(detElId) ); return; @@ -634,7 +648,14 @@ namespace Muon { std::vector< std::pair<bool, const Trk::TrackStateOnSurface* > >& states ) const { // get detector element - const MuonGM::TgcReadoutElement* detEl = m_detMgr->getTgcReadoutElement(detElId); + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + + const MuonGM::TgcReadoutElement* detEl = MuonDetMgr->getTgcReadoutElement(detElId); if ( !detEl ) { ATH_MSG_WARNING(" No detector element found for " << m_idHelperSvc->toStringChamber(detElId) ); return; @@ -686,7 +707,15 @@ namespace Muon { unsigned int nGasGaps = 2; LayerHoleVec holeVec = holesInClusterChamber( pars, detElId, layIds, nGasGaps ); if ( holeVec.empty() ) return; - const MuonGM::RpcReadoutElement* detEl = m_detMgr->getRpcReadoutElement(detElId); + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + + const MuonGM::RpcReadoutElement* detEl = MuonDetMgr->getRpcReadoutElement(detElId); if ( !detEl ) { ATH_MSG_WARNING("Could not find ReadoutElement for " << m_idHelperSvc->toString(detElId) ); return; @@ -755,14 +784,21 @@ namespace Muon { typedef std::map<Identifier, PullCluster> ClusterLayerMap; ClusterLayerMap clusterLayerMap; + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } const Trk::TrkDetElementBase* detEl = 0; - if ( m_idHelperSvc->isTgc(detElId) ) detEl = m_detMgr->getTgcReadoutElement(detElId); - else if ( m_idHelperSvc->isRpc(detElId) ) detEl = m_detMgr->getRpcReadoutElement(detElId); - else if ( m_idHelperSvc->isCsc(detElId) ) detEl = m_detMgr->getCscReadoutElement(detElId); + if ( m_idHelperSvc->isTgc(detElId) ) detEl = MuonDetMgr->getTgcReadoutElement(detElId); + else if ( m_idHelperSvc->isRpc(detElId) ) detEl = MuonDetMgr->getRpcReadoutElement(detElId); + else if ( m_idHelperSvc->isCsc(detElId) ) detEl = MuonDetMgr->getCscReadoutElement(detElId); // New Small Wheel - else if ( m_idHelperSvc->issTgc(detElId) ) detEl = m_detMgr->getsTgcReadoutElement(detElId); - else if ( m_idHelperSvc->isMM(detElId) ) detEl = m_detMgr->getMMReadoutElement(detElId); + else if ( m_idHelperSvc->issTgc(detElId) ) detEl = MuonDetMgr->getsTgcReadoutElement(detElId); + else if ( m_idHelperSvc->isMM(detElId) ) detEl = MuonDetMgr->getMMReadoutElement(detElId); unsigned int nNewHits = 0; // loop over prds @@ -894,13 +930,12 @@ namespace Muon { // if no detEl yet try retrieving if from the detMgr if ( !detEl ) { - if ( m_idHelperSvc->isTgc(id) ) detEl = m_detMgr->getTgcReadoutElement(id); - else if ( m_idHelperSvc->isRpc(id) ) detEl = m_detMgr->getRpcReadoutElement(id); - else if ( m_idHelperSvc->isCsc(id) ) detEl = m_detMgr->getCscReadoutElement(id); + if ( m_idHelperSvc->isTgc(id) ) detEl = MuonDetMgr->getTgcReadoutElement(id); + else if ( m_idHelperSvc->isRpc(id) ) detEl = MuonDetMgr->getRpcReadoutElement(id); + else if ( m_idHelperSvc->isCsc(id) ) detEl = MuonDetMgr->getCscReadoutElement(id); // New Small Wheel - else if ( m_idHelperSvc->issTgc(id) ) detEl = m_detMgr->getsTgcReadoutElement(id); - else if ( m_idHelperSvc->isMM(id) ) detEl = m_detMgr->getMMReadoutElement(id); - + else if ( m_idHelperSvc->issTgc(id) ) detEl = MuonDetMgr->getsTgcReadoutElement(id); + else if ( m_idHelperSvc->isMM(id) ) detEl = MuonDetMgr->getMMReadoutElement(id); if ( !detEl ) { ATH_MSG_DEBUG("No detector element found for " << m_idHelperSvc->toString(id) ); @@ -956,7 +991,13 @@ namespace Muon { const Trk::TrackParameters* parsLast, std::set<Identifier>& ids, std::vector< std::pair<bool, const Trk::TrackStateOnSurface* > >& states ) const { - + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + // return; + } + Amg::Vector3D direction = pars.momentum().unit(); // check whether we need to average the parameters @@ -1128,7 +1169,7 @@ namespace Muon { Identifier ch = m_idHelperSvc->chamberId(*hit); if ( ch != chIdentifier ) continue; - const MuonGM::MdtReadoutElement* detEl = m_detMgr->getMdtReadoutElement(*hit); + const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(*hit); const Trk::Surface& surf = detEl->surface(*hit); const Trk::TrackParameters* exPars = 0; @@ -1229,7 +1270,15 @@ namespace Muon { dbData=readHandle.cptr(); } else dbData=nullptr; //for online running - const MuonStationIntersect intersect = m_intersectSvc->tubesCrossedByTrack( chId, position, direction, dbData, m_detMgr ); + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + // return; + } + + const MuonStationIntersect intersect = m_intersectSvc->tubesCrossedByTrack( chId, position, direction, dbData, MuonDetMgr ); // clear hole vector std::set<Identifier> holes; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.h index 8d48723831cd88e492fa205183aeea1e0d3541a7..1c067f652868950d9b75e6168013a419344b7b1c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.h @@ -17,6 +17,7 @@ #include "TrkTrack/Track.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include <string> #include <set> @@ -30,20 +31,12 @@ class StoreGateSvc; class MdtCondDbData; class MuonStationIntersectSvc; -namespace MuonGM { - class MuonDetectorManager; -} - namespace Muon { class IMdtDriftCircleOnTrackCreator; class IMuonClusterOnTrackCreator; class MuonEDMPrinterTool; } -namespace MuonGM { - class MuonDetectorManager; -} - namespace Trk { class Track; class MagneticFieldProperties; @@ -187,7 +180,9 @@ namespace Muon { "Handle to the service providing the IMuonEDMHelperSvc interface" }; //!< EDM Helper tool ToolHandle<Muon::MuonEDMPrinterTool> m_printer; //!< EDM printer tool - const MuonGM::MuonDetectorManager* m_detMgr; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_key_mdt{this,"MdtPrepDataContainer","MDT_DriftCircles","MDT PRDs"}; SG::ReadHandleKey<Muon::CscPrepDataContainer> m_key_csc{this,"CscPrepDataContainer","CSC_Clusters","CSC PRDS"}; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx index a2ed115905fd5a1daf0c6f9885a970a9e364c3ca..7b711bb30c96371a3fe4c153ebd27697cf9c4147 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx @@ -19,7 +19,6 @@ #include <iostream> #include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/MdtIdHelper.h" @@ -68,7 +67,7 @@ namespace Muon { StatusCode MuonSeededSegmentFinder::initialize() { - ATH_CHECK( detStore()->retrieve( m_detMgr ) ); + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_segMaker.retrieve() ); ATH_CHECK( m_segMakerNoHoles.retrieve() ); ATH_CHECK( m_propagator.retrieve() ); @@ -172,6 +171,14 @@ namespace Muon { } std::vector<const MdtPrepData*> MuonSeededSegmentFinder::extractPrds( const std::set<Identifier>& chIds ) const { + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + // return; + } + // set of IdHashes corresponding to these identifiers std::set<IdentifierHash> chIdHs; @@ -185,7 +192,7 @@ namespace Muon { continue; } - const MuonGM::MdtReadoutElement* detEl = m_detMgr->getMdtReadoutElement(*chit); + const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(*chit); if ( !detEl ) { ATH_MSG_WARNING(" Requested chamber does not exist in geometry: " << m_idHelper->toStringChamber(*chit)); continue; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.h index a1a50796bbbc5b43093a133761397977cad7d0b5..690b03fa14ac08434ab60cdc7d98cf87bb3654ba 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.h @@ -17,6 +17,7 @@ #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonPrepRawData/MdtPrepDataCollection.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "TrkParameters/TrackParameters.h" @@ -45,10 +46,6 @@ class IMuonSegmentMaker; class MdtPrepData; } -namespace MuonGM { -class MuonDetectorManager; -} - namespace Trk { class IPropagator; } @@ -123,7 +120,9 @@ private: bool& doHoleSearch ) const; - const MuonGM::MuonDetectorManager* m_detMgr; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; ToolHandle<Muon::IMuonSegmentMaker> m_segMaker; //!< actual segment maker with hole search ToolHandle<Muon::IMuonSegmentMaker> m_segMakerNoHoles; //!< actual segment maker no hole search diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx index 885d41804ac88d517c82e2a05d7c5a0259d191cb..ebc3522e9fb119bb284d1039157301a97dea0799 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx @@ -17,7 +17,6 @@ #include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonPrepRawData/MdtPrepDataCollection.h" @@ -71,7 +70,7 @@ MuonSegmentRegionRecoveryTool::MuonSegmentRegionRecoveryTool(const std::string& StatusCode MuonSegmentRegionRecoveryTool::initialize() { - ATH_CHECK( detStore()->retrieve( m_detMgr ) ); + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_edmHelperSvc.retrieve() ); ATH_CHECK( m_intersectSvc.retrieve() ); ATH_CHECK( m_printer.retrieve() ); @@ -433,6 +432,13 @@ const Trk::Track* MuonSegmentRegionRecoveryTool::findHoles( const Trk::Track& tr return 0; } + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return 0; + } + std::vector<const Trk::TrackStateOnSurface*> states; unsigned int nholes = 0; std::set<Identifier> chambersInSearch; @@ -454,7 +460,7 @@ const Trk::Track* MuonSegmentRegionRecoveryTool::findHoles( const Trk::Track& tr ATH_MSG_VERBOSE("Chamber already on track " << *ith << " " << m_idHelperTool->toStringChamber(chId) ); continue; } - const MuonGM::MdtReadoutElement* detEl = m_detMgr->getMdtReadoutElement(chId); + const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(chId); if ( !detEl ) { ATH_MSG_WARNING("Found no detector element for " << *ith ); continue; @@ -474,13 +480,13 @@ const Trk::Track* MuonSegmentRegionRecoveryTool::findHoles( const Trk::Track& tr dbData=readHandle.cptr(); } else dbData=nullptr; //for online running - const MuonStationIntersect intersect = m_intersectSvc->tubesCrossedByTrack(chId , exPars->position(), exPars->momentum().unit(), dbData, m_detMgr ); + const MuonStationIntersect intersect = m_intersectSvc->tubesCrossedByTrack(chId , exPars->position(), exPars->momentum().unit(), dbData, MuonDetMgr ); // clear hole vector for ( unsigned int ii = 0; ii < intersect.tubeIntersects().size(); ++ii ) { const MuonTubeIntersect& tint = intersect.tubeIntersects()[ii]; const Identifier& id = tint.tubeId; - const MuonGM::MdtReadoutElement* detElLoc = m_detMgr->getMdtReadoutElement(id); + const MuonGM::MdtReadoutElement* detElLoc = MuonDetMgr->getMdtReadoutElement(id); // addition skip for cases when the track crosses inbetween two chambers if ( data.mdtTrack.count(detElLoc->collectionHash()) ) continue; @@ -541,7 +547,7 @@ const Trk::Track* MuonSegmentRegionRecoveryTool::findHoles( const Trk::Track& tr m_idHelperTool->cscIdHelper().get_id(*ith, chId, &otCont); chId = m_idHelperTool->chamberId(chId); - const MuonGM::CscReadoutElement* detEl = m_detMgr->getCscReadoutElement(chId); + const MuonGM::CscReadoutElement* detEl = MuonDetMgr->getCscReadoutElement(chId); if ( !detEl ) { ATH_MSG_WARNING("Found no detector element for " << *ith << " " << m_idHelperTool->toString(chId) ); continue; @@ -583,7 +589,7 @@ const Trk::Track* MuonSegmentRegionRecoveryTool::findHoles( const Trk::Track& tr m_idHelperTool->tgcIdHelper().get_id(*ith, chId, &otCont); chId = m_idHelperTool->chamberId(chId); - const MuonGM::TgcReadoutElement* detEl = m_detMgr->getTgcReadoutElement(chId); + const MuonGM::TgcReadoutElement* detEl = MuonDetMgr->getTgcReadoutElement(chId); if ( !detEl ) { ATH_MSG_WARNING("Found no detector element for " << *ith << " " << m_idHelperTool->toString(chId) ); continue; @@ -626,7 +632,7 @@ const Trk::Track* MuonSegmentRegionRecoveryTool::findHoles( const Trk::Track& tr m_idHelperTool->rpcIdHelper().get_id(*ith, chId, &otCont); chId = m_idHelperTool->chamberId(chId); - const MuonGM::RpcReadoutElement* detEl = m_detMgr->getRpcReadoutElement(chId); + const MuonGM::RpcReadoutElement* detEl = MuonDetMgr->getRpcReadoutElement(chId); if ( !detEl ) { ATH_MSG_WARNING("Found no detector element for " << *ith << " " << m_idHelperTool->toString(chId) ); continue; @@ -678,7 +684,7 @@ const Trk::Track* MuonSegmentRegionRecoveryTool::findHoles( const Trk::Track& tr chId = m_idHelperTool->chamberId(chId); - const MuonGM::sTgcReadoutElement* detEl = m_detMgr->getsTgcReadoutElement(chId); + const MuonGM::sTgcReadoutElement* detEl = MuonDetMgr->getsTgcReadoutElement(chId); if ( !detEl ) { ATH_MSG_WARNING("Found no detector element for " << *ith << " " << m_idHelperTool->toString(chId) ); continue; @@ -728,7 +734,7 @@ const Trk::Track* MuonSegmentRegionRecoveryTool::findHoles( const Trk::Track& tr chId = m_idHelperTool->chamberId(chId); - const MuonGM::MMReadoutElement* detEl = m_detMgr->getMMReadoutElement(chId); + const MuonGM::MMReadoutElement* detEl = MuonDetMgr->getMMReadoutElement(chId); if ( !detEl ) { ATH_MSG_WARNING("Found no detector element for " << *ith << " " << m_idHelperTool->toString(chId) ); continue; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.h index 89d96d4094352a2e2079c5cc0a87f581b538eb23..770e1cd84b3c91bcc8787c692146241da8ae50cf 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.h @@ -52,6 +52,8 @@ #include "MuonPrepRawData/sTgcPrepDataCollection.h" #include "MuonPrepRawData/MMPrepDataCollection.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" + #include "MuonIdHelpers/MuonStationIndex.h" #include "IRegionSelector/RegSelEnums.h" @@ -79,10 +81,6 @@ class MuonStationIntersectSvc; class MdtCondDbData; -namespace MuonGM { - class MuonDetectorManager; -} - namespace Trk { class Track; class TrkDetElementBase; @@ -163,7 +161,9 @@ namespace Muon { const Trk::Track* findHoles( const Trk::Track& track, MuonData& data ) const; - const MuonGM::MuonDetectorManager* m_detMgr; + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; ToolHandle<IMuonSeededSegmentFinder> m_seededSegmentFinder {this, "SeededSegmentFinder", "Muon::MuonSeededSegmentFinder/MuonSeededSegmentFinder"}; //!< seeded segment finder diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx index 8bb4f506772bf3025ed011847e9b922cb8540de9..4877520b3825c895bdc10989b41206a80a9051c0 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx @@ -12,7 +12,6 @@ #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "MuonReadoutGeometry/CscReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/MdtIdHelper.h" #include "MuonIdHelpers/RpcIdHelper.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h index b6ba9b2ec1169004f33d1472306cc9aefdefe307..471634de86ea720e12a82e0cad6abf5ad92296e9 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h @@ -40,11 +40,6 @@ ATLAS_CHECK_FILE_THREAD_SAFETY; class MsgStream; -namespace MuonGM { - class MuonDetectorManager; -} - - namespace Trk { class Track; class TrackStateOnSurface; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.h index a9d05a1e6b77e7b5b8fcab9c5137830fc26af319..b28a129cee836bc6cbcd64f46abce0928f8011e0 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.h @@ -24,12 +24,6 @@ namespace Muon { class MuonEDMPrinterTool; } -namespace MuonGM { - class MuonDetectorManager; -} - - - namespace Trk { class ITrackingGeometrySvc; class IExtrapolator; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackSelectorTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackSelectorTool.h index c9a1abb965b0e8d5fbd1ece92223cc0777e3e7eb..583cb6cbfa69e2b8e4cd586cf1f60203303804aa 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackSelectorTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackSelectorTool.h @@ -28,10 +28,6 @@ namespace Muon { class MuonEDMPrinterTool; } -namespace MuonGM { - class MuonDetectorManager; -} - namespace Trk { class Track; class ITrackSummaryHelperTool; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.cxx index 2862e6567eb0a2e846d307e5deff568ad7456aa7..0da862c5edefa890b4c14db14d28daebd4d787f7 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.cxx @@ -37,7 +37,6 @@ namespace Muon { MuonTrackToSegmentTool::MuonTrackToSegmentTool(const std::string& t,const std::string& n,const IInterface* p) : AthAlgTool(t,n,p), - m_detMgr(0), m_intersectSvc("MuonStationIntersectSvc", name()), m_propagator("Trk::RungeKuttaPropagator/AtlasRungeKuttaPropagator"), m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), @@ -57,7 +56,7 @@ namespace Muon { } StatusCode MuonTrackToSegmentTool::initialize() { - ATH_CHECK( detStore()->retrieve(m_detMgr,"Muon") ); + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_propagator.retrieve() ); ATH_CHECK( m_idHelperTool.retrieve() ); ATH_CHECK( m_edmHelperSvc.retrieve() ); @@ -271,7 +270,15 @@ namespace Muon { dbData=readHandle.cptr(); } else dbData=nullptr; //for online running - const MuonStationIntersect intersect = m_intersectSvc->tubesCrossedByTrack( chid, pars.position(), pars.momentum().unit(), dbData, m_detMgr ); + + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + // return; + } + + const MuonStationIntersect intersect = m_intersectSvc->tubesCrossedByTrack( chid, pars.position(), pars.momentum().unit(), dbData, MuonDetMgr ); // set to identify the hit on the segment @@ -292,7 +299,7 @@ namespace Muon { if( hitsOnSegment.count(tint.tubeId) ) continue; // if track goes through a tube which did not have a hit count as hole - if( fabs(tint.rIntersect) < m_detMgr->getMdtReadoutElement(tint.tubeId)->innerTubeRadius() && tint.xIntersect < -200. ) { + if( fabs(tint.rIntersect) < MuonDetMgr->getMdtReadoutElement(tint.tubeId)->innerTubeRadius() && tint.xIntersect < -200. ) { holes.push_back( tint.tubeId ); } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.h index cf7ab6bac692c66fe01ce3d30532c09b711e986a..b093d4d2a7d3ff3ed2d1066c03aa7a1431384b12 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.h @@ -14,6 +14,7 @@ #include "TrkParameters/TrackParameters.h" #include "MuonCondData/MdtCondDbData.h" #include "Identifier/Identifier.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include <vector> @@ -22,10 +23,6 @@ class MdtCondDbData; class MuonStationIntersectSvc; class MsgStream; -namespace MuonGM { - class MuonDetectorManager; -} - namespace Trk { class IPropagator; class Track; @@ -74,7 +71,10 @@ namespace Muon { /** @brief calculate holes */ std::vector<Identifier> calculateHoles( const Identifier& chid, const Trk::TrackParameters& pars, const MeasVec& measurements ) const; - const MuonGM::MuonDetectorManager* m_detMgr; //<! pointer to detector manager + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + ServiceHandle<MuonStationIntersectSvc> m_intersectSvc; //<! pointer to hole search service ToolHandle<Trk::IPropagator> m_propagator; //<! propagator ToolHandle<MuonIdHelperTool> m_idHelperTool; //<! tool to assist with Identifiers diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.cxx index 1dc5a2f67127748c80c5081d00b04c43e4a39429..be79959a779b9ab4057e2a50817258d58d55dabd 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -46,7 +46,6 @@ using namespace std; //m_histCol(kOrange -9), m_histColAlert(kRed), m_monGroupVec(NULL), - m_muon_mgr(NULL), m_cscCoolSvc(NULL), m_statDbColl(NULL) { @@ -76,9 +75,6 @@ StatusCode CscCalibMonToolBase::initialize() // init message stream - Part 1: Get the messaging service, print where you are ATH_MSG_INFO( "CscCalibMonToolBase : in initialize()" ); - ATH_CHECK( detStore()->retrieve(m_muon_mgr) ); - ATH_MSG_DEBUG( "Found the MuonGeoModel Manager " ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); ATH_MSG_DEBUG( " Found the MuonIdHelperTool. " ); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.h index 7b13603c37ae579055ff7afe28e6fe094055ed60..191e49eefdc50ac245b7147ab2bef10ce5d68619 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -27,8 +27,6 @@ #include "StoreGate/StoreGateSvc.h" #include "GaudiKernel/MsgStream.h" -//#include "MuonGeoModel/MuonDetectorManager.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/CscIdHelper.h" #include "MuonCondData/CscCondDataCollection.h" #include "MuonCondData/CscCondDataContainer.h" @@ -175,9 +173,6 @@ class CscCalibMonToolBase: public ManagedMonitorToolBase /**Calibration result storegate key*/ std::string m_calibResultKey; - /** Muon Detector Descriptor*/ - const MuonGM::MuonDetectorManager * m_muon_mgr; - /** Tool for CSC identifier helper*/ ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.h index 9f43f255e17d6a94c60652882d9d636e4772a46b..03e5f85a68a015a0af51ba1f8d1985afa0394f9d 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.h @@ -19,7 +19,6 @@ #include "StoreGate/StoreGateSvc.h" #include "GaudiKernel/MsgStream.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/CscIdHelper.h" #include "TH1.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.h index 042f0ceded3efc8732a12fd96a797612d79dc296..baaa03109c265bf4b6f0c80f00d690437036f2ad 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.h @@ -19,7 +19,6 @@ #include "StoreGate/StoreGateSvc.h" #include "GaudiKernel/MsgStream.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/CscIdHelper.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h index 544af08fc1ffed1537be80585b194c968a038abe..2b9e243d45be04e0b40e894ba6cedba79e5ca995 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h @@ -27,6 +27,7 @@ #include "MdtRawDataMonitoring/MDTChamber.h" #include "MuonDQAUtils/MuonDQAHistMap.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "TrkSegment/SegmentCollection.h" #include "AthenaMonitoring/DQAtlasReadyFilterTool.h" #include "EventInfo/EventInfo.h" @@ -128,7 +129,11 @@ class MdtRawDataMonAlg: public AthMonitorAlgorithm { ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool; - const MuonGM::MuonDetectorManager* p_MuonDetectorManager ; //!< Pointer On MuonDetectorManager + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; virtual StatusCode fillMDTOverviewHistograms(const Muon::MdtPrepData*, bool &isNoiseBurstCandidate) const; virtual StatusCode fillMDTSummaryHistograms( const Muon::MdtPrepData*, /*std::set<std::string>,*/ bool &isNoiseBurstCandidate, int lb, bool trig_barrel, bool trig_endcap ) const; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h index 2196c5acbda9d87298f36c3a917d87d9cacfbb10..41245dd5ad3362690cc4eea1cf16ef245372f191 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////////////////////////////// @@ -33,6 +33,7 @@ #include "xAODTrigger/MuonRoIContainer.h" #include "xAODMuon/MuonContainer.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "xAODEventInfo/EventInfo.h" #include "StoreGate/ReadHandleKey.h" //standard library includes @@ -119,7 +120,11 @@ class MdtRawDataValAlg: public ManagedMonitorToolBase { ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool; - const MuonGM::MuonDetectorManager* p_MuonDetectorManager ; //!< Pointer On MuonDetectorManager + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; virtual StatusCode bookMDTHistograms( MDTChamber* chamber, Identifier digcoll_id );//book chamber by chamber histos virtual StatusCode fillMDTHistograms( const Muon::MdtPrepData* );//fill chamber by chamber histos diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MuonChamberIDSelector.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MuonChamberIDSelector.h index 0bbd0b6860f7090f40a9a55572b34a5f28535d87..2a3bb85a650c9eb08019bdb2442baa6b65fde10c 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MuonChamberIDSelector.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MuonChamberIDSelector.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -20,10 +20,6 @@ class Identifier; -namespace MuonGM { - class MuonDetectorManager; -} - class MuonChamberIDSelector : public AthAlgorithm { public: diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx index 08999689df9c1d1b226c5d7d5155f612ff5abdbd..0f0acb1c3e0262aa2aa791dc07088da8b05953f7 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx @@ -150,7 +150,6 @@ StatusCode MdtRawDataMonAlg::initialize() { //initialize to stop coverity bugs - p_MuonDetectorManager=0; //mdtevents_RPCtrig = 0; //mdtevents_TGCtrig=0; // m_time = 0; @@ -171,15 +170,8 @@ StatusCode MdtRawDataMonAlg::initialize() //If online monitoring turn off chamber by chamber hists if(m_isOnline) m_doChamberHists = false; - std::string managerName="Muon"; - sc = detStore()->retrieve(p_MuonDetectorManager); - if (sc.isFailure()) { - ATH_MSG_INFO("Could not find the MuonGeoModel Manager: " << managerName << " ! " ); - return StatusCode::FAILURE; - } - else { - ATH_MSG_DEBUG(" Found the MuonGeoModel Manager " ); - } +// MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); sc = m_muonIdHelperTool.retrieve(); if (sc.isFailure()) { @@ -216,13 +208,23 @@ StatusCode MdtRawDataMonAlg::initialize() //conflict // m_BMGid = m_mdtIdHelper->stationNameIndex("BMG"); m_BMGid = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BMG"); + + // MuonDetectorManager from the Detector Store + std::string managerName="Muon"; + const MuonGM::MuonDetectorManager* MuonDetMgrDS; + sc = detStore()->retrieve(MuonDetMgrDS); + if (sc.isFailure()) { + ATH_MSG_INFO("Could not find the MuonGeoModel Manager: " << managerName << " from the Detector Store! " ); + return StatusCode::FAILURE; + } else { ATH_MSG_DEBUG(" Found the MuonGeoModel Manager from the Detector Store" );} + for(int phi=6; phi<8; phi++) { // phi sectors for(int eta=1; eta<4; eta++) { // eta sectors for(int side=-1; side<2; side+=2) { // side - if( !p_MuonDetectorManager->getMuonStation("BMG", side*eta, phi) ) continue; - for(int roe=1; roe<=( p_MuonDetectorManager->getMuonStation("BMG", side*eta, phi) )->nMuonReadoutElements(); roe++) { // iterate on readout elemets + if( !MuonDetMgrDS->getMuonStation("BMG", side*eta, phi) ) continue; + for(int roe=1; roe<=( MuonDetMgrDS->getMuonStation("BMG", side*eta, phi) )->nMuonReadoutElements(); roe++) { // iterate on readout elemets const MuonGM::MdtReadoutElement* mdtRE = - dynamic_cast<const MuonGM::MdtReadoutElement*> ( ( p_MuonDetectorManager->getMuonStation("BMG", side*eta, phi) )->getMuonReadoutElement(roe) ); // has to be an MDT + dynamic_cast<const MuonGM::MdtReadoutElement*> ( ( MuonDetMgrDS->getMuonStation("BMG", side*eta, phi) )->getMuonReadoutElement(roe) ); // has to be an MDT if(mdtRE) initDeadChannels(mdtRE); } } @@ -638,7 +640,15 @@ StatusCode MdtRawDataMonAlg::fillMDTOverviewHistograms( const Muon::MdtPrepData* std::string hardware_name = getChamberName( mdtCollection ); bool isNoisy = m_masked_tubes->isNoisy( mdtCollection ); - const MuonGM::MdtReadoutElement* pReadoutElementMDT = p_MuonDetectorManager->getMdtReadoutElement(digcoll_id); +// MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + + const MuonGM::MdtReadoutElement* pReadoutElementMDT = MuonDetMgr->getMdtReadoutElement(digcoll_id); const Amg::Vector3D mdtgPos = pReadoutElementMDT->tubePos(digcoll_id); //global position of the wire float mdt_tube_eta = mdtgPos.eta(); @@ -1034,6 +1044,14 @@ StatusCode MdtRawDataMonAlg::handleEvent_effCalc(const Trk::SegmentCollection* s std::set<monAlg::TubeTraversedBySegment, monAlg::TubeTraversedBySegment_cmp> store_effTubes; std::set<Identifier> store_ROTs; + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + // LOOP OVER SEGMENTS for (Trk::SegmentCollection::const_iterator s = segms->begin(); s != segms->end(); ++s) { const Muon::MuonSegment* segment = dynamic_cast<const Muon::MuonSegment*>(*s); @@ -1174,7 +1192,7 @@ StatusCode MdtRawDataMonAlg::handleEvent_effCalc(const Trk::SegmentCollection* s std::string hardware_name = getChamberName(station_id); // SEGMENT track - const MuonGM::MdtReadoutElement* detEl = p_MuonDetectorManager->getMdtReadoutElement(station_id); + const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(station_id); Amg::Transform3D gToStation = detEl->GlobalToAmdbLRSTransform(); Amg::Vector3D segPosG(segment->globalPosition()); Amg::Vector3D segDirG(segment->globalDirection()); @@ -1192,7 +1210,7 @@ StatusCode MdtRawDataMonAlg::handleEvent_effCalc(const Trk::SegmentCollection* s CorrectLayerMax(hardware_name, tubeLayerMax); for(int i_tube=m_muonIdHelperTool->mdtIdHelper().tubeMin(newId); i_tube<=tubeMax; i_tube++) { for(int i_layer=m_muonIdHelperTool->mdtIdHelper().tubeLayerMin(newId); i_layer<=tubeLayerMax; i_layer++) { - const MuonGM::MdtReadoutElement* MdtRoEl = p_MuonDetectorManager->getMdtReadoutElement( newId ); + const MuonGM::MdtReadoutElement* MdtRoEl = MuonDetMgr->getMdtReadoutElement( newId ); if(m_BMGpresent && m_muonIdHelperTool->mdtIdHelper().stationName(newId) == m_BMGid ) { std::map<Identifier, std::vector<Identifier> >::const_iterator myIt = m_DeadChannels.find(MdtRoEl->identify()); if( myIt != m_DeadChannels.end() ){ diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx index f5c970c16263027292da1bf98acb469d1b74ba97..1e10ab06aeb2c2b346a8422dee45aab8eea8eaf4 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,6 @@ #include "AthenaMonitoring/AthenaMonManager.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MuonStation.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" #include "MuonDQAUtils/MuonChambersRange.h" @@ -185,7 +184,6 @@ StatusCode MdtRawDataValAlg::initialize() { //initialize to stop coverity bugs - p_MuonDetectorManager=0; //mdtevents_RPCtrig = 0; //mdtevents_TGCtrig=0; m_MdtNHitsvsRpcNHits = 0; @@ -244,15 +242,8 @@ StatusCode MdtRawDataValAlg::initialize() //If online monitoring turn off chamber by chamber hists if(m_isOnline) m_doChamberHists = false; - std::string managerName="Muon"; - sc = detStore()->retrieve(p_MuonDetectorManager); - if (sc.isFailure()) { - ATH_MSG_INFO("Could not find the MuonGeoModel Manager: " << managerName << " ! " ); - return StatusCode::FAILURE; - } - else { - ATH_MSG_DEBUG(" Found the MuonGeoModel Manager " ); - } +// MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); sc = m_muonIdHelperTool.retrieve(); if (sc.isFailure()) { @@ -323,6 +314,15 @@ StatusCode MdtRawDataValAlg::initialize() ManagedMonitorToolBase::initialize().ignore(); // Ignore the checking code; + // MuonDetectorManager from the Detector Store + std::string managerName="Muon"; + const MuonGM::MuonDetectorManager* MuonDetMgrDS; + sc = detStore()->retrieve(MuonDetMgrDS); + if (sc.isFailure()) { + ATH_MSG_INFO("Could not find the MuonGeoModel Manager: " << managerName << " from the Detector Store! " ); + return StatusCode::FAILURE; + } else { ATH_MSG_DEBUG(" Found the MuonGeoModel Manager from the Detector Store" );} + m_BMGpresent = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BMG") != -1; if(m_BMGpresent){ ATH_MSG_INFO("Processing configuration for layouts with BMG chambers."); @@ -330,10 +330,10 @@ StatusCode MdtRawDataValAlg::initialize() for(int phi=6; phi<8; phi++) { // phi sectors for(int eta=1; eta<4; eta++) { // eta sectors for(int side=-1; side<2; side+=2) { // side - if( !p_MuonDetectorManager->getMuonStation("BMG", side*eta, phi) ) continue; - for(int roe=1; roe<=( p_MuonDetectorManager->getMuonStation("BMG", side*eta, phi) )->nMuonReadoutElements(); roe++) { // iterate on readout elemets + if( !MuonDetMgrDS->getMuonStation("BMG", side*eta, phi) ) continue; + for(int roe=1; roe<=( MuonDetMgrDS->getMuonStation("BMG", side*eta, phi) )->nMuonReadoutElements(); roe++) { // iterate on readout elemets const MuonGM::MdtReadoutElement* mdtRE = - dynamic_cast<const MuonGM::MdtReadoutElement*> ( ( p_MuonDetectorManager->getMuonStation("BMG", side*eta, phi) )->getMuonReadoutElement(roe) ); // has to be an MDT + dynamic_cast<const MuonGM::MdtReadoutElement*> ( ( MuonDetMgrDS->getMuonStation("BMG", side*eta, phi) )->getMuonReadoutElement(roe) ); // has to be an MDT if(mdtRE) initDeadChannels(mdtRE); } } @@ -1938,7 +1938,15 @@ StatusCode MdtRawDataValAlg::fillMDTOverviewHistograms( const Muon::MdtPrepData* std::string hardware_name = getChamberName( mdtCollection ); bool isNoisy = m_masked_tubes->isNoisy( mdtCollection ); - const MuonGM::MdtReadoutElement* pReadoutElementMDT = p_MuonDetectorManager->getMdtReadoutElement(digcoll_id); + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + + const MuonGM::MdtReadoutElement* pReadoutElementMDT = MuonDetMgr->getMdtReadoutElement(digcoll_id); const Amg::Vector3D mdtgPos = pReadoutElementMDT->tubePos(digcoll_id); //global position of the wire float mdt_tube_eta = mdtgPos.eta(); float mdt_tube_x = mdtgPos.x(); @@ -2013,6 +2021,14 @@ StatusCode MdtRawDataValAlg::handleEvent_effCalc(const Trk::SegmentCollection* s std::set<TubeTraversedBySegment, TubeTraversedBySegment_cmp> store_effTubes; std::set<Identifier> store_ROTs; + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + // LOOP OVER SEGMENTS for (Trk::SegmentCollection::const_iterator s = segms->begin(); s != segms->end(); ++s) { const Muon::MuonSegment* segment = dynamic_cast<const Muon::MuonSegment*>(*s); @@ -2146,7 +2162,7 @@ StatusCode MdtRawDataValAlg::handleEvent_effCalc(const Trk::SegmentCollection* s std::string hardware_name = getChamberName(station_id); // SEGMENT track - const MuonGM::MdtReadoutElement* detEl = p_MuonDetectorManager->getMdtReadoutElement(station_id); + const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(station_id); Amg::Transform3D gToStation = detEl->GlobalToAmdbLRSTransform(); Amg::Vector3D segPosG(segment->globalPosition()); Amg::Vector3D segDirG(segment->globalDirection()); @@ -2164,7 +2180,7 @@ StatusCode MdtRawDataValAlg::handleEvent_effCalc(const Trk::SegmentCollection* s CorrectLayerMax(hardware_name, tubeLayerMax); for(int i_tube=m_muonIdHelperTool->mdtIdHelper().tubeMin(newId); i_tube<=tubeMax; i_tube++) { for(int i_layer=m_muonIdHelperTool->mdtIdHelper().tubeLayerMin(newId); i_layer<=tubeLayerMax; i_layer++) { - const MuonGM::MdtReadoutElement* MdtRoEl = p_MuonDetectorManager->getMdtReadoutElement( newId ); + const MuonGM::MdtReadoutElement* MdtRoEl = MuonDetMgr->getMdtReadoutElement( newId ); if(m_BMGpresent && m_muonIdHelperTool->mdtIdHelper().stationName(newId) == m_BMGid ) { std::map<Identifier, std::vector<Identifier> >::iterator myIt = m_DeadChannels.find(MdtRoEl->identify()); if( myIt != m_DeadChannels.end() ){ diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MuonChamberIDSelector.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MuonChamberIDSelector.cxx index 3f012d398fa7b612977ee2f468c155687bb975ed..8a897a4648ae26ef4dce5dffe9b6047070744622 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MuonChamberIDSelector.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MuonChamberIDSelector.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -9,7 +9,6 @@ #include "MdtRawDataMonitoring/MuonChamberIDSelector.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "Identifier/IdentifierHash.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsRpcRawDataMonitoring/MdtVsRpcRawDataMonitoring/MdtVsRpcRawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsRpcRawDataMonitoring/MdtVsRpcRawDataMonitoring/MdtVsRpcRawDataValAlg.h index 2c2bd45f208933d0b65a83dc68171eb77554dd0d..26d07c1a197205ae4e255c0d44b562afc6b4eea6 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsRpcRawDataMonitoring/MdtVsRpcRawDataMonitoring/MdtVsRpcRawDataValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsRpcRawDataMonitoring/MdtVsRpcRawDataMonitoring/MdtVsRpcRawDataValAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////////////// @@ -71,7 +71,11 @@ class MdtVsRpcRawDataValAlg: public ManagedMonitorToolBase int m_rpc_eventstotal; std::vector<Identifier>* m_padsId; - const MuonGM::MuonDetectorManager* m_muonMgr; + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsRpcRawDataMonitoring/src/MdtVsRpcRawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsRpcRawDataMonitoring/src/MdtVsRpcRawDataValAlg.cxx index ad86d65977b22f12f4b4f52ae1a7eb664ac85b4b..38c680931bd7552051e5d351999a35efeeb3d544 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsRpcRawDataMonitoring/src/MdtVsRpcRawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsRpcRawDataMonitoring/src/MdtVsRpcRawDataValAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////////////// @@ -101,8 +101,9 @@ StatusCode MdtVsRpcRawDataValAlg::initialize(){ return StatusCode::FAILURE; } - // Retrieve the MuonDetectorManager - sc = detStore->retrieve(m_muonMgr); + // MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); + if (sc.isFailure()) { ATH_MSG_FATAL ( "Cannot get MuonDetectorManager from detector store" ); return StatusCode::FAILURE; @@ -200,6 +201,14 @@ StatusCode MdtVsRpcRawDataValAlg::fillHistograms() // id_it != m_rpcchambersId->end() ; ++id_it ){ // containerIt = rpc_container->find(*id_it); + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + for (containerIt = rpc_container->begin() ; containerIt != rpc_container->end() ; ++containerIt) { for (Muon::RpcPrepDataCollection::const_iterator rpcPrd = (*containerIt)->begin(); rpcPrd!=(*containerIt)->end(); ++rpcPrd) @@ -265,7 +274,7 @@ StatusCode MdtVsRpcRawDataValAlg::fillHistograms() for(int idbz=0; idbz!= 3; idbz++){ ShiftEtaStripsDoubletZ[idbz] = NetaStrips; const MuonGM::RpcReadoutElement* rpc = - m_muonMgr->getRpcReadoutElement(stname_index, irpcstationEta+8, irpcstationPhi-1, irpcdoubletR-1, idbz); + MuonDetMgr->getRpcReadoutElement(stname_index, irpcstationEta+8, irpcstationPhi-1, irpcdoubletR-1, idbz); if(rpc != NULL ){ NetaStrips += rpc->NetaStrips(); } @@ -291,7 +300,7 @@ StatusCode MdtVsRpcRawDataValAlg::fillHistograms() float stripzmax = -10000 ; for(int ieta=0; ieta!= 17; ieta++){ for(int idbz=0; idbz!= 3; idbz++){ - const MuonGM::RpcReadoutElement* rpc = m_muonMgr->getRpcReadoutElement(stname_index, ieta, irpcstationPhi-1, irpcdoubletR-1, idbz); + const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcReadoutElement(stname_index, ieta, irpcstationPhi-1, irpcdoubletR-1, idbz); if(rpc != NULL ){ const Amg::Vector3D r1 = rpc-> globalPosition(); float pitch = rpc-> StripPitch(0) ; @@ -316,7 +325,7 @@ StatusCode MdtVsRpcRawDataValAlg::fillHistograms() if (irpcstationName == 53) stname_index = MuonGM::MuonDetectorManager::NMdtStatType-2; else stname_index = irpcstationName; for(int eta=0; eta!=17; eta++){ - const MuonGM::MdtReadoutElement* lastdescr = m_muonMgr->getMdtReadoutElement(stname_index, eta, irpcstationPhi-1, imdt_multi_near-1); + const MuonGM::MdtReadoutElement* lastdescr = MuonDetMgr->getMdtReadoutElement(stname_index, eta, irpcstationPhi-1, imdt_multi_near-1); if(lastdescr==NULL)continue; const Amg::Vector3D lastelc = lastdescr->globalPosition(); @@ -342,7 +351,7 @@ StatusCode MdtVsRpcRawDataValAlg::fillHistograms() TH2* mdttubevsrpcetastripsector; //get information from geomodel to book and fill rpc histos with the right max strip number - const MuonGM::RpcReadoutElement* descriptor = m_muonMgr->getRpcReadoutElement(prd_id); + const MuonGM::RpcReadoutElement* descriptor = MuonDetMgr->getRpcReadoutElement(prd_id); const Amg::Vector3D stripPos = descriptor->stripPos(prd_id); ATH_MSG_DEBUG ( "rpc coord" << stripPos.z() << stripPos.perp() ); float irpcstripz = float( stripPos.z() ); @@ -401,7 +410,7 @@ StatusCode MdtVsRpcRawDataValAlg::fillHistograms() //get mdt information from geomodel to book and fill mdtvsrpc histos with the right min and max range if (imdt_station == 53) imdt_station = MuonGM::MuonDetectorManager::NMdtStatType-2; - const MuonGM::MdtReadoutElement* mdt = m_muonMgr->getMdtReadoutElement( imdt_station, imdt_eta+8, imdt_phi-1, imdt_multi-1); + const MuonGM::MdtReadoutElement* mdt = MuonDetMgr->getMdtReadoutElement( imdt_station, imdt_eta+8, imdt_phi-1, imdt_multi-1); int NetaTubes = mdt->getNtubesperlayer() ; const Amg::Vector3D elc = mdt->globalPosition(); float imdt_wirez = float(elc.z()); @@ -423,7 +432,7 @@ StatusCode MdtVsRpcRawDataValAlg::fillHistograms() imdt_phi = irpcstationPhi ; NetaTubes = 0; if (imdt_station == 53) imdt_station = MuonGM::MuonDetectorManager::NMdtStatType-2; - const MuonGM::MdtReadoutElement* mdt = m_muonMgr->getMdtReadoutElement( imdt_station, imdt_eta+8, imdt_phi-1, imdt_multi_near-1); + const MuonGM::MdtReadoutElement* mdt = MuonDetMgr->getMdtReadoutElement( imdt_station, imdt_eta+8, imdt_phi-1, imdt_multi_near-1); if(mdt==NULL)continue; // protection NetaTubes = mdt->getNtubesperlayer(); m_layer_name_list.push_back(hardware_name+layer_name); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/MdtVsTgcRawDataMonitoring/MdtVsTgcRawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/MdtVsTgcRawDataMonitoring/MdtVsTgcRawDataValAlg.h index 2597ab4ed7e47dff121b49f6b272dcfbf8eccb67..39196451e49800baf4dadc3c5f88b0b92907e4a3 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/MdtVsTgcRawDataMonitoring/MdtVsTgcRawDataValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/MdtVsTgcRawDataMonitoring/MdtVsTgcRawDataValAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////////////////////// @@ -45,6 +45,7 @@ #include "MuonTrigCoinData/TgcCoinDataCollection.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonDQAUtils/TGCDQAUtils.h" #include "MuonDQAUtils/MuonDQAFitFunc.h" @@ -97,7 +98,10 @@ public: MuonDQAHistMap m_stationHists; - const MuonGM::MuonDetectorManager* m_muonMgr; + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; @@ -127,7 +131,7 @@ public: // Variables and Functions for TGC Efficiency Maps // Array of all TREs, indexed by location. Used to find which sectors tracks pass through in tgceffcalc - void prepareTREarray(); + void prepareTREarray(const MuonGM::MuonDetectorManager* MuonDetMgrDS); const MuonGM::TgcReadoutElement* m_TREarray[8][2][9][49]; // [StationName][AC][StationEta][StationPhi] // Functions used to standardize the way TGC stations are indexed by the program int TGCgetlayer(int stationName, int g); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawDataValAlg.cxx index e7ceb142c24aac64565d3e77e3b35d2f919f69b8..b6c145051f314a105a79d24b06c50669635d5f28 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawDataValAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,6 @@ #include "MuonRDO/TgcRdoIdHash.h" // MuonDetDesc -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutParams.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" @@ -123,9 +122,8 @@ MdtVsTgcRawDataValAlg::initialize(){ // init message stream ATH_MSG_INFO( "in initializing MdtVsTgcRawDataValAlg" ); - // Retrieve the MuonDetectorManager - ATH_CHECK( detStore()->retrieve(m_muonMgr) ); - ATH_MSG_DEBUG( " Found the MuonDetectorManager from detector store. " ); + // MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_muonIdHelperTool.retrieve() ); @@ -181,7 +179,12 @@ MdtVsTgcRawDataValAlg::initialize(){ //18 2 2 14004.6 //18 2 3 14030.6 - prepareTREarray(); + // Retrieve the MuonDetectorManager + const MuonGM::MuonDetectorManager* MuonDetMgrDS; + ATH_CHECK( detStore()->retrieve(MuonDetMgrDS) ); + ATH_MSG_DEBUG( " Found the MuonDetectorManager from detector store. " ); + + prepareTREarray(MuonDetMgrDS); ATH_CHECK(m_tgc_PrepDataContainerName.initialize()); ATH_CHECK(m_tgc_CoinContainerName.initialize()); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_TGCEffCheck.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_TGCEffCheck.cxx index b49651f600dd602637ecfc10ac53467c7c298e9d..871cd91ced35168c75b3419b1fc42ff2f9d619fb 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_TGCEffCheck.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_TGCEffCheck.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////////////////////// @@ -89,7 +89,7 @@ MdtVsTgcRawDataValAlg::tgceffcalc(const xAOD::MuonSegmentContainer *newmdtsegmen // Prepare array of TGC Readout Elements void -MdtVsTgcRawDataValAlg::prepareTREarray(){ +MdtVsTgcRawDataValAlg::prepareTREarray(const MuonGM::MuonDetectorManager* MuonDetMgrDS){ int TGCStationNames[8]={41, 42, 43, 44, 45, 46, 47, 48}; // Make array of TGC Readout Element pointers @@ -136,7 +136,7 @@ MdtVsTgcRawDataValAlg::prepareTREarray(){ delete isValid; // Get TRE and put into to array - m_TREarray[stationNameIndex][tgcAC][absStationEta][stationPhi] = m_muonMgr->getTgcReadoutElement(tgc_testId); + m_TREarray[stationNameIndex][tgcAC][absStationEta][stationPhi] = MuonDetMgrDS->getTgcReadoutElement(tgc_testId); if(m_TREarray[stationNameIndex][tgcAC][absStationEta][stationPhi]==0){ ATH_MSG_WARNING( "prepareTREarray: TgcReadoutElement==0 passed checks" ); continue; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_correlation.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_correlation.cxx index 534c9a03fb03c04677bf7065072ea338ed075b53..72920ef47683527440ebf284a94a1bb9417ca92f 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_correlation.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_correlation.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////// @@ -14,7 +14,6 @@ #include "GaudiKernel/MsgStream.h" // MuonDetDesc -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutParams.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" @@ -51,6 +50,14 @@ MdtVsTgcRawDataValAlg::correlation(const Muon::MdtPrepDataContainer* mdt_hit_con ATH_MSG_DEBUG("inside correlation" ); //StatusCode sc=StatusCode::SUCCESS; + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + //loop over TGC RoI container Muon::TgcCoinDataContainer::const_iterator it_end=tgccontainer->end(); for( Muon::TgcCoinDataContainer::const_iterator it=tgccontainer->begin(); @@ -82,7 +89,7 @@ MdtVsTgcRawDataValAlg::correlation(const Muon::MdtPrepDataContainer* mdt_hit_con //int tgcMdtSector=roiphi2mdtSector(roiphi,ef); - const MuonGM::TgcReadoutElement* pReadoutElementTGC = m_muonMgr->getTgcReadoutElement(tgcid); + const MuonGM::TgcReadoutElement* pReadoutElementTGC = MuonDetMgr->getTgcReadoutElement(tgcid); const Amg::Vector3D pos = pReadoutElementTGC->channelPos(tgcid); float tgcEta = abs(pos.eta()); @@ -199,7 +206,7 @@ MdtVsTgcRawDataValAlg::correlation(const Muon::MdtPrepDataContainer* mdt_hit_con if(adc < m_MdtAdcCut )continue; - const MuonGM::MdtReadoutElement* pReadoutElementMDT = m_muonMgr->getMdtReadoutElement(mdt_id2); + const MuonGM::MdtReadoutElement* pReadoutElementMDT = MuonDetMgr->getMdtReadoutElement(mdt_id2); const Amg::Vector3D mdtgPos = pReadoutElementMDT->tubePos(mdt_id2); //global position of the wire float mdtEta = abs(mdtgPos.eta()); float mdtPhi = mdtgPos.phi(); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.h index 99e04368d24bec6d9a3c95dddf4ff1fb313d80d7..45aee84798dfa2675e6fa587fa4180bba95fea8f 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -147,7 +147,11 @@ class RPCStandaloneTracksMon: public ManagedMonitorToolBase { std::vector<Identifier>* m_padsId; - const MuonGM::MuonDetectorManager* m_muonMgr; + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataEfficiency.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataEfficiency.h index 0e4cf79f4a324491f92177ed142a64829ebe1b9e..6d26fefa79d7eded788ee6e4dfd11f8530638e0e 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataEfficiency.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataEfficiency.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -189,7 +189,11 @@ class RpcLv1RawDataEfficiency: public ManagedMonitorToolBase { // Retrieving information and data ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager* m_muonMgr; // to retrieve coincidence informations + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; // Trigger type stuff StatusCode StoreTriggerType(); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h index 3ce20bc08f4b4e13cc6824b0a53c5ef4aa6f60b5..a1539d6382a998aa44a9ee463575eba9ed9bf198 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcLv1RawDataValAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////////////////////// // Package : RpcRawDataMonitoring @@ -106,7 +106,11 @@ class RpcLv1RawDataValAlg: public ManagedMonitorToolBase { bool m_rpclv1prof ; int m_rpclv1reducenbins ; - const MuonGM::MuonDetectorManager* m_muonMgr; + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataValAlg.h index ed82e4e8b529fab90b2bd2593deeef50aadf84ca..aab25807b874833379484f4231dbd74286672d22 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataValAlg.h @@ -129,7 +129,11 @@ class RpcRawDataValAlg: public ManagedMonitorToolBase { std::vector<Identifier>* m_padsId; std::map<std::string,int> m_hitsperchamber_map; - const MuonGM::MuonDetectorManager* m_muonMgr; + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.cxx index 14b8e082f7f504d3d476950c8f54ea4c2f90117a..05d3b07848179e715c5bbd253e3e025faa91e288 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.cxx @@ -175,15 +175,8 @@ StatusCode RPCStandaloneTracksMon::initialize(){ return StatusCode::FAILURE; } - // Retrieve the MuonDetectorManager - sc = detStore->retrieve(m_muonMgr); - if (sc.isFailure()) { - ATH_MSG_FATAL ( "Cannot get MuonDetectorManager from detector store" ); - return StatusCode::FAILURE; - } - else { - ATH_MSG_DEBUG ( " Found the MuonDetectorManager from detector store. " ); - } + // MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_muonIdHelperTool.retrieve() ); @@ -259,6 +252,14 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() ATH_MSG_DEBUG ( "RPCStandaloneTracksMon::RPCStandaloneTracksMon Histograms being filled" ); if( m_doRpcESD==true ) { if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD || m_environment == AthenaMonManager::online ) { + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + // TRIGGER SELECTION BASED ON CHAIN GROUP if (m_selectTriggerChainGroup || m_deselectTriggerChainGroup){ @@ -352,7 +353,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() // begin cluster monitoring SG::ReadHandle<Muon::RpcPrepDataContainer> rpc_clusterContainer(m_clusterContainerName); - + if (m_doClusters) { ATH_MSG_DEBUG ( "Start RPC Cluster Monitoring" ); @@ -549,7 +550,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() float av_strip = 0 ; for(int i=0; i!=irpc_clus_size ; i++){ Identifier id = ((*rpcCollection)->rdoList())[i] ; - const MuonGM::RpcReadoutElement* descriptor = m_muonMgr->getRpcReadoutElement(id); + const MuonGM::RpcReadoutElement* descriptor = MuonDetMgr->getRpcReadoutElement(id); stripPosC += descriptor->stripPos(id); int strip = int(m_muonIdHelperTool->rpcIdHelper().strip(id)) ; av_strip += float(strip) ; @@ -564,7 +565,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() //get information from geomodel to book and fill rpc histos with the right max strip number - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),prd_id, 0) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prd_id, 0) ; int ShiftEtaStripsTot = rpcstripshift[8] ; int EtaStripSign = rpcstripshift[10]; @@ -711,8 +712,8 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() float avstripeta = 0 ; float avstripphi = av_strip ; - ShiftEtaStripsTot = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),prd_idII, 0)[8] ; // angelo 07 oct 2009 - EtaStripSign = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),prd_idII, 0)[10] ; // angelo 07 oct 2009 + ShiftEtaStripsTot = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prd_idII, 0)[8] ; // angelo 07 oct 2009 + EtaStripSign = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prd_idII, 0)[10] ; // angelo 07 oct 2009 // get the average strip and cluster position @@ -721,7 +722,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() for(int i=0; i!=irpc_clus_sizeII ; i++){ Identifier id = ((*rpcCollectionII)->rdoList())[i] ; - const MuonGM::RpcReadoutElement* descriptor = m_muonMgr->getRpcReadoutElement(id); + const MuonGM::RpcReadoutElement* descriptor = MuonDetMgr->getRpcReadoutElement(id); stripPosCII += descriptor->stripPos(id); avstripeta += float(m_muonIdHelperTool->rpcIdHelper().strip(id)) ; } @@ -1021,7 +1022,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() prdcoll_id = (*it_collection)->identify(); if(m_muonIdHelperTool->rpcIdHelper().measuresPhi(prdcoll_id))continue; int cointhr = (*it_collection)->threshold(); - descriptor_Atl = m_muonMgr->getRpcReadoutElement( prdcoll_id ); + descriptor_Atl = MuonDetMgr->getRpcReadoutElement( prdcoll_id ); eta_atlas = descriptor_Atl->stripPos(prdcoll_id ).eta(); phi_atlas = descriptor_Atl->stripPos(prdcoll_id ).phi(); @@ -1048,7 +1049,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() if( (*it_collection)->isLowPtCoin() != (*it_collection_phi)->isLowPtCoin() || (*it_collection)->isHighPtCoin() != (*it_collection_phi)->isHighPtCoin()) continue ; - descriptor_Atl = m_muonMgr->getRpcReadoutElement( prdcoll_id_phi ); + descriptor_Atl = MuonDetMgr->getRpcReadoutElement( prdcoll_id_phi ); eta_atlas = descriptor_Atl->stripPos(prdcoll_id_phi ).eta(); phi_atlas = descriptor_Atl->stripPos(prdcoll_id_phi ).phi(); if( std::sqrt( std::fabs(eta_atlas-metrack->eta())*std::fabs(eta_atlas-metrack->eta()) + std::fabs(phi_atlas-metrack->phi())*std::fabs(phi_atlas-metrack->phi()) ) < m_MuonDeltaRMatching) { @@ -1551,7 +1552,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() for(int iz = 1; iz != 3+1; iz++ ){ for(int idp = 1; idp != 2 + 1; idp++ ){ - const MuonGM::RpcReadoutElement* rpc = m_muonMgr->getRpcRElement_fromIdFields(iname, ieta, iphi, ir, iz, idp); + const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields(iname, ieta, iphi, ir, iz, idp); if(rpc == NULL )continue; @@ -1706,7 +1707,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() if( prdcoll_id == 0 )continue; //get information from geomodel to book and fill rpc histos with the right max strip number - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0) ; int ShiftPhiStrips = rpcstripshift[1] ; int ShiftStrips = rpcstripshift[4] ; @@ -1868,7 +1869,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() int av_strip = 0 ; for(int i=0; i!=irpc_clus_size ; i++){ Identifier id = ((*rpcCollection)->rdoList())[i] ; - const MuonGM::RpcReadoutElement* descriptor = m_muonMgr->getRpcReadoutElement(id); + const MuonGM::RpcReadoutElement* descriptor = MuonDetMgr->getRpcReadoutElement(id); stripPosC += descriptor->stripPos(id) ; int strip = int(m_muonIdHelperTool->rpcIdHelper().strip(id)) ; av_strip += float(strip) ; @@ -2257,12 +2258,12 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() int irpc_clus_measphi = m_muonIdHelperTool->rpcIdHelper().measuresPhi(prd_id) ; // get the cluster position - const MuonGM::RpcReadoutElement* descriptor = m_muonMgr->getRpcReadoutElement(prd_id); + const MuonGM::RpcReadoutElement* descriptor = MuonDetMgr->getRpcReadoutElement(prd_id); const Amg::Vector3D stripPosC = descriptor->stripPos(prd_id); //get information from geomodel to book and fill rpc histos with the right max strip number - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),prd_id, 0) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prd_id, 0) ; int PanelIndex = rpcstripshift[13] ; int Settore = rpcstripshift[14]; @@ -2291,7 +2292,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() irpc_clus_measphi = m_muonIdHelperTool->rpcIdHelper().measuresPhi(prd_id) ; const MuonGM::RpcReadoutElement* rpc = - m_muonMgr->getRpcRElement_fromIdFields(irpc_clus_station, irpc_clus_eta, irpc_clus_phi, + MuonDetMgr->getRpcRElement_fromIdFields(irpc_clus_station, irpc_clus_eta, irpc_clus_phi, irpc_clus_doublr, irpc_clus_doublz, irpc_clus_doublphi); if(rpc == NULL )continue; @@ -2374,7 +2375,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() if( irpc_clus_measphiII != irpc_clus_measphi ) continue ; // get the cluster position - const MuonGM::RpcReadoutElement* descriptorII = m_muonMgr->getRpcReadoutElement(prd_idII); + const MuonGM::RpcReadoutElement* descriptorII = MuonDetMgr->getRpcReadoutElement(prd_idII); const Amg::Vector3D stripPosCII = descriptorII->stripPos(prd_idII); @@ -2501,7 +2502,16 @@ StatusCode RPCStandaloneTracksMon::bookHistogramsRecurrent( ) ATH_MSG_DEBUG ( "RPCStandaloneTracksMon Histograms being booked" ); StatusCode sc = StatusCode::SUCCESS; - if( m_doRpcESD==true ) {if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD || m_environment == AthenaMonManager::online ) { + if( m_doRpcESD==true ) {if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD || m_environment == AthenaMonManager::online ) { + + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + //declare a group of histograms std::string generic_path_rpcmonitoring = "Muon/MuonRawDataMonitoring/RPCStandAloneTrackMon"; MonGroup rpcprd_shift( this, generic_path_rpcmonitoring+"/Overview", run, ATTRIB_UNMANAGED ) ; @@ -3417,7 +3427,7 @@ StatusCode RPCStandaloneTracksMon::bookHistogramsRecurrent( ) for ( int imeasphi=0; imeasphi!=2; imeasphi++ ) { for (int igap=0; igap!=2; igap++) { // need to pay attention to BME case - not yet considered here .... - const MuonGM::RpcReadoutElement* rpc = m_muonMgr->getRpcRElement_fromIdFields(iname, (ieta-8), int(i_sec/2)+1, ir+1, idbz+1, idbphi); + const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields(iname, (ieta-8), int(i_sec/2)+1, ir+1, idbz+1, idbphi); //std::cout <<" iname "<<iname <<" ieta "<<ieta-8 << " ir "<< ir<<" idbz "<<idbz << " idbphi "<<idbphi << " imeasphi "<< imeasphi<<" igap "<<igap<< std::endl; if ( rpc != NULL ) { @@ -4535,6 +4545,15 @@ void RPCStandaloneTracksMon::bookRPCLayerRadiographyHistograms( int isec, std::s if(sc.isFailure() ) return ; if( m_doRpcESD==true ) {if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD ) { + + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + char histName_char[100]; sprintf(histName_char,"Sector%.2d", isec+1 ) ; std::string sector_name = histName_char ; @@ -4570,14 +4589,14 @@ void RPCStandaloneTracksMon::bookRPCLayerRadiographyHistograms( int isec, std::s ir = 1 ; // doubletR=2 -> upgrade of Atlas } } - const MuonGM::RpcReadoutElement* rpc = m_muonMgr->getRpcRElement_fromIdFields(iName, 1, istatPhi, ir, 1, 1); + const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields(iName, 1, istatPhi, ir, 1, 1); int NphiStrips = 0; int NetaStripsTotSideA = 0; int NetaStripsTotSideC = 0; if(rpc != NULL ){ Identifier idr = rpc->identify(); - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),idr, 0) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),idr, 0) ; NphiStrips = rpcstripshift[0] ; NetaStripsTotSideA = rpcstripshift[6] ; NetaStripsTotSideC = rpcstripshift[7] ; @@ -4761,19 +4780,28 @@ void RPCStandaloneTracksMon::bookRPCCoolHistograms_NotNorm( std::vector<std::str } // end sectors 12 and 14 int NTotStripsSideA = 1; - int NTotStripsSideC = 1; + int NTotStripsSideC = 1; + + + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } int kName = iName ; if(kName==1)kName=53;//BMLE - const MuonGM::RpcReadoutElement* rpc = m_muonMgr->getRpcRElement_fromIdFields( kName, 1 , istatPhi+1, ir, 1, idblPhi+1 ); - const MuonGM::RpcReadoutElement* rpc_c = m_muonMgr->getRpcRElement_fromIdFields( kName, -1 , istatPhi+1, ir, 1, idblPhi+1 ); + const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields( kName, 1 , istatPhi+1, ir, 1, idblPhi+1 ); + const MuonGM::RpcReadoutElement* rpc_c = MuonDetMgr->getRpcRElement_fromIdFields( kName, -1 , istatPhi+1, ir, 1, idblPhi+1 ); if(rpc != NULL ){ Identifier idr = rpc->identify(); - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), idr, 0) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), idr, 0) ; NTotStripsSideA = rpcstripshift[6]+rpcstripshift[17]; Identifier idr_c = rpc_c->identify(); - std::vector<int> rpcstripshift_c = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), idr_c, 0) ; + std::vector<int> rpcstripshift_c = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), idr_c, 0) ; NTotStripsSideC = rpcstripshift_c[7]+rpcstripshift_c[18]; } @@ -4867,18 +4895,27 @@ void RPCStandaloneTracksMon::bookRPCCoolHistograms( std::vector<std::string>::co int NTotStripsSideA = 1; int NTotStripsSideC = 1; - + + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + + int kName = iName ; if(kName==1)kName=53;//BMLE - const MuonGM::RpcReadoutElement* rpc = m_muonMgr->getRpcRElement_fromIdFields( kName, 1 , istatPhi+1, ir, 1, idblPhi+1 ); - const MuonGM::RpcReadoutElement* rpc_c = m_muonMgr->getRpcRElement_fromIdFields( kName, -1 , istatPhi+1, ir, 1, idblPhi+1 ); + const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields( kName, 1 , istatPhi+1, ir, 1, idblPhi+1 ); + const MuonGM::RpcReadoutElement* rpc_c = MuonDetMgr->getRpcRElement_fromIdFields( kName, -1 , istatPhi+1, ir, 1, idblPhi+1 ); if(rpc != NULL ){ Identifier idr = rpc->identify(); - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), idr, 0) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), idr, 0) ; NTotStripsSideA = rpcstripshift[6]+rpcstripshift[17]; Identifier idr_c = rpc_c->identify(); - std::vector<int> rpcstripshift_c = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), idr_c, 0) ; + std::vector<int> rpcstripshift_c = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), idr_c, 0) ; NTotStripsSideC = rpcstripshift_c[7]+rpcstripshift_c[18]; } diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataEfficiency.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataEfficiency.cxx index a36c962c551d5db0571d6d89b4397edb80587fa0..feb8da559e182fcb72551149663ff9d09a184cc8 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataEfficiency.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataEfficiency.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////// @@ -54,7 +54,6 @@ StatusCode RpcLv1RawDataEfficiency::initialize() ATH_MSG_INFO( "In initializing 'RpcLv1RawDataEfficiency'" ); ATH_MSG_INFO( "Package version = "<< PACKAGE_VERSION ); - m_muonMgr = 0 ; m_trigtype = 0 ; m_event = 0 ; m_lumiblock = 0 ; @@ -79,7 +78,8 @@ StatusCode RpcLv1RawDataEfficiency::initialize() m_rpclv1_sectorhits_all[5]= 0 ; ATH_CHECK( m_muonIdHelperTool.retrieve() ); - ATH_CHECK( detStore()->retrieve(m_muonMgr) ); +// MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_MSG_DEBUG( "Found the MuonDetectorManager from detector store." ); ATH_CHECK(m_rpcCoinKey.initialize()); @@ -107,6 +107,13 @@ StatusCode RpcLv1RawDataEfficiency::readRpcCoinDataContainer() double x_atlas, y_atlas, z_atlas, phi_atlas, eta_atlas; int irpcstationEta; // for the switch of the eta in the coin matrix + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } for( it_container = rpc_coin_container->begin(); it_container != rpc_coin_container->end(); ++it_container ) { @@ -116,7 +123,7 @@ StatusCode RpcLv1RawDataEfficiency::readRpcCoinDataContainer() CoincidenceData* coindata = new CoincidenceData; coindata->SetThresholdLowHigh(int((*it_collection)->threshold()), int((*it_collection)->isLowPtCoin()), int((*it_collection)->isHighPtCoin())); prdcoll_id = (*it_collection)->identify(); - descriptor_Atl = m_muonMgr->getRpcReadoutElement( prdcoll_id ); + descriptor_Atl = MuonDetMgr->getRpcReadoutElement( prdcoll_id ); irpcstationEta = int(m_muonIdHelperTool->rpcIdHelper().stationEta(prdcoll_id)); x_atlas = descriptor_Atl->stripPos(prdcoll_id ).x(); y_atlas = descriptor_Atl->stripPos(prdcoll_id ).y(); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx index d2cf2ae1818141cbc581bf85384386f845c0af3a..1da4af92f62bf8bd0dd3642ef58e9f5e395f0b3c 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcLv1RawDataValAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -80,15 +80,8 @@ StatusCode RpcLv1RawDataValAlg::initialize() return StatusCode::FAILURE; } - // Retrieve the MuonDetectorManager - sc = detStore->retrieve(m_muonMgr); - if (sc.isFailure()) { - ATH_MSG_FATAL ( "Cannot get MuonDetectorManager from detector store" ); - return StatusCode::FAILURE; - } - else { - ATH_MSG_DEBUG ( " Found the MuonDetectorManager from detector store. " ); - } +// MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_muonIdHelperTool.retrieve() ); @@ -148,6 +141,14 @@ StatusCode RpcLv1RawDataValAlg::fillHistograms() ATH_MSG_DEBUG ( "GetTriggerType() "<< GetTriggerType() ); + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + int i_triggertimelowpt =-1 ; int i_triggertimehighpt =-1 ; int n_triggerlowpt = 0 ; @@ -702,7 +703,7 @@ if ( m_doCoolDB ) { // if (time==0) { // // get the digit position // const MuonGM::RpcReadoutElement* descriptor = - // m_muonMgr->getRpcReadoutElement(stripOfflineId); + // MuonDetMgr->getRpcReadoutElement(stripOfflineId); // // const HepGeom::Point3D<double> stripPos = descriptor->stripPos(stripOfflineId); // // TEMP : set the time of flight from the digit position @@ -714,8 +715,8 @@ if ( m_doCoolDB ) { std::vector<std::string> rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0) ; std::string sector_dphi_layer = rpclayersectorsidename[12] ; - std::vector<int> RpcStrip = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0); - int strip_dbindex = (RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0)).at(16);// cool strip profile + std::vector<int> RpcStrip = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0); + int strip_dbindex = (RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0)).at(16);// cool strip profile if ( m_doCoolDB ) { TH1* rpcCool_StripProfile = nullptr; if(cmaId==0||cmaId==2||cmaId==4||cmaId==6)sc = rpcCoolDb.getHist( rpcCool_StripProfile, sector_dphi_layer+"_ProfileDataCMeven" ) ; @@ -785,6 +786,14 @@ StatusCode RpcLv1RawDataValAlg::bookHistogramsRecurrent() MonGroup rpclv1prd_shift( this, generic_path_rpclv1monitoring +"/Overview", run, ATTRIB_UNMANAGED ); MonGroup rpclv1_shift_dqmf( this, generic_path_rpclv1monitoring + "/GLOBAL", run, ATTRIB_UNMANAGED ) ; MonGroup rpcCoolDb( this, generic_path_rpclv1monitoring+"/CoolDB", run, ATTRIB_UNMANAGED ) ; + + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } if(newRunFlag()) { @@ -1514,7 +1523,7 @@ StatusCode RpcLv1RawDataValAlg::bookHistogramsRecurrent() // if (time==0) { // // get the digit position // const MuonGM::RpcReadoutElement* descriptor = - // m_muonMgr->getRpcReadoutElement(stripOfflineId); + // MuonDetMgr->getRpcReadoutElement(stripOfflineId); // // const HepGeom::Point3D<double> stripPos = descriptor->stripPos(stripOfflineId); // // TEMP : set the time of flight from the digit position @@ -1526,8 +1535,8 @@ StatusCode RpcLv1RawDataValAlg::bookHistogramsRecurrent() std::vector<std::string> rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0) ; std::string sector_dphi_layer = rpclayersectorsidename[12] ; - std::vector<int> RpcStrip = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0); - int strip_dbindex = (RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0)).at(16);// cool strip profile + std::vector<int> RpcStrip = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0); + int strip_dbindex = (RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0)).at(16);// cool strip profile if ( m_doCoolDB ) { TH1* rpcCool_PanelIdHist = nullptr; sc = rpcCoolDb.getHist( rpcCool_PanelIdHist, sector_dphi_layer+"_ProfileCabling" ) ; @@ -1797,19 +1806,27 @@ void RpcLv1RawDataValAlg::bookRPCCoolHistograms( std::vector<std::string>::const int NTotStripsSideA = 1; int NTotStripsSideC = 1; - - const MuonGM::RpcReadoutElement* rpc = m_muonMgr->getRpcRElement_fromIdFields( kName, 1 , istatPhi+1, ir, 1, idblPhi+1 ); + + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + + const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields( kName, 1 , istatPhi+1, ir, 1, idblPhi+1 ); if(rpc != NULL ){ Identifier idr = rpc->identify(); - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),idr, 0) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),idr, 0) ; NTotStripsSideA = rpcstripshift[6]+rpcstripshift[17]; } - rpc = m_muonMgr->getRpcRElement_fromIdFields( kName, -1 , istatPhi+1, ir, 1, idblPhi+1 ); + rpc = MuonDetMgr->getRpcRElement_fromIdFields( kName, -1 , istatPhi+1, ir, 1, idblPhi+1 ); if(rpc != NULL ){ Identifier idr = rpc->identify(); - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),idr, 0) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),idr, 0) ; NTotStripsSideC = rpcstripshift[7]+rpcstripshift[18]; } @@ -1847,7 +1864,7 @@ void RpcLv1RawDataValAlg::bookRPCCoolHistograms( std::vector<std::string>::const if(abs(ieta-8)==7&&ir==2)irc=1; if(isec==12&&abs(ieta-8)==6&&ir==2)irc=1; - const MuonGM::RpcReadoutElement* rpc = m_muonMgr->getRpcRElement_fromIdFields(kName, ieta-8, istatPhi+1, irc, iz+1, idblPhi+1); + const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields(kName, ieta-8, istatPhi+1, irc, iz+1, idblPhi+1); if( rpc == NULL ) continue; if ( iz+1 != rpc->getDoubletZ() ) { @@ -1861,13 +1878,13 @@ void RpcLv1RawDataValAlg::bookRPCCoolHistograms( std::vector<std::string>::const for ( int istripEta=0; istripEta!=rpcElemEtaStrip; istripEta++ ) { Identifier strip_id = m_muonIdHelperTool->rpcIdHelper().channelID(idr, iz+1, idblPhi+1, ig+1, 0, istripEta+1) ; if( strip_id == 0 ) continue; - coolStripIndex = (RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),strip_id, 0)).at(16); + coolStripIndex = (RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),strip_id, 0)).at(16); rpcCool_PanelIdHist->Fill(coolStripIndex, -1) ; } for ( int istripPhi=0; istripPhi!=rpcElemPhiStrip; istripPhi++ ) { Identifier strip_id = m_muonIdHelperTool->rpcIdHelper().channelID(idr, iz+1, idblPhi+1, ig+1, 1, istripPhi+1) ; if( strip_id == 0 ) continue; - coolStripIndex = (RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(),strip_id, 0)).at(16); + coolStripIndex = (RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),strip_id, 0)).at(16); rpcCool_PanelIdHist->Fill(coolStripIndex, -1 ); } diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcRawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcRawDataValAlg.cxx index c2b858b2f457640091e18a5fcfe2d2844b764044..60ba823a795c1e967ae959b251c70ec240e68f67 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcRawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcRawDataValAlg.cxx @@ -22,7 +22,6 @@ #include "GeoPrimitives/GeoPrimitivesHelpers.h" #include "MuonReadoutGeometry/RpcReadoutSet.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MuonReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "RPCcablingInterface/IRPCcablingServerSvc.h" @@ -130,15 +129,8 @@ StatusCode RpcRawDataValAlg::initialize(){ return StatusCode::FAILURE; } - // Retrieve the MuonDetectorManager - sc = detStore->retrieve(m_muonMgr); - if (sc.isFailure()) { - ATH_MSG_FATAL( "Cannot get MuonDetectorManager from detector store" ); - return StatusCode::FAILURE; - } - else { - ATH_MSG_DEBUG ( " Found the MuonDetectorManager from detector store. " ); - } + // MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_muonIdHelperTool.retrieve() ); @@ -237,6 +229,14 @@ StatusCode RpcRawDataValAlg::fillHistograms() ATH_MSG_DEBUG ( "RpcRawDataValAlg::RPC RawData Monitoring Histograms being filled" ); if( m_doRpcESD==true ) { if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD || m_environment == AthenaMonManager::online ) { + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + //get lumiblock for analysis int lumiblock = -1 ; @@ -612,7 +612,7 @@ StatusCode RpcRawDataValAlg::fillHistograms() // std::cout << "irpcthreshold rpcCollection " << irpcthreshold << "\n"; // m_threshold: internal threshold - const MuonGM::RpcReadoutElement* descriptor_Atl = m_muonMgr->getRpcReadoutElement( prdcoll_id ); + const MuonGM::RpcReadoutElement* descriptor_Atl = MuonDetMgr->getRpcReadoutElement( prdcoll_id ); double x_atl = descriptor_Atl ->stripPos(prdcoll_id ).x() ; double y_atl = descriptor_Atl ->stripPos(prdcoll_id ).y() ; @@ -621,7 +621,7 @@ StatusCode RpcRawDataValAlg::fillHistograms() //get information from geomodel to book and fill rpc histos with the right max strip number - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), prdcoll_id, irpctriggerInfo) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), prdcoll_id, irpctriggerInfo) ; @@ -973,11 +973,11 @@ StatusCode RpcRawDataValAlg::fillHistograms() int irpcstripII = int(m_muonIdHelperTool->rpcIdHelper().strip(prdcoll_id_II)) ; - const MuonGM::RpcReadoutElement* descriptor_Atl_II = m_muonMgr->getRpcReadoutElement( prdcoll_id_II ); + const MuonGM::RpcReadoutElement* descriptor_Atl_II = MuonDetMgr->getRpcReadoutElement( prdcoll_id_II ); double z_atl_II = descriptor_Atl_II ->stripPos(prdcoll_id_II ).z() ; //get information from geomodel to book and fill rpc histos with the right max strip number - std::vector<int> rpcstripshiftII = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), prdcoll_id, irpctriggerInfo) ; + std::vector<int> rpcstripshiftII = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), prdcoll_id, irpctriggerInfo) ; if(irpcmeasuresPhi==1&&irpcmeasuresPhiII==0){ if(irpcstationPhi==irpcstationPhiII&&irpcstationName==irpcstationNameII&&irpcstationEta==irpcstationEtaII&& @@ -1238,7 +1238,7 @@ StatusCode RpcRawDataValAlg::fillHistograms() else if ( irpctriggerInfo==6 ) { m_RPC_Threshold_Phi->Fill( m_threshold ) ; } } - const MuonGM::RpcReadoutElement* descriptor_Atl = m_muonMgr->getRpcReadoutElement( prdcoll_id ); + const MuonGM::RpcReadoutElement* descriptor_Atl = MuonDetMgr->getRpcReadoutElement( prdcoll_id ); double x_atl = descriptor_Atl ->stripPos(prdcoll_id ).x() ; double y_atl = descriptor_Atl ->stripPos(prdcoll_id ).y() ; double z_atl = descriptor_Atl ->stripPos(prdcoll_id ).z() ; @@ -1254,7 +1254,7 @@ StatusCode RpcRawDataValAlg::fillHistograms() //get information from geomodel to book and fill rpc histos with the right max strip number - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), prdcoll_id, irpctriggerInfo) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), prdcoll_id, irpctriggerInfo) ; int NphiStrips = rpcstripshift[0] ; int ShiftPhiStrips = rpcstripshift[1] ; int NetaStrips = rpcstripshift[2] ; @@ -1345,7 +1345,7 @@ StatusCode RpcRawDataValAlg::fillHistograms() // std::cout << "elementID trig " << irpcstrip << " " << irpcstationName <<" "<< irpcstationEta <<" "<< irpcstationPhi <<" "<< irpcdoubletR << " " << irpctriggerInfo << "\n"; - const MuonGM::RpcReadoutElement* descriptor_Atl_prep = m_muonMgr->getRpcReadoutElement( prdConf_id ); + const MuonGM::RpcReadoutElement* descriptor_Atl_prep = MuonDetMgr->getRpcReadoutElement( prdConf_id ); double x_atl_prep = descriptor_Atl_prep ->stripPos(prdConf_id ).x() ; double y_atl_prep = descriptor_Atl_prep ->stripPos(prdConf_id ).y() ; double z_atl_prep = descriptor_Atl_prep ->stripPos(prdConf_id ).z() ; @@ -1589,11 +1589,11 @@ StatusCode RpcRawDataValAlg::fillHistograms() ((*rpcCoinCollection)->isHighPtCoin())*106 ); - const MuonGM::RpcReadoutElement* descriptor_Atl_II = m_muonMgr->getRpcReadoutElement( prdcoll_id_II ); + const MuonGM::RpcReadoutElement* descriptor_Atl_II = MuonDetMgr->getRpcReadoutElement( prdcoll_id_II ); double z_atl_II = descriptor_Atl_II ->stripPos(prdcoll_id_II ).z() ; //get information from geomodel to book and fill rpc histos with the right max strip number - std::vector<int> rpcstripshiftII = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), prdcoll_id, irpctriggerInfo) ; + std::vector<int> rpcstripshiftII = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), prdcoll_id, irpctriggerInfo) ; if(irpcmeasuresPhi==1&&irpcmeasuresPhiII==0&&irpctriggerInfo==irpctriggerInfoII){ if(irpcstationPhi==irpcstationPhiII&&irpcstationName==irpcstationNameII&&irpcstationEta==irpcstationEtaII&& @@ -1870,7 +1870,7 @@ StatusCode RpcRawDataValAlg::fillHistograms() //get information from geomodel to book and fill rpc histos with the right max strip number - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), prd_id, 0) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), prd_id, 0) ; int ShiftStrips = rpcstripshift[ 4] ; int ShiftEtaStripsTot = rpcstripshift[ 8] ; @@ -1969,8 +1969,8 @@ StatusCode RpcRawDataValAlg::fillHistograms() //evaluate average strip float avstripeta = 0 ; float avstripphi = av_strip ; - ShiftEtaStripsTot = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), prd_idII, 0)[8] ; // angelo 07 oct 2009 - EtaStripSign = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), prd_idII, 0)[10] ; // angelo 07 oct 2009 + ShiftEtaStripsTot = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), prd_idII, 0)[8] ; // angelo 07 oct 2009 + EtaStripSign = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), prd_idII, 0)[10] ; // angelo 07 oct 2009 for(int i=0; i!=irpc_clus_sizeII ; i++){ Identifier id = ((*rpcCollectionII)->rdoList())[i] ; @@ -2019,7 +2019,16 @@ StatusCode RpcRawDataValAlg::bookHistogramsRecurrent() ATH_MSG_DEBUG ( "RPC RawData Monitoring Histograms being booked" ); StatusCode sc = StatusCode::SUCCESS; - if( m_doRpcESD==true ) {if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD || m_environment == AthenaMonManager::online ) { + if( m_doRpcESD==true ) {if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD || m_environment == AthenaMonManager::online ) { + + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + //declare a group of histograms std::string generic_path_rpcmonitoring = "Muon/MuonRawDataMonitoring/RPC"; MonGroup rpcprd_shift( this, generic_path_rpcmonitoring+"/Overview", run, ATTRIB_UNMANAGED ); @@ -3428,11 +3437,11 @@ StatusCode RpcRawDataValAlg::bookHistogramsRecurrent() for(int ieta = -1; ieta != 1+1; ieta++ ){ if(ieta==0)continue; - const MuonGM::RpcReadoutElement* rpc = m_muonMgr->getRpcRElement_fromIdFields(iname, ieta, iphi, idr , 1, 1 ); + const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields(iname, ieta, iphi, idr , 1, 1 ); if(rpc == NULL )continue; Identifier idr = rpc->identify(); - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), idr, 0) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), idr, 0) ; int rpcpanel_dbindex = rpcstripshift[23]; int PlaneTipo = rpcstripshift[15]; int rpctower_dbindex = rpcstripshift[24]; @@ -4716,6 +4725,14 @@ void RpcRawDataValAlg::bookRPCCoolHistograms( std::vector<std::string>::const_it { StatusCode sc = StatusCode::SUCCESS ; + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + std::string generic_path_rpcmonitoring = "Muon/MuonRawDataMonitoring/RPC"; MonGroup rpcCoolDb( this, generic_path_rpcmonitoring+"/CoolDB", run, ATTRIB_UNMANAGED ); @@ -4801,15 +4818,15 @@ void RpcRawDataValAlg::bookRPCCoolHistograms( std::vector<std::string>::const_it int kName = iName ; if(kName==1)kName=53;//BMLE - const MuonGM::RpcReadoutElement* rpc = m_muonMgr->getRpcRElement_fromIdFields( kName, 1 , istatPhi+1, ir, 1, idblPhi+1 ); - const MuonGM::RpcReadoutElement* rpc_c = m_muonMgr->getRpcRElement_fromIdFields( kName, -1 , istatPhi+1, ir, 1, idblPhi+1 ); + const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields( kName, 1 , istatPhi+1, ir, 1, idblPhi+1 ); + const MuonGM::RpcReadoutElement* rpc_c = MuonDetMgr->getRpcRElement_fromIdFields( kName, -1 , istatPhi+1, ir, 1, idblPhi+1 ); if(rpc != NULL ){ Identifier idr = rpc->identify(); - std::vector<int> rpcstripshift = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), idr, 0) ; + std::vector<int> rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), idr, 0) ; NTotStripsSideA = rpcstripshift[6]+rpcstripshift[17]; Identifier idr_c = rpc_c->identify(); - std::vector<int> rpcstripshift_c = RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), idr_c, 0) ; + std::vector<int> rpcstripshift_c = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), idr_c, 0) ; NTotStripsSideC = rpcstripshift_c[7]+rpcstripshift_c[18]; } @@ -4846,7 +4863,7 @@ void RpcRawDataValAlg::bookRPCCoolHistograms( std::vector<std::string>::const_it if(abs(ieta-8)==7&&ir==2&&kNameF==2)irc=1; if(isec==12&&abs(ieta-8)==6&&ir==2&&kNameF==2)irc=1; - const MuonGM::RpcReadoutElement* rpc = m_muonMgr->getRpcRElement_fromIdFields(kNameF, ieta-8, istatPhi+1, irc, iz+1, idblPhi+1); + const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields(kNameF, ieta-8, istatPhi+1, irc, iz+1, idblPhi+1); if( rpc == NULL ) continue; if ( iz+1 != rpc->getDoubletZ() ) { @@ -4865,7 +4882,7 @@ void RpcRawDataValAlg::bookRPCCoolHistograms( std::vector<std::string>::const_it //std::cout << istripEta << " ETA FOUND!!! and panel_Id= " << panel_id << " " <<panel_id.get_identifier32().get_compact() << " " << strip_id<<std::endl; //} if( strip_id == 0 ) continue; - coolStripIndex = (RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), strip_id, 0)).at(16); + coolStripIndex = (RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), strip_id, 0)).at(16); //std::cout << " coolStripIndex "<<coolStripIndex << " kNameF, eta, irc, iz+1, idblPhi+1, ig+1, istripEta+1 "<<kNameF << " " <<ieta-8 <<" " <<irc << " "<< iz+1<< " "<< idblPhi+1<< " "<< ig+1 << " "<< " "<< istripEta+1<< " "<<std::endl; //if(panel_id.get_identifier32().get_compact()<1000)std::cout<< "Less than 1000: " << panel_id.get_identifier32().get_compact()<<std::endl; m_rpcCool_PanelIdHist->Fill(coolStripIndex, panel_id.get_identifier32().get_compact()) ; @@ -4880,7 +4897,7 @@ void RpcRawDataValAlg::bookRPCCoolHistograms( std::vector<std::string>::const_it //} if( strip_id == 0 ) continue; - coolStripIndex = (RpcGM::RpcStripShift(m_muonMgr,m_muonIdHelperTool->rpcIdHelper(), strip_id, 0)).at(16); + coolStripIndex = (RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), strip_id, 0)).at(16); //std::cout << " coolStripIndex "<<coolStripIndex << " kNameF, eta, irc, iz+1, idblPhi+1, ig+1, istripPhi+1 "<<kNameF << " " <<ieta-8 <<" " <<irc << " "<< iz+1<< " "<< idblPhi+1<< " "<< ig+1 << " "<< " "<< istripPhi+1<< " "<< std::endl; //if(panel_id.get_identifier32().get_compact()<1000)std::cout<< "Less than 1000: " << panel_id.get_identifier32().get_compact()<<std::endl; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcLv1RawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcLv1RawDataValAlg.h index 6318d6f7c14444824aee62c6a0303653c324d763..f2df1fc3b87d9ddb4b8850ff256dad2fd3ab2fd7 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcLv1RawDataValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcLv1RawDataValAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////////////////////// @@ -24,7 +24,6 @@ #include "AthenaMonitoring/ManagedMonitorToolBase.h" #include "MuonDQAUtils/MuonDQAHistMap.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "GaudiKernel/Algorithm.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataValAlg.h index 9648c015dae350743de0a143d59dd6e294d69744..456915f7f4fa182fe26a3d306c8e372170d1b5dd 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataMonitoring/TgcRawDataValAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -26,9 +26,9 @@ #include "AthenaMonitoring/ManagedMonitorToolBase.h" #include "MuonDQAUtils/MuonDQAHistMap.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "MuonTrigCoinData/TgcCoinDataContainer.h" @@ -73,9 +73,6 @@ public: private: - // Muon Detector Manager - const MuonGM::MuonDetectorManager* m_muonMgr = nullptr; - // Tool for TGC Id Helper ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; @@ -94,6 +91,11 @@ private: SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_tgcPrepDataNextContainerName{this,"TgcPrepDataNextContainer","TGC_MeasurementsNextBC","next BC TGC PRD"}; SG::ReadHandleKey<Muon::TgcCoinDataContainer> m_outputCoinCollectionLocation{this,"OutputCoinCollection","TrigT1CoinDataCollection","TGC T1 coincidences"}; SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this,"EventInfo","EventInfo","EventInfo"}; + + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; // Enum style indexes static const int PREV=0, CURR=1, NEXT=2, TOTA=3; //PCNT index diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg.cxx index 42cd28bca549b4e2c19a396a79c25238b0e4b63c..c7dca9ab16a57c76cbb0edc44b0d74c087dc68dd 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -20,7 +20,6 @@ #include "MuonRDO/TgcRdoIdHash.h" // GeoModel -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutParams.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_CoincidenceWindow.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_CoincidenceWindow.cxx index ec51192d5f17a87d68963c357864772ba0a54840..79fef35eb35ba09b9771b9a293d36af32dd480f5 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_CoincidenceWindow.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_CoincidenceWindow.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -20,7 +20,6 @@ #include "MuonRDO/TgcRdoIdHash.h" // GeoModel -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutParams.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Efficiency.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Efficiency.cxx index 8c109c29e92009527d260cf51a1378811ac19fbc..52aab441d6ccdbf157056fa91d810c3b4ceecb0e 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Efficiency.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Efficiency.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -20,7 +20,6 @@ #include "MuonRDO/TgcRdoIdHash.h" // GeoModel -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutParams.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_NumberOfTrigger.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_NumberOfTrigger.cxx index 4f7e8c7170d4aa64f0cbb7bec12c825c15d07140..61402c8f8fa085efb5e3e2e403f7a2f4d37dea54 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_NumberOfTrigger.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_NumberOfTrigger.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,6 @@ #include "StoreGate/DataHandle.h" // GeoModel -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutParams.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx index 59e97ea5b013a3665313ceeb503962aff8f7663c..b4c1257086c8dd6fa8b207feb17ba27bd1df9344 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_ReadContainer.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -22,7 +22,6 @@ #include "MuonRDO/TgcRdoIdHash.h" // GeoModel -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutParams.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Summary_LowStat.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Summary_LowStat.cxx index 404e3d89d8315c3f0628f166bf4f6753f2723eb8..727115e7f85be0acf973469e00a56f3abe2799d4 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Summary_LowStat.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_Summary_LowStat.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -20,7 +20,6 @@ #include "MuonRDO/TgcRdoIdHash.h" // GeoModel -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutParams.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_TriggerTiming.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_TriggerTiming.cxx index c7dde6a2f472c7a48e7f43daceae9b9b697c967d..6913df653718158076914695df9063f2cd4361c4 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_TriggerTiming.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcLv1RawDataValAlg_TriggerTiming.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -16,7 +16,6 @@ #include "StoreGate/DataHandle.h" // GeoModel -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutParams.h" #include "MuonDQAUtils/MuonChamberNameConverter.h" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg.cxx index 48887066e7dbe99f471be68e75e45602006b33e5..3ef0489d10056741a091afe5edee49cc5c616d90 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -71,9 +71,8 @@ TgcRawDataValAlg::initialize(){ ATH_CHECK( ManagedMonitorToolBase::initialize() ); - // Retrieve the MuonDetectorManager - ATH_CHECK( detStore()->retrieve(m_muonMgr) ); - ATH_MSG_DEBUG( " Found the MuonDetectorManager from detector store. " ); +// MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_muonIdHelperTool.retrieve() ); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Efficiency.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Efficiency.cxx index 0e6a8de9b31fcd9ba836097ec20604735d106ee0..22dc749203916be123648562f88220e1a8bd3564 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Efficiency.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Efficiency.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -383,6 +383,14 @@ TgcRawDataValAlg::fillEfficiency(){ // Retrieve current coincidence container from storegate SG::ReadHandle<Muon::TgcCoinDataContainer> tgc_trg_container(m_outputCoinCollectionLocation); + + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } // Loop over TGCCoinContainer Muon::TgcCoinDataContainer::const_iterator it_end=tgc_trg_container->end(); @@ -407,7 +415,7 @@ TgcRawDataValAlg::fillEfficiency(){ // Get channel position Identifier id = tcd->channelIdIn(); - const MuonGM::TgcReadoutElement* pReadoutElementTGC = m_muonMgr->getTgcReadoutElement(id); + const MuonGM::TgcReadoutElement* pReadoutElementTGC = MuonDetMgr->getTgcReadoutElement(id); const Amg::Vector3D channelPos = pReadoutElementTGC->channelPos(id); //global position // Add position information to vectors @@ -422,7 +430,7 @@ TgcRawDataValAlg::fillEfficiency(){ // Get channel position Identifier id = tcd->channelIdIn(); - const MuonGM::TgcReadoutElement* pReadoutElementTGC = m_muonMgr->getTgcReadoutElement(id); + const MuonGM::TgcReadoutElement* pReadoutElementTGC = MuonDetMgr->getTgcReadoutElement(id); const Amg::Vector3D channelPos = pReadoutElementTGC->channelPos(id); //global position // Add position information to vectors @@ -471,7 +479,7 @@ TgcRawDataValAlg::fillEfficiency(){ if(m_hitIdVects[CURR][ac][ws][eta][phi48][l].size()==1){ // Fill channel variables chIds[ws][l] = m_muonIdHelperTool->tgcIdHelper().channel(m_hitIdVects[CURR][ac][ws][eta][phi48][l].at(0)) + m_SLBoffset[ws][ac][eta][l]; - const MuonGM::TgcReadoutElement* pReadoutElementTGC = m_muonMgr->getTgcReadoutElement(m_hitIdVects[CURR][ac][ws][eta][phi48][l].at(0)); + const MuonGM::TgcReadoutElement* pReadoutElementTGC = MuonDetMgr->getTgcReadoutElement(m_hitIdVects[CURR][ac][ws][eta][phi48][l].at(0)); const Amg::Vector3D channelPos = pReadoutElementTGC->channelPos(m_hitIdVects[CURR][ac][ws][eta][phi48][l].at(0)); //global position chEtas[ws][l] = channelPos.eta(); chPhis[ws][l] = channelPos.phi(); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Functions.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Functions.cxx index f4f0442d24008dd9693f72de301aee59bb69bf47..03a77cb320776ad27478f281974be291ac56219b 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Functions.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Functions.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_NumberOfHits.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_NumberOfHits.cxx index 2ab8f41e2232a061766a4ff692825377888ebfc0..672d5f4f0a6ce8869ba06e7848e3769c8dd20bd6 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_NumberOfHits.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_NumberOfHits.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Profile.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Profile.cxx index 4ddf4b527fedc12ffa4c1177bab91078f46533f3..fa38ca1d764457745d136cfd41175eb53804366d 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Profile.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Profile.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_ReadContainer.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_ReadContainer.cxx index 14a5382596f2cc738f7e17a577da172680297b29..015934d781b8ab72888b3baedef72f2fa934cd98 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_ReadContainer.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_ReadContainer.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -84,6 +84,15 @@ TgcRawDataValAlg::readTgcPrepDataContainer(const Muon::TgcPrepDataContainer* tgc /////////////////////////////////////////////////////////////////////////// // Loop over TgcPrepDataContainer if(pcn!=TOTA){ + + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + // PREV/CURR/NEXT timing Muon::TgcPrepDataContainer::const_iterator container_end=tgc_prep_container->end(); for(Muon::TgcPrepDataContainer::const_iterator containerIt=tgc_prep_container->begin(); @@ -155,7 +164,7 @@ TgcRawDataValAlg::readTgcPrepDataContainer(const Muon::TgcPrepDataContainer* tgc layer, sector, dummy1, sectorPhi); // Get channel position - const MuonGM::TgcReadoutElement* pReadoutElementTGC = m_muonMgr->getTgcReadoutElement(elementID); + const MuonGM::TgcReadoutElement* pReadoutElementTGC = MuonDetMgr->getTgcReadoutElement(elementID); const Amg::Vector3D channelPos = pReadoutElementTGC->channelPos(elementID); // attention //const HepGeom::Point3D<double> channelPos = pReadoutElementTGC->channelPos(elementID); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_SetOffset.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_SetOffset.cxx index 8251ef5574658b0d45e1c116ef193dd5fc4f3160..c75c51624ba142ef51aa90fcc1510c685db15444 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_SetOffset.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_SetOffset.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Summary_LowStat.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Summary_LowStat.cxx index cc3e47c61a13c42f72d04036016a1bc18a480953..769f3fb52fc6f1386d1e10eaa34be911d24fa751 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Summary_LowStat.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_Summary_LowStat.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_XYView.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_XYView.cxx index a0da75e837bb957df8cae617904349b19340e215..3a3a3b2cd1e1f750e6266f9e2159e82eb81a5438 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_XYView.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataValAlg_XYView.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMCheckCorners.cxx b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMCheckCorners.cxx index b664d5ed74ef395ede8e7b234c1c806a59db78e3..49665ac392fae66b5bd92dcb4d09bc9840f7a2c7 100644 --- a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMCheckCorners.cxx +++ b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMCheckCorners.cxx @@ -52,12 +52,7 @@ typedef std::istringstream mystream; MuonGMCheckCorners::MuonGMCheckCorners(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm ( name, pSvcLocator ), p_EventStore ( 0 ), - p_ActiveStore ( 0 ), - p_MuonMgr ( 0 ), - p_RpcIdHelper ( 0 ), - p_TgcIdHelper ( 0 ), - p_CscIdHelper ( 0 ), - p_MdtIdHelper ( 0 ) + p_ActiveStore ( 0 ) { m_check_surfaces = 0; @@ -119,26 +114,9 @@ MuonGMCheckCorners::initialize() } else ini_log << MSG::DEBUG << " ActiveStoreSvc found" << endmsg; - StoreGateSvc* detStore=0; - status = serviceLocator()->service("DetectorStore", detStore); - if ( status.isSuccess() ) { - status = detStore->retrieve( p_MuonMgr ); - if ( status.isFailure() ) { - ini_log << MSG::ERROR << " Cannot retrieve MuonDetectorManager " << endmsg; - } - else - { - ini_log << MSG::DEBUG << " MuonDetectorManager is retriven " << endmsg; - p_CscIdHelper = p_MuonMgr->cscIdHelper(); - p_RpcIdHelper = p_MuonMgr->rpcIdHelper(); - p_TgcIdHelper = p_MuonMgr->tgcIdHelper(); - p_MdtIdHelper = p_MuonMgr->mdtIdHelper(); - ini_log << MSG::DEBUG << " Id Helpers are obtained from MuonDetectorManager " << endmsg; - } - } - else { - ini_log << MSG::ERROR << " DetectorStore not accessible" << endmsg; - } + + ATH_CHECK(m_idHelperSvc.retrieve()); + if (status == StatusCode::SUCCESS) { if (m_check_csc) checkreadoutcscgeo(); if (m_check_mdt) checkreadoutmdtgeo(); diff --git a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMCheckCorners.h b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMCheckCorners.h index 1f0c1d094069516a64044bf9017b95d862fd0e80..3507a7c2d72125034604d4634966742bb1a3e030 100644 --- a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMCheckCorners.h +++ b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMCheckCorners.h @@ -21,7 +21,8 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/NTuple.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonReadoutGeometry/MuonReadoutElement.h" #include "MuonIdHelpers/MdtIdHelper.h" #include "MuonIdHelpers/CscIdHelper.h" @@ -82,12 +83,7 @@ class MuonGMCheckCorners: public AthAlgorithm StoreGateSvc* p_EventStore; ActiveStoreSvc* p_ActiveStore; - // Pointer to MuonDetectorManager (imt addition) - const MuonGM::MuonDetectorManager* p_MuonMgr; - const RpcIdHelper* p_RpcIdHelper; - const TgcIdHelper* p_TgcIdHelper; - const CscIdHelper* p_CscIdHelper; - const MdtIdHelper* p_MdtIdHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; void checkreadoutcscgeo(); void checkreadoutrpcgeo(); diff --git a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.cxx b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.cxx index f9c356867c980e9d9441fe26a2796188cbaa0149..f373254a8db11d8f5cc9b7df36a3da84ad81dae7 100644 --- a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.cxx +++ b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.cxx @@ -4,7 +4,6 @@ #include "MuonGMNtupleWriter.h" #include "GaudiKernel/ITHistSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" @@ -20,8 +19,7 @@ namespace MuonGM { AthAlgorithm(name,pSvcLocator), //m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_tree(0), - m_nevents(0), - m_detMgr(NULL) + m_nevents(0) { declareProperty("NtupleFileName", m_ntupleFileName = "MuonGMNtuple"); declareProperty("NtupleDirectoryName", m_ntupleDirName = "MuonGM"); @@ -36,10 +34,8 @@ namespace MuonGM { StatusCode MuonGMNtupleWriter::initialize() { - if (detStore()->retrieve( m_detMgr ).isFailure()){ - ATH_MSG_ERROR("Cannot retrieve MuonDetectorManager"); - return StatusCode::FAILURE; - } + // MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); std::string streamName = "/"+m_ntupleFileName+"/"+m_ntupleDirName; std::string treeName = m_ntupleTreeName; @@ -79,9 +75,17 @@ namespace MuonGM { void MuonGMNtupleWriter::fillNtuple() { + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return; + } + std::ofstream* fout = 0; if( m_outputToTextFile ){ - std::string gVersion = m_detMgr->geometryVersion(); + std::string gVersion = MuonDetMgr->geometryVersion(); std::string fileName = "muon_current_"+gVersion; fout = new std::ofstream(fileName.c_str()); } @@ -94,12 +98,12 @@ namespace MuonGM { for( int i2 = 0;i2<MuonDetectorManager::NMdtStatEta; ++i2 ){ for( int i3 = 0;i3<MuonDetectorManager::NMdtStatPhi; ++i3 ){ for( int i4 = 0;i4<MuonDetectorManager::NMdtMultilayer; ++i4 ){ - const MdtReadoutElement* detEl = m_detMgr->getMdtReadoutElement(i1,i2,i3,i4); + const MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(i1,i2,i3,i4); if( !detEl ) continue; ++nmdt; if( fout ) { (*fout) << " New MDT ReadoutElement " << detEl->identify().get_compact() - << " " << m_detMgr->mdtIdHelper()->print_to_string(detEl->identify()) // m_idHelper->toStringDetEl(detEl->identify() ) + << " " << MuonDetMgr->mdtIdHelper()->print_to_string(detEl->identify()) // m_idHelper->toStringDetEl(detEl->identify() ) << " nlayers " << detEl->getNLayers() << " ntubes " << detEl->getNtubesperlayer() << std::endl << Amg::toString( detEl->transform(),6 ) << std::endl; } @@ -125,13 +129,13 @@ namespace MuonGM { for( int i3 = 0;i3<MuonDetectorManager::NRpcStatPhi; ++i3 ){ for( int i4 = 0;i4<MuonDetectorManager::NDoubletR; ++i4 ){ for( int i5 = 0;i5<MuonDetectorManager::NDoubletZ; ++i5 ){ - const RpcReadoutElement* detEl = m_detMgr->getRpcReadoutElement(i1,i2,i3,i4,i5); + const RpcReadoutElement* detEl = MuonDetMgr->getRpcReadoutElement(i1,i2,i3,i4,i5); if( !detEl ) continue; ++nrpc; if( fout ) { (*fout) << " New RPC ReadoutElement " << detEl->identify().get_compact() - << " " << m_detMgr->rpcIdHelper()->print_to_string(detEl->identify()) // m_idHelper->toStringDetEl(detEl->identify() ) + << " " << MuonDetMgr->rpcIdHelper()->print_to_string(detEl->identify()) // m_idHelper->toStringDetEl(detEl->identify() ) << " NphiStripPanels " << detEl->NphiStripPanels() << std::endl << Amg::toString( detEl->transform(),6 ) << std::endl; } @@ -157,13 +161,13 @@ namespace MuonGM { for( int i2 = 0;i2<MuonDetectorManager::NTgcStatEta; ++i2 ){ for( int i3 = 0;i3<MuonDetectorManager::NTgcStatPhi; ++i3 ){ - const TgcReadoutElement* detEl = m_detMgr->getTgcReadoutElement(i1,i2,i3); + const TgcReadoutElement* detEl = MuonDetMgr->getTgcReadoutElement(i1,i2,i3); if( !detEl ) continue; ++ntgc; if( fout ) { (*fout) << " New TGC ReadoutElement " << detEl->identify().get_compact() - << " " << m_detMgr->tgcIdHelper()->print_to_string(detEl->identify()) << std::endl + << " " << MuonDetMgr->tgcIdHelper()->print_to_string(detEl->identify()) << std::endl << Amg::toString( detEl->transform(),6 ) << std::endl; } @@ -183,13 +187,13 @@ namespace MuonGM { for( int i1 = 0;i1<MuonDetectorManager::NCscStatType; ++i1 ){ for( int i2 = 0;i2<MuonDetectorManager::NCscStatEta; ++i2 ){ for( int i3 = 0;i3<MuonDetectorManager::NCscStatPhi; ++i3 ){ - const CscReadoutElement* detEl = m_detMgr->getCscReadoutElement(i1,i2,i3,1); + const CscReadoutElement* detEl = MuonDetMgr->getCscReadoutElement(i1,i2,i3,1); if( !detEl ) continue; ++ncsc; if( fout ) { (*fout) << " New CSC ReadoutElement " << detEl->identify().get_compact() - << " " << m_detMgr->cscIdHelper()->print_to_string(detEl->identify()) << std::endl + << " " << MuonDetMgr->cscIdHelper()->print_to_string(detEl->identify()) << std::endl << Amg::toString( detEl->transform(),6 ) << std::endl; } diff --git a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.h b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.h index 82a308ffd42b0d4e76f53bf8647dc6fbc3b8c32e..e7373f70fb47782500ba29c746572a6e5a8f339c 100644 --- a/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.h +++ b/MuonSpectrometer/MuonValidation/MuonGeomTest/src/MuonGMNtupleWriter.h @@ -9,6 +9,7 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "TrkValidationUtils/SurfaceNtupleBranch.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" class TTree; @@ -18,8 +19,6 @@ namespace Muon { namespace MuonGM { - class MuonDetectorManager; - /** @class MuonGMNtupleWriter BAsic MuonGM Ntuple dumper @@ -59,7 +58,11 @@ namespace MuonGM { Trk::SurfaceNtupleBranch m_mdtSurfaceBranch; - const MuonGM::MuonDetectorManager* m_detMgr; + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + bool m_outputToTextFile; }; diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx index 652cd30ea4f01bc1efa2cfd7d7923ec9249d0a5c..0411bb9b98b7ae22285cca92542f09ea18aaf940 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.cxx @@ -16,7 +16,7 @@ /** ---------- filling of variables */ /** ---------- to be called on each evt i.e. execute level of main alg */ -StatusCode CSCDigitVariables::fillVariables() +StatusCode CSCDigitVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_DEBUG("do fillCSCDigitVariables()"); @@ -73,7 +73,7 @@ StatusCode CSCDigitVariables::fillVariables() m_CSC_dig_gas_gap->push_back(gas_gap); m_CSC_dig_channel->push_back(channel); - const MuonGM::CscReadoutElement* rdoEl = m_detManager->getCscReadoutElement(Id); + const MuonGM::CscReadoutElement* rdoEl = MuonDetMgr->getCscReadoutElement(Id); // retrieve the MC truth associated with the digit (means the Geant4 hit information) if (csc_SdoContainer) { diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.h index 88b8cc6464e3d2613a1cc43809680791664e99fc..e1524e617d15d34d15f2cf96e93023f4f62e87db 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/CSCDigitVariables.h @@ -46,7 +46,7 @@ ValAlgVariables(evtStore, detManager, tree, containername, msglvl), } StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx index 9f503d1eb97d0255f0a37529339a830b218c49af..03bbdb17b5226521132d5b45cfff1650256834ed 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx @@ -18,7 +18,6 @@ #include "HepMC/GenParticle.h" #include "TrackRecord/TrackRecordCollection.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonIdHelpers/MdtIdHelper.h" @@ -55,7 +54,6 @@ MDTPRDValAlg::MDTPRDValAlg(const std::string& name, AthAlgorithm(name, pSvcLocator), m_mdttree(0), m_event_counter(0), - m_pMuonMgr(0), m_log(0), m_debug(false), m_verbose(false), @@ -171,13 +169,8 @@ StatusCode MDTPRDValAlg::initialize() /**Locate the StoreGateSvc and initialize our local ptr intitialize transient event store */ - StatusCode sc = detStore()->retrieve( m_pMuonMgr ); - if (sc.isFailure()){ - *m_log << MSG::ERROR << "Cannot retrieve MuonDetectorManager" << endmsg; - return sc; - } - sc = m_muonIdHelperTool.retrieve(); + StatusCode sc = m_muonIdHelperTool.retrieve(); if (sc.isFailure()){ *m_log << MSG::ERROR << "Cannot retrieve MuonIdHelperTool" << endmsg; return sc; diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.h index 356576340c3d79b53de104966ea52d51ab0f569b..4c08fc4afc493a6ef1760df4f61c889b2cac4e9a 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.h @@ -34,7 +34,6 @@ class MsgStream; // pre-declarations namespace MuonGM { class MdtReadoutElement; - class MuonDetectorManager; } class MDTPRDValAlg: public AthAlgorithm { @@ -131,9 +130,6 @@ class MDTPRDValAlg: public AthAlgorithm { int m_StationPhi; int m_LastEvent; - /**Pointer On MuonDetectorManager */ - const MuonGM::MuonDetectorManager* m_pMuonMgr; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx index 365ef9a48df3ea653f9af03794f1375761707632..34273f34ff51f529b7ba4d504b6033357ecf7f1c 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.cxx @@ -14,7 +14,7 @@ /** ---------- filling of variables */ /** ---------- to be called on each evt i.e. execute level of main alg */ -StatusCode MMDigitVariables::fillVariables() +StatusCode MMDigitVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_DEBUG("do fillNSWMMDigitVariables()"); @@ -66,7 +66,7 @@ StatusCode MMDigitVariables::fillVariables() // get the readout element class where the digit is recorded int isSmall = (stName[2] == 'S'); - const MuonGM::MMReadoutElement* rdoEl = m_detManager->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); + const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); // information from VMM chip std::vector<float> time = digit->chipResponseTime(); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.h index 30c3c8a708267e9b6e04c7fef9bd531c6e393055..42691f729ba11ab49d4cec56467a49040a534b82 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMDigitVariables.h @@ -60,7 +60,7 @@ class MMDigitVariables : public ValAlgVariables } StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx index cee1f14959aca6b6457b38b7a8c8c4da25407e7b..b026d68d98d17e1a6750fe6a02944ad7266348e9 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.cxx @@ -19,9 +19,10 @@ #include "TTree.h" -StatusCode MMPRDVariables::fillVariables() +StatusCode MMPRDVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_DEBUG(" do fillNSWMMPRDVariables()"); + ATH_MSG_VERBOSE("MuonDetectorManager from Conditions Store accessed" << MuonDetMgr); CHECK( this->clearVariables() ); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.h index f981631464c229e3d28c47ee16f58b3345e71dd1..d56902729ce08b9537dd1323e2af3691dec6eddc 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMPRDVariables.h @@ -14,11 +14,11 @@ class MMPRDVariables : public ValAlgVariables { public: MMPRDVariables(StoreGateSvc* evtStore, - const MuonGM::MuonDetectorManager* detManager, - const MuonIdHelper* idhelper, - TTree* tree, - std::string containername, - MSG::Level msglvl) : + const MuonGM::MuonDetectorManager* detManager, + const MuonIdHelper* idhelper, + TTree* tree, + std::string containername, + MSG::Level msglvl) : ValAlgVariables(evtStore, detManager, tree, containername, msglvl), m_MmIdHelper(0), m_NSWMM_nPRDs(0), @@ -51,7 +51,7 @@ class MMPRDVariables : public ValAlgVariables } StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx index 4446264704aa9619ab0ad21b110c81f91546d592..12f22517915101ebc6d9f1e3a168ed88e4b70f18 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.cxx @@ -17,7 +17,7 @@ using namespace Muon; /** ---------- filling of variables */ /** ---------- to be called on each evt i.e. execute level of main alg */ -StatusCode MMRDOVariables::fillVariables() +StatusCode MMRDOVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_DEBUG("do fillNSWMMRDOVariables()"); @@ -69,7 +69,7 @@ StatusCode MMRDOVariables::fillVariables() // get the readout element class where the RDO is recorded int isSmall = (stName[2] == 'S'); - const MuonGM::MMReadoutElement* rdoEl = m_detManager->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); + const MuonGM::MMReadoutElement* rdoEl = MuonDetMgr->getMMRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); Amg::Vector2D localStripPos(0.,0.); if ( rdoEl->stripPosition(Id,localStripPos) ) { diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.h index 4eac77ac855dfc078fbe88b9232cc7f55f346b38..8c1ead20bd3e7a90f4561633f7673525c4987571 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMRDOVariables.h @@ -45,7 +45,7 @@ class MMRDOVariables : public ValAlgVariables } StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSDOVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSDOVariables.cxx index e63b03c8fbbfd26d80afded4e03c79a911c6fc55..ae6d074c7f4668f77a759972eb1fccbf63779a47 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSDOVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSDOVariables.cxx @@ -10,9 +10,10 @@ #include "TTree.h" -StatusCode MMSDOVariables::fillVariables() +StatusCode MMSDOVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_DEBUG(" do fillNSWMMSDOVariables()"); + ATH_MSG_VERBOSE("MuonDetectorManager from Conditions Store accessed" << MuonDetMgr); ATH_CHECK( this->clearVariables() ); @@ -186,4 +187,4 @@ StatusCode MMSDOVariables::initializeVariables() } return StatusCode::SUCCESS; -} \ No newline at end of file +} diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSDOVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSDOVariables.h index 71bce331df5e5129398006eae0f217346cc14733..78d35bbc7926667ed1351c9e4debe5b472c71729 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSDOVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSDOVariables.h @@ -47,7 +47,7 @@ class MMSDOVariables : public ValAlgVariables } StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx index c90e0d1443f0105170668b67926e986fe4cdc9d5..7a333373335253efda27dcdecca49a5785362545 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.cxx @@ -15,7 +15,7 @@ #include "TTree.h" -StatusCode MMSimHitVariables::fillVariables() +StatusCode MMSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_INFO("do fillNSWMMHitVariables()"); @@ -132,7 +132,7 @@ StatusCode MMSimHitVariables::fillVariables() ATH_MSG_DEBUG("MicroMegas geometry, retrieving detector element for: isSmall " << isSmall << " eta " << m_MmIdHelper->stationEta(offId) << " phi " << m_MmIdHelper->stationPhi(offId) << " ml " << m_MmIdHelper->multilayer(offId) ); - const MuonGM::MMReadoutElement* detEl = m_detManager->getMMReadoutElement(offId); + const MuonGM::MMReadoutElement* detEl = MuonDetMgr->getMMReadoutElement(offId); if( !detEl ){ ATH_MSG_WARNING("MicroMegas geometry, failed to retrieve detector element for: " << m_MmIdHelper->print_to_string(offId) ); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.h index c06b26b27ebfd52521ca929beacd1e2ab5fd0d5d..f6cfe49f683e878a81a6c2fa8e129f0648d766bb 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MMSimHitVariables.h @@ -70,7 +70,7 @@ class MMSimHitVariables : public ValAlgVariables } StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MuEntryVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MuEntryVariables.cxx index 4e26777f27db1d3e524866c6cfcc9edcef935de4..54a9740203e1553f7a30d8f5a7224d2a79f17358 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MuEntryVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MuEntryVariables.cxx @@ -12,10 +12,11 @@ /** ---------- filling of variables */ /** ---------- to be called on each evt i.e. execute level of main alg */ -StatusCode MuEntryVariables::fillVariables() +StatusCode MuEntryVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_INFO("do fillNSWMuEntryVariables()"); + ATH_MSG_VERBOSE("MuonDetectorManager from Conditions Store accessed" << MuonDetMgr); CHECK( this->clearVariables() ); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MuEntryVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MuEntryVariables.h index 6638766f2205e8599475108c59f27209d80179d8..eb41502e7782f5d7bac57f46588c5bfaae9159ab 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MuEntryVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MuEntryVariables.h @@ -40,7 +40,7 @@ class MuEntryVariables : public ValAlgVariables } StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/NSWPRDValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/NSWPRDValAlg.cxx index deb8b2185c01d21b68bcee19f3f2539f329cdc5d..1ad882a2f4c3f846224bebc3cae05b877da7a08c 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/NSWPRDValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/NSWPRDValAlg.cxx @@ -60,7 +60,6 @@ NSWPRDValAlg::NSWPRDValAlg(const std::string& name, ISvcLocator* pSvcLocator) m_CscDigitVar(nullptr), m_thistSvc(nullptr), m_tree(nullptr), - m_detManager(nullptr), m_MmIdHelper(nullptr), m_sTgcIdHelper(nullptr), m_CscIdHelper(nullptr), @@ -115,7 +114,12 @@ StatusCode NSWPRDValAlg::initialize() { ATH_CHECK( m_thistSvc->regTree("/NSWPRDValAlg/NSWValTree", m_tree) ); - ATH_CHECK( detStore()->retrieve( m_detManager ) ); + // MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); + + // MuonDetectorManager from the Detector Store (to be used only at initialize) + const MuonGM::MuonDetectorManager* MuonDetMgrDS; + ATH_CHECK( detStore()->retrieve( MuonDetMgrDS ) ); ATH_CHECK( detStore()->retrieve( m_MmIdHelper ) ); @@ -124,37 +128,37 @@ StatusCode NSWPRDValAlg::initialize() { if (m_doCSCDigit) ATH_CHECK( detStore()->retrieve( m_CscIdHelper ) ); if (m_doTruth){ - m_TruthVar = new TruthVariables(&(*(evtStore())), m_detManager, + m_TruthVar = new TruthVariables(&(*(evtStore())), MuonDetMgrDS, m_tree, m_Truth_ContainerName, msgLevel()); ATH_CHECK( m_TruthVar->initializeVariables() ); } if (m_doMuEntry){ - m_MuEntryVar = new MuEntryVariables(&(*(evtStore())), m_detManager, + m_MuEntryVar = new MuEntryVariables(&(*(evtStore())), MuonDetMgrDS, m_tree, m_MuEntry_ContainerName, msgLevel()); ATH_CHECK( m_MuEntryVar->initializeVariables() ); } if (m_doSTGCHit){ - m_sTgcSimHitVar = new sTGCSimHitVariables(&(*(evtStore())), m_detManager, + m_sTgcSimHitVar = new sTGCSimHitVariables(&(*(evtStore())), MuonDetMgrDS, m_sTgcIdHelper, m_tree, m_NSWsTGC_ContainerName, msgLevel()); ATH_CHECK( m_sTgcSimHitVar->initializeVariables() ); } if (m_doSTGCDigit){ - m_sTgcDigitVar = new sTGCDigitVariables(&(*(evtStore())), m_detManager, + m_sTgcDigitVar = new sTGCDigitVariables(&(*(evtStore())), MuonDetMgrDS, m_sTgcIdHelper, m_tree, m_NSWsTGC_DigitContainerName, msgLevel()); ATH_CHECK( m_sTgcDigitVar->initializeVariables() ); // Take SDO conainer - m_sTgcSdoVar = new sTGCSDOVariables(&(*(evtStore())), m_detManager, + m_sTgcSdoVar = new sTGCSDOVariables(&(*(evtStore())), MuonDetMgrDS, m_sTgcIdHelper, m_tree, m_NSWsTGC_SDOContainerName, msgLevel()); ATH_CHECK( m_sTgcSdoVar->initializeVariables() ); } if (m_doSTGCFastDigit){ // Take the "fast_SDO" instead of the SDOs from full sim - m_sTgcFastSdoVar = new sTGCSDOVariables(&(*(evtStore())), m_detManager, + m_sTgcFastSdoVar = new sTGCSDOVariables(&(*(evtStore())), MuonDetMgrDS, m_sTgcIdHelper, m_tree, "sTGCfast_SDO", msgLevel()); ATH_CHECK( m_sTgcFastSdoVar->initializeVariables() ); @@ -163,37 +167,37 @@ StatusCode NSWPRDValAlg::initialize() { } if (m_doSTGCRDO){ - m_sTgcRdoVar = new sTGCRDOVariables(&(*(evtStore())), m_detManager, + m_sTgcRdoVar = new sTGCRDOVariables(&(*(evtStore())), MuonDetMgrDS, m_sTgcIdHelper, m_tree, m_NSWsTGC_RDOContainerName, msgLevel()); ATH_CHECK( m_sTgcRdoVar->initializeVariables() ); } if (m_doSTGCPRD){ - m_sTgcPrdVar = new sTGCPRDVariables(&(*(evtStore())), m_detManager, + m_sTgcPrdVar = new sTGCPRDVariables(&(*(evtStore())), MuonDetMgrDS, m_sTgcIdHelper, m_tree, m_NSWsTGC_PRDContainerName, msgLevel()); ATH_CHECK( m_sTgcPrdVar->initializeVariables() ); } if (m_doMMHit) { - m_MmSimHitVar = new MMSimHitVariables(&(*(evtStore())), m_detManager, + m_MmSimHitVar = new MMSimHitVariables(&(*(evtStore())), MuonDetMgrDS, m_MmIdHelper, m_tree, m_NSWMM_ContainerName, msgLevel()); ATH_CHECK( m_MmSimHitVar->initializeVariables() ); } if (m_doMMDigit) { - m_MmDigitVar = new MMDigitVariables(&(*(evtStore())), m_detManager, + m_MmDigitVar = new MMDigitVariables(&(*(evtStore())), MuonDetMgrDS, m_MmIdHelper, m_tree, m_NSWMM_DigitContainerName, msgLevel()); ATH_CHECK( m_MmDigitVar->initializeVariables() ); // Take SDO conainer - m_MmSdoVar = new MMSDOVariables(&(*(evtStore())), m_detManager, + m_MmSdoVar = new MMSDOVariables(&(*(evtStore())), MuonDetMgrDS, m_MmIdHelper, m_tree, m_NSWMM_SDOContainerName, msgLevel()); ATH_CHECK( m_MmSdoVar->initializeVariables() ); } if (m_doMMFastDigit){ // Take the "fast_SDO" instead of the SDOs from full sim - m_MmFastSdoVar = new MMSDOVariables(&(*(evtStore())), m_detManager, + m_MmFastSdoVar = new MMSDOVariables(&(*(evtStore())), MuonDetMgrDS, m_MmIdHelper, m_tree, "MMfast_SDO", msgLevel()); ATH_CHECK( m_MmFastSdoVar->initializeVariables() ); @@ -203,19 +207,19 @@ StatusCode NSWPRDValAlg::initialize() { if (m_doMMRDO) { - m_MmRdoVar = new MMRDOVariables(&(*(evtStore())), m_detManager, + m_MmRdoVar = new MMRDOVariables(&(*(evtStore())), MuonDetMgrDS, m_MmIdHelper, m_tree, m_NSWMM_RDOContainerName, msgLevel()); ATH_CHECK( m_MmRdoVar->initializeVariables() ); } if (m_doMMPRD){ - m_MmPrdVar = new MMPRDVariables(&(*(evtStore())), m_detManager, + m_MmPrdVar = new MMPRDVariables(&(*(evtStore())), MuonDetMgrDS, m_MmIdHelper, m_tree, m_NSWMM_PRDContainerName, msgLevel()); ATH_CHECK( m_MmPrdVar->initializeVariables() ); } if (m_doCSCDigit){ - m_CscDigitVar = new CSCDigitVariables(&(*(evtStore())), m_detManager, + m_CscDigitVar = new CSCDigitVariables(&(*(evtStore())), MuonDetMgrDS, m_CscIdHelper, m_tree, m_CSC_DigitContainerName, msgLevel()); ATH_CHECK( m_CscDigitVar->initializeVariables() ); } @@ -263,31 +267,39 @@ StatusCode NSWPRDValAlg::execute() m_eventNumber = -1; } - if (m_doTruth) ATH_CHECK( m_TruthVar->fillVariables() ); + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + + if (m_doTruth) ATH_CHECK( m_TruthVar->fillVariables(MuonDetMgr) ); - if (m_doMuEntry) ATH_CHECK( m_MuEntryVar->fillVariables() ); + if (m_doMuEntry) ATH_CHECK( m_MuEntryVar->fillVariables(MuonDetMgr) ); - if (m_doSTGCHit) ATH_CHECK( m_sTgcSimHitVar->fillVariables() ); + if (m_doSTGCHit) ATH_CHECK( m_sTgcSimHitVar->fillVariables(MuonDetMgr) ); - if (m_doSTGCDigit) { ATH_CHECK( m_sTgcDigitVar->fillVariables() ); ATH_CHECK( m_sTgcSdoVar->fillVariables() ); } + if (m_doSTGCDigit) { ATH_CHECK( m_sTgcDigitVar->fillVariables(MuonDetMgr) ); ATH_CHECK( m_sTgcSdoVar->fillVariables(MuonDetMgr) ); } - if (m_doSTGCFastDigit) ATH_CHECK( m_sTgcFastSdoVar->fillVariables() ); + if (m_doSTGCFastDigit) ATH_CHECK( m_sTgcFastSdoVar->fillVariables(MuonDetMgr) ); - if (m_doSTGCRDO) ATH_CHECK( m_sTgcRdoVar->fillVariables() ); + if (m_doSTGCRDO) ATH_CHECK( m_sTgcRdoVar->fillVariables(MuonDetMgr) ); - if (m_doSTGCPRD) ATH_CHECK( m_sTgcPrdVar->fillVariables() ); + if (m_doSTGCPRD) ATH_CHECK( m_sTgcPrdVar->fillVariables(MuonDetMgr) ); - if (m_doMMHit) ATH_CHECK( m_MmSimHitVar->fillVariables() ); + if (m_doMMHit) ATH_CHECK( m_MmSimHitVar->fillVariables(MuonDetMgr) ); - if (m_doMMDigit) { ATH_CHECK( m_MmDigitVar->fillVariables() ); ATH_CHECK( m_MmSdoVar->fillVariables() ); } + if (m_doMMDigit) { ATH_CHECK( m_MmDigitVar->fillVariables(MuonDetMgr) ); ATH_CHECK( m_MmSdoVar->fillVariables(MuonDetMgr) ); } - if (m_doMMFastDigit) ATH_CHECK( m_MmFastSdoVar->fillVariables() ); + if (m_doMMFastDigit) ATH_CHECK( m_MmFastSdoVar->fillVariables(MuonDetMgr) ); - if (m_doMMRDO) ATH_CHECK( m_MmRdoVar->fillVariables() ); + if (m_doMMRDO) ATH_CHECK( m_MmRdoVar->fillVariables(MuonDetMgr) ); - if (m_doMMPRD) ATH_CHECK( m_MmPrdVar->fillVariables() ); + if (m_doMMPRD) ATH_CHECK( m_MmPrdVar->fillVariables(MuonDetMgr) ); - if (m_doCSCDigit) ATH_CHECK( m_CscDigitVar->fillVariables() ); + if (m_doCSCDigit) ATH_CHECK( m_CscDigitVar->fillVariables(MuonDetMgr) ); m_tree->Fill(); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/NSWPRDValAlg.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/NSWPRDValAlg.h index 90d3026b0b5d5ee1d81cbbb967f6becb071db455..db43552e15a896cf0df3fdbac34bbbf897a1d05d 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/NSWPRDValAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/NSWPRDValAlg.h @@ -8,6 +8,8 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "EDM_object.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" + #include <vector> class MMDigitVariables; @@ -33,10 +35,6 @@ class MmIdHelper; class sTgcIdHelper; class CscIdHelper; -namespace MuonGM { - class MuonDetectorManager; -} - class NSWPRDValAlg:public AthAlgorithm { public: @@ -71,7 +69,11 @@ class NSWPRDValAlg:public AthAlgorithm ITHistSvc *m_thistSvc; TTree *m_tree; - const MuonGM::MuonDetectorManager* m_detManager; + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; + const MmIdHelper* m_MmIdHelper; const sTgcIdHelper* m_sTgcIdHelper; const CscIdHelper* m_CscIdHelper; diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.cxx index 125adc707a6f4a23aa2afee7c3ffe3aab9da51c2..4276a7ced07c4dba2aebb7a3237dd5f02c9b3661 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.cxx @@ -13,10 +13,11 @@ /** ---------- filling of variables */ /** ---------- to be called on each evt i.e. execute level of main alg */ -StatusCode TruthVariables::fillVariables() +StatusCode TruthVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_INFO("do fillNSWTruthVariables()"); + ATH_MSG_VERBOSE("MuonDetectorManager from Conditions Store accessed" << MuonDetMgr); CHECK( this->clearVariables() ); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.h index d600dcd4dcac8a7c44bf49441808a2ac9d485722..0d2c032dcabd2ac9aae86125d5a527e891637614 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/TruthVariables.h @@ -46,7 +46,7 @@ class TruthVariables : public ValAlgVariables } StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/ValAlgVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/ValAlgVariables.h index b7ed44e29f837013c65a072d61a66c11975eae98..3bdaf9730bd425f3750748e8a29ac101f0fee4ac 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/ValAlgVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/ValAlgVariables.h @@ -35,7 +35,7 @@ class ValAlgVariables virtual ~ValAlgVariables() {}; virtual StatusCode initializeVariables() = 0; - virtual StatusCode fillVariables() = 0; + virtual StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) = 0; MsgStream& msg( MSG::Level lvl ) const { return m_msg << lvl; } bool msgLvl( MSG::Level lvl ) { return m_msg.get().level() <= lvl; } diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx index 372fea21a089ccfe92617384398196dd10a78b5a..264cb6341e4318f8f4ba11c2543109eaca8bcc51 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx @@ -16,7 +16,7 @@ /** ---------- filling of variables */ /** ---------- to be called on each evt i.e. execute level of main alg */ -StatusCode sTGCDigitVariables::fillVariables() +StatusCode sTGCDigitVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_DEBUG(" do fillNSWsTGCDigitVariables()"); CHECK( this->clearVariables() ); @@ -71,7 +71,7 @@ StatusCode sTGCDigitVariables::fillVariables() << " Station PhiMax [" << stationPhiMax << "]"); int isSmall = stName[2] == 'S'; - const MuonGM::sTgcReadoutElement* rdoEl = m_detManager->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); + const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); int channelNumber = 0; const Identifier phiId, etaId; diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.h index ea4d219c3b10034ee9a15a4d7d772f8718e9360a..d691b8365ccbfde3209a8707c4469383d8a1e56f 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.h @@ -70,7 +70,7 @@ class sTGCDigitVariables : public ValAlgVariables } StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx index a1ef967b1cc26696c0e89e3f6031b656cfee4584..6ea6a8607c2ccbf0a7b83b659db69a7793052ee3 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.cxx @@ -10,9 +10,11 @@ #include "TTree.h" -StatusCode sTGCPRDVariables::fillVariables() +StatusCode sTGCPRDVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_DEBUG("do fillNSWsTGCPRDVariables()"); + ATH_MSG_VERBOSE("MuonDetectorManager from Conditions Store accessed" << MuonDetMgr); + CHECK( this->clearVariables() ); const Muon::sTgcPrepDataContainer *nsw_sTgcPrepDataContainer = nullptr; diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.h index 6b03b38a41cb40d644691f4d0ccc060695997c39..b85697c089a0c3f4fafca2d019423347c072e6ff 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCPRDVariables.h @@ -46,7 +46,7 @@ class sTGCPRDVariables : public ValAlgVariables } StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx index 1544fe8c2588c1826708d3f9bc4ce397ea010ddb..7734746ca8792c9f4bf713ddf4d3b2b858c0ad3a 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.cxx @@ -16,7 +16,7 @@ using namespace Muon; /** ---------- filling of variables */ /** ---------- to be called on each evt i.e. execute level of main alg */ -StatusCode sTGCRDOVariables::fillVariables() +StatusCode sTGCRDOVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_DEBUG("do fillNSWsTGCRDOVariables()"); @@ -73,7 +73,7 @@ StatusCode sTGCRDOVariables::fillVariables() // get the readout element class where the RDO is recorded int isSmall = stName[2] == 'S'; - const MuonGM::sTgcReadoutElement* rdoEl = m_detManager->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); + const MuonGM::sTgcReadoutElement* rdoEl = MuonDetMgr->getsTgcRElement_fromIdFields(isSmall, stationEta, stationPhi, multiplet ); Amg::Vector2D localStripPos(0.,0.); if ( rdoEl->stripPosition(Id,localStripPos) ) { diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.h index f5717c023a71be13bfddcc6cd1708a7a6346fc5f..df2401f0983c988abed864e44d173dc2a8cbf8be 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCRDOVariables.h @@ -45,7 +45,7 @@ class sTGCRDOVariables : public ValAlgVariables ~sTGCRDOVariables() override final { deleteVariables(); } StatusCode initializeVariables() override final; - StatusCode fillVariables() override final; + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) override final; private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx index 49af391d4a47a49d3904cf6fc70ba62d90ac8549..6bc00d607257badb12a2a4a54b3daec9ebfe31a6 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.cxx @@ -10,9 +10,10 @@ #include "TTree.h" -StatusCode sTGCSDOVariables::fillVariables() +StatusCode sTGCSDOVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_DEBUG(" do fillNSWsTGCSDOVariables()"); + ATH_MSG_VERBOSE("MuonDetectorManager from Conditions Store accessed" << MuonDetMgr); ATH_CHECK( this->clearVariables() ); @@ -195,4 +196,4 @@ StatusCode sTGCSDOVariables::initializeVariables() } return StatusCode::SUCCESS; -} \ No newline at end of file +} diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.h index 84a1a1c0fa86b91a9966c3ea7e5acb02a1077655..6c849614fd9f132db3e2569e8d5303b862ad1146 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSDOVariables.h @@ -48,7 +48,7 @@ class sTGCSDOVariables : public ValAlgVariables } StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx index c9b5e4aaf0e5d002601079877f366a55a39aea05..81259b2c032ac24f47cac5180fc41f62d880d72d 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.cxx @@ -12,7 +12,7 @@ #include "TTree.h" -StatusCode sTGCSimHitVariables::fillVariables() +StatusCode sTGCSimHitVariables::fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr) { ATH_MSG_INFO("do fillNSWsTGCHitVariables()"); @@ -86,7 +86,7 @@ StatusCode sTGCSimHitVariables::fillVariables() continue; } - const MuonGM::sTgcReadoutElement* detEl = m_detManager->getsTgcReadoutElement(offId); + const MuonGM::sTgcReadoutElement* detEl = MuonDetMgr->getsTgcReadoutElement(offId); if( !detEl ){ ATH_MSG_WARNING("sTGC geometry, failed to retrieve detector element for: isSmall " << isSmall << " eta " << m_sTgcIdHelper->stationEta(offId) << " phi " << m_sTgcIdHelper->stationPhi(offId) << " ml " << m_sTgcIdHelper->multilayer(offId) ); diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.h b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.h index e0d771a061000523359b5e0fce3a370618f34871..594952fe0257695cdfe608e4983de2a61a298fde 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.h +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCSimHitVariables.h @@ -76,7 +76,7 @@ class sTGCSimHitVariables : public ValAlgVariables StatusCode initializeVariables(); - StatusCode fillVariables(); + StatusCode fillVariables(const MuonGM::MuonDetectorManager* MuonDetMgr); private: diff --git a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx index 519ce4eebd55e4ad55f18812821afe755f0a7995..84cb835c0790a35528c2f0356663342bcc613a4a 100644 --- a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx +++ b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx @@ -24,8 +24,6 @@ //#include "MuonSegmentMakerToolInterfaces/IMuTagMatchingTool.h" #include "TrkToolInterfaces/IResidualPullCalculator.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - #include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" //#include "TrkParameters/Perigee.h" #include "TrkParameters/TrackParameters.h" @@ -79,7 +77,6 @@ MuTagMatchingTool::MuTagMatchingTool(const std::string& t, , m_selectionTool("Muon::MuonSegmentSelectionTool/MuonSegmentSelectionTool") , m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator") , p_StoreGateSvc(0) - , m_detMgr(0) { declareInterface<IMuTagMatchingTool>(this); declareProperty( "IExtrapolator" , p_IExtrapolator ) ; @@ -155,8 +152,8 @@ StatusCode MuTagMatchingTool::initialize() //Retrieve IdHelpers - // retrieve MuonDetectorManager - ATH_CHECK( detStore()->retrieve(m_detMgr) ); +// MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK( m_muonIdHelperTool.retrieve() ); ATH_CHECK( m_edmHelperSvc.retrieve() ); @@ -825,6 +822,15 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr // // residuals and pulls in X coordinate (along tube) // + +// MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return info; + } + bool first = true; double maxResXMdt = -1e9; double maxResPhi = -1e9; @@ -846,7 +852,7 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr int lay = m_muonIdHelperTool->mdtIdHelper().tubeLayer(id); int tube = m_muonIdHelperTool->mdtIdHelper().tube(id); - const MuonGM::MdtReadoutElement* detEl = mdt->prepRawData() ? mdt->prepRawData()->detectorElement() : m_detMgr->getMdtReadoutElement(id); + const MuonGM::MdtReadoutElement* detEl = mdt->prepRawData() ? mdt->prepRawData()->detectorElement() : MuonDetMgr->getMdtReadoutElement(id); if( !detEl ){ ATH_MSG_WARNING(" could not get MdtReadoutElement for tube " << m_muonIdHelperTool->toString(id)); continue; diff --git a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.h b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.h index a2a88775f156bae5e3f194e6aa521e10567c2de4..14e07561d49ff4020de9843c02654f6b7e0abae0 100644 --- a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.h +++ b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.h @@ -22,6 +22,7 @@ #include "MuonCombinedEvent/MuonSegmentInfo.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" class StoreGateSvc; @@ -36,10 +37,6 @@ namespace Muon { class MuonEDMPrinterTool; } -namespace MuonGM { - class MuonDetectorManager; -} - namespace Trk{ class Surface; class Track; @@ -150,7 +147,10 @@ class MuTagMatchingTool : virtual public IMuTagMatchingTool, public AthAlgTool{ std::string m_t0Location; StoreGateSvc* p_StoreGateSvc ; //!< Pointer On StoreGateSvc - const MuonGM::MuonDetectorManager* m_detMgr; + // MuonDetectorManager from the conditions store + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", + "Key of input MuonDetectorManager condition data"}; bool m_assumeLocalErrors; bool m_extrapolatePerigee;