diff --git a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx index 712cdf4558112f5f1f0c2719731a8f9fd34769a2..69837aec36848f02acdecf64acc76f67907b80f2 100644 --- a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx +++ b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx @@ -130,7 +130,7 @@ StatusCode Muon::NSWCalibTool::calibrateClus(const Muon::MMPrepData* prepData, c double time = prepData->stripTimes().at(i); double charge = prepData->stripCharges().at(i); NSWCalib::CalibratedStrip calibStrip; - calibrateStrip(time, charge, lorentzAngle, calibStrip); + ATH_CHECK(calibrateStrip(time, charge, lorentzAngle, calibStrip)); calibClus.push_back(calibStrip); } return StatusCode::SUCCESS; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/CMakeLists.txt index c4eeb8308401bcb14728ebd283ace947b32ee7a0..e60ec349b62d7287c2c697015d168fc83ca15407 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/CMakeLists.txt @@ -14,6 +14,7 @@ atlas_depends_on_subdirs( PUBLIC Event/EventPrimitives MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonIdHelpers + MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools TestPolicy ) # External dependencies: find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Matrix Minuit Minuit2) diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/MMClusterization/IMMClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/MMClusterization/IMMClusterBuilderTool.h index 2b23bc7eae8bd4c4195ef315f3804627cec38873..e284bf61ae6d0c8ac8f5e5974f07b45e21d59bb2 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/MMClusterization/IMMClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/MMClusterization/IMMClusterBuilderTool.h @@ -9,6 +9,9 @@ // #include #include "GaudiKernel/IAlgTool.h" +#include "GeoPrimitives/GeoPrimitives.h" +#include "EventPrimitives/EventPrimitives.h" +#include "NSWCalibTools/INSWCalibTool.h" namespace Muon { class MMPrepData; @@ -28,8 +31,39 @@ namespace Muon { virtual StatusCode getClusters(std::vector& stripsVect, std::vector>& clustersVect)const =0; + + + /// compute the cluster position based on its list of PrepRawData (strips) + virtual StatusCode getClusterPosition(std::vector& strips, + Amg::Vector2D& clusterLocalPosition, Amg::MatrixX* covMatrix) const; + + virtual StatusCode getCalibratedClusterPosition(const Muon::MMPrepData* cluster, std::vector&, + Amg::Vector2D& clusterLocalPosition, Amg::MatrixX& covMatrix) const; }; + + inline StatusCode IMMClusterBuilderTool::getClusterPosition(std::vector& strips, + Amg::Vector2D& clusterLocalPosition, Amg::MatrixX* covMatrix) const + { + strips.clear(); + (void)covMatrix; + clusterLocalPosition = Amg::Vector2D(0.0,0.0); + return StatusCode::SUCCESS; + } + + inline StatusCode IMMClusterBuilderTool::getCalibratedClusterPosition(const Muon::MMPrepData* cluster, std::vector& strips, + Amg::Vector2D& clusterLocalPosition, Amg::MatrixX& covMatrix) const + { + (void)cluster; + strips.clear(); + covMatrix = Amg::MatrixX(1,1); + clusterLocalPosition = Amg::Vector2D(0.0,0.0); + return StatusCode::SUCCESS; + } + + + + } #endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ClusterTimeProjectionMMClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ClusterTimeProjectionMMClusterBuilderTool.cxx index 63799413fb1a5519eb79f846bc26d243ac47ee98..5bbbf688b1ec507b2b8c8d3e442012ebf67ad9ac 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ClusterTimeProjectionMMClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ClusterTimeProjectionMMClusterBuilderTool.cxx @@ -42,8 +42,8 @@ StatusCode Muon::ClusterTimeProjectionMMClusterBuilderTool::getClusters( if (sc.isFailure()) continue; for (uint i_cluster = 0; i_cluster < idxClusters.size(); i_cluster++) { double clusterPosition, clusterPositionErrorSq; - sc = getClusterPosition(prdsOfLayer, idxClusters.at(i_cluster), - clusterPosition, clusterPositionErrorSq); + sc = getClusterPositionPRD(prdsOfLayer, idxClusters.at(i_cluster), + clusterPosition, clusterPositionErrorSq); if (sc.isFailure()) continue; sc = writeClusterPrd(prdsOfLayer, idxClusters.at(i_cluster), clusterPosition, clusterPositionErrorSq, clustersVec); @@ -113,7 +113,7 @@ StatusCode Muon::ClusterTimeProjectionMMClusterBuilderTool::clusterLayer( return StatusCode::SUCCESS; } // end of cluster layer -StatusCode Muon::ClusterTimeProjectionMMClusterBuilderTool::getClusterPosition( +StatusCode Muon::ClusterTimeProjectionMMClusterBuilderTool::getClusterPositionPRD( const std::vector &MMPrdsOfLayer, const std::vector &idxCluster, double &clusterPosition, double &clusterPositionErrorSq) const { diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ClusterTimeProjectionMMClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ClusterTimeProjectionMMClusterBuilderTool.h index d240e67f6f382ac8793568c17da449572acdcdfd..a62a2a86d01df3e32b608d4b258b1d87bdcfe373 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ClusterTimeProjectionMMClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ClusterTimeProjectionMMClusterBuilderTool.h @@ -43,10 +43,10 @@ class ClusterTimeProjectionMMClusterBuilderTool : std::vector> &idxClusters) const; - StatusCode getClusterPosition(const std::vector &MMPrdsOfLayer, - const std::vector &idxCluster, - double &clustersPosition, - double &clustersPositionErrorSq) const; + StatusCode getClusterPositionPRD(const std::vector &MMPrdsOfLayer, + const std::vector &idxCluster, + double &clustersPosition, + double &clustersPositionErrorSq) const; StatusCode writeClusterPrd(const std::vector &MMPrdsOfLayer, const std::vector &idxCluster, diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx index b026afa1ddd091f9ed061a602f0e0dd177fea14e..02c17775d3d5f644a7b728dafc4399eb31b880ae 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.cxx @@ -146,12 +146,12 @@ StatusCode Muon::SimpleMMClusterBuilderTool::getClusters(std::vector=nmergeStrips) break; } ATH_MSG_VERBOSE(" add merged MMprds nmerge " << nmerge << " strip " << strip << " gasGap " << gasGap << " layer " << layer ); - + // start off from strip in the middle int stripSum = 0; for (unsigned int k =0; k 0 ) { - /// get the Y local position from the first strip ( it's the same for all strips in the cluster) - posY = MMprds[mergeIndices[0]].localPosition().y(); + std::vector stripsVec; + Amg::Vector2D clusterLocalPosition; + Amg::MatrixX* covMatrix = nullptr; + double totalCharge=0.0; + if ( mergeStrips.size() > 0 ) { for ( unsigned int k=0 ; kchannel(MMprds[j].identify()) << " nmerge " << nmerge << " sqrt covX " << sqrt((*covN)(0,0))); - - /// - /// memory allocated dynamically for the PrepRawData is managed by Event Store - /// - std::unique_ptr prdN = std::make_unique(MMprds[j].identify(), hash, clusterLocalPosition, - rdoList, covN, MMprds[j].detectorElement(), - static_cast (0), static_cast(totalCharge), static_cast(0.0), - (m_writeStripProperties ? mergeStrips : std::vector(0) ), - mergeStripsTime, mergeStripsCharge); - prdN->setDriftDist(mergeStripsDriftDists, mergeStripsDriftDistErrors); - prdN->setAuthor(Muon::MMPrepData::Author::SimpleClusterBuilder); - + stripsVec.push_back(MMprds[mergeIndices[k]]); + totalCharge += MMprds[mergeIndices[k]].charge(); + } + /// + /// memory allocated dynamically for the PrepRawData is managed by Event Store + /// + covMatrix = new Amg::MatrixX(1,1); + ATH_CHECK(getClusterPosition(stripsVec,clusterLocalPosition,covMatrix)); - clustersVect.push_back(std::move(prdN)); + /// + /// memory allocated dynamically for the PrepRawData is managed by Event Store + /// + std::unique_ptr prdN = std::make_unique(MMprds[j].identify(), hash, clusterLocalPosition, + rdoList, covMatrix, MMprds[j].detectorElement(), + static_cast (0), static_cast(totalCharge), static_cast(0.0), + (m_writeStripProperties ? mergeStrips : std::vector(0) ), + mergeStripsTime, mergeStripsCharge); + prdN->setDriftDist(mergeStripsDriftDists, mergeStripsDriftDistErrors); + prdN->setAuthor(Muon::MMPrepData::Author::SimpleClusterBuilder); + + + clustersVect.push_back(std::move(prdN)); + } } // end loop MMprds[i] //clear vector and delete elements MMflag.clear(); @@ -234,3 +214,62 @@ StatusCode Muon::SimpleMMClusterBuilderTool::getClusters(std::vector& stripsVec, + Amg::Vector2D& clusterLocalPosition, Amg::MatrixX* covMatrix) const +{ + double weightedPosX = 0.0; + double posY = 0.0; + double totalCharge = 0.0; + double theta = 0.0; + + /// get the Y local position from the first strip ( it's the same for all strips in the cluster) + posY = stripsVec[0].localPosition().y(); + for ( unsigned int k=0 ; klocalCovariance(); + + return StatusCode::SUCCESS; +} + + diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h index b8604b7e0272964263702dea8fe547a704fbd737..6a876549c731e64bc865b6efa7fbe22ee2ba90bf 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/SimpleMMClusterBuilderTool.h @@ -41,8 +41,18 @@ namespace Muon StatusCode getClusters(std::vector& stripsVect, std::vector>& clustersVect) const; + StatusCode getClusterPosition(std::vector& stripsVect, + Amg::Vector2D& clusterLocalPosition, Amg::MatrixX* covMatrix) const; + + StatusCode getCalibratedClusterPosition(const Muon::MMPrepData* cluster, std::vector&, + Amg::Vector2D& clusterLocalPosition, Amg::MatrixX& covMatrix) const; + + private: + /// avoid warning from overriding functions + using IMMClusterBuilderTool::getClusterPosition; + using IMMClusterBuilderTool::getCalibratedClusterPosition; /// Muon Detector Descriptor const MuonGM::MuonDetectorManager* m_muonMgr; const MmIdHelper* m_mmIdHelper; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/CMakeLists.txt index e53a9ac441b34066f7e712950a204da8b2cd71c1..db306be243de496697359220c42d6ae9de6d13a9 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/CMakeLists.txt @@ -20,7 +20,9 @@ atlas_depends_on_subdirs( PRIVATE Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkParameters Tracking/TrkEvent/TrkPrepRawData - Tracking/TrkTools/TrkToolInterfaces ) + Tracking/TrkTools/TrkToolInterfaces + MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization + MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools ) # Component(s) in the package: atlas_add_component( MuonClusterOnTrackCreator diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MMClusterOnTrackCreator.cxx b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MMClusterOnTrackCreator.cxx index 739196bdb010e9c5534ec2f9435367c417a2e006..b77fc7989ac86b46103147f3d515c72a9f43e3a6 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MMClusterOnTrackCreator.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MMClusterOnTrackCreator.cxx @@ -1,9 +1,11 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "MMClusterOnTrackCreator.h" +#include "MMClusterization/IMMClusterBuilderTool.h" +#include "NSWCalibTools/INSWCalibTool.h" #include "MuonRIO_OnTrack/MMClusterOnTrack.h" @@ -11,7 +13,10 @@ Muon::MMClusterOnTrackCreator::MMClusterOnTrackCreator (const std::string& ty, const std::string& na, const IInterface* pa) : AthAlgTool(ty, na, pa), - m_muonIdHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool") { + m_muonIdHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), + m_clusterBuilderTool("Muon::SimpleMMClusterBuilderTool/SimpleMMClusterBuilderTool",this), + m_calibTool("Muon::NSWCalibTool/NSWCalibTool", this) +{ // algtool interface - necessary! declareInterface(this); @@ -38,14 +43,12 @@ const Muon::MuonClusterOnTrack* Muon::MMClusterOnTrackCreator::createRIO_OnTrack ATH_MSG_ERROR("MMClusterOnTrackCreator called with an non MM identifier"); return MClT; } - // check whether PrepRawData has detector element, if not there print warning const Trk::TrkDetElementBase* EL = RIO.detectorElement(); if ( !EL ) { ATH_MSG_WARNING("RIO does not have associated detectorElement!, cannot produce ROT"); return nullptr; } - // MuClusterOnTrack production // // in RIO_OnTrack the local param and cov should have the same dimension @@ -74,13 +77,6 @@ const Muon::MuonClusterOnTrack* Muon::MMClusterOnTrackCreator::createRIO_OnTrack } positionAlongStrip = lp[Trk::locY]; - /// correct the local position based on the stereo angle - if ( m_muonIdHelperTool->mmIdHelper().isStereo(RIO.identify())) { - const MuonGM::MMReadoutElement* mmEL = dynamic_cast(EL); - double sAngle = mmEL->getDesign(RIO.identify())->sAngle; - locpar[Trk::locX] = locpar[Trk::locX]+positionAlongStrip*tan(sAngle); - } - Amg::MatrixX loce = RIO.localCovariance(); ATH_MSG_DEBUG("All: new err matrix is " << loce); @@ -105,3 +101,82 @@ const Muon::MuonClusterOnTrack* Muon::MMClusterOnTrackCreator::createRIO_OnTrack const Muon::MuonClusterOnTrack* Muon::MMClusterOnTrackCreator::correct(const Trk::PrepRawData& RIO, const Trk::TrackParameters& TP) const { return createRIO_OnTrack(RIO, TP.position()); } + +const Muon::MuonClusterOnTrack* Muon::MMClusterOnTrackCreator::calibratedCluster(const Trk::PrepRawData& RIO, const Amg::Vector3D& GP) const +{ + MuonClusterOnTrack* cluster = nullptr; + + if ( !m_muonIdHelperTool->isMM(RIO.identify()) ) { + ATH_MSG_ERROR("MMClusterOnTrackCreator called with an non MM identifier"); + return cluster; + } + + // check whether PrepRawData has detector element, if not there print warning + const Trk::TrkDetElementBase* EL = RIO.detectorElement(); + if ( !EL ) { + ATH_MSG_WARNING("RIO does not have associated detectorElement!, cannot produce ROT"); + return nullptr; + } + + // MuClusterOnTrack production + // + Trk::LocalParameters locpar(RIO.localPosition()); + + if (RIO.localCovariance().cols() != RIO.localCovariance().rows()) { + ATH_MSG_FATAL("Rows and colums not equal!"); + } + + if (RIO.localCovariance().cols() > 1) { + ATH_MSG_VERBOSE("Making 2-dim local parameters: " << m_muonIdHelperTool->toString(RIO.identify())); + } else { + Trk::DefinedParameter radiusPar(RIO.localPosition().x(), Trk::locX); + locpar = Trk::LocalParameters(radiusPar); + ATH_MSG_VERBOSE("Making 1-dim local parameters: " << m_muonIdHelperTool->toString(RIO.identify())); + } + + Amg::Vector2D lp; + double positionAlongStrip = 0; + + if ( !EL->surface(RIO.identify()).globalToLocal(GP, GP, lp) ) { + Amg::Vector3D lpos = RIO.detectorElement()->surface(RIO.identify()).transform().inverse()*GP; + ATH_MSG_WARNING("Extrapolated GlobalPosition not on detector surface! Distance " << lpos.z()); + lp[Trk::locX] = lpos.x(); + lp[Trk::locY] = lpos.y(); + } + positionAlongStrip = lp[Trk::locY]; + + /// correct the local position based on the stereo angle + if ( m_muonIdHelperTool->mmIdHelper().isStereo(RIO.identify())) { + const MuonGM::MMReadoutElement* mmEL = dynamic_cast(EL); + double sAngle = mmEL->getDesign(RIO.identify())->sAngle; + locpar[Trk::locX] = locpar[Trk::locX]+positionAlongStrip*tan(sAngle); + } + + /// calibrate the input + const MMPrepData* MClus = dynamic_cast (&RIO); + std::vector calibratedStrips; + StatusCode sc = m_calibTool->calibrateClus(MClus,GP,calibratedStrips); + if ( sc != StatusCode::SUCCESS ) { + ATH_MSG_WARNING("Could not calibrate the MM Cluster in the RIO on track creator"); + return cluster; + } + Amg::Vector2D localposition; + Amg::MatrixX loce = RIO.localCovariance(); + localposition[Trk::locX] = locpar[Trk::locX]; + localposition[Trk::locY] = 0.0; + + /// calibrate the cluster position along the precision coordinate + sc = m_clusterBuilderTool->getCalibratedClusterPosition(MClus,calibratedStrips,localposition,loce); + if ( sc != StatusCode::SUCCESS ) { + ATH_MSG_WARNING("Could not calibrate the MM Cluster in the RIO on track creator"); + return cluster; + } + /// set the value of the local parameter after the calibration + locpar[Trk::locX] = localposition[Trk::locX]; + + ATH_MSG_VERBOSE("generating MMClusterOnTrack in MMClusterBuilder"); + cluster = new MMClusterOnTrack(MClus, locpar, loce, positionAlongStrip); + + + return cluster; +} diff --git a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MMClusterOnTrackCreator.h b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MMClusterOnTrackCreator.h index f27d7dae0ea9f30ec17ac49fbf15ef9b8c0f29a3..d51089e1338543d1b553429e9d4f6725ac1f641b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MMClusterOnTrackCreator.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRIO_OnTrackCreators/MuonClusterOnTrackCreator/src/MMClusterOnTrackCreator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef MMClusterOnTrackCreator_H @@ -19,6 +19,8 @@ namespace Muon { + class IMMClusterBuilderTool; + class INSWCalibTool; /** @class MMClusterOnTrackCreator @brief Interface for the reconstruction to calibration and alignment corrections. It should be used by @@ -72,10 +74,22 @@ namespace Muon { The ownership of the new Muon::MuonClusterOnTrack is passed to the client calling the tool */ virtual const MuonClusterOnTrack* correct(const Trk::PrepRawData& RIO,const Trk::TrackParameters& TP) const override; + + + /** @brief Create new Muon::MuonClusterOnTrack from a Trk::PrepRawData and a predicted Trk::TrackParameter. + @param RIO Trk::PrepRawData object to be calibrated + @param GP Predicted intersect position of the muon with the measurement plane + @return a pointer to a new Muon::MuonClusterOnTrack object, zero if calibration failed. + The ownership of the new Muon::MuonClusterOnTrack is passed to the client calling the tool + */ + virtual const MuonClusterOnTrack* calibratedCluster(const Trk::PrepRawData& RIO, const Amg::Vector3D& GP) const override; + private: ToolHandle m_muonIdHelperTool; + ToolHandle m_clusterBuilderTool; + ToolHandle m_calibTool; }; // end of class def } // namespace Muon diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h index e0d6042cb04204367d204a50cf34565e774aaecf..56aa537df300dc1433ca9e300144c78e7bdb16ff 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h @@ -50,6 +50,16 @@ namespace Muon { virtual const MuonClusterOnTrack* createRIO_OnTrack(const Trk::PrepRawData& DC, const Amg::Vector3D& GP, const Amg::Vector3D& GD) const = 0; + + /** @brief Calibrate a NSW PrepRawData object. The result is stored in a new Muon::MuonClusterOnTrack object + @param DC Trk::PrepRawData object + @param GP Predicted global position (including second coordinate along the strip). + @return Fully calibrated Muon::MuonClusterOnTrack. + The memory management of the new Muon::MuonClusterOnTrack is passed to the person calling the function. + */ + virtual const MuonClusterOnTrack* calibratedCluster(const Trk::PrepRawData& DC, + const Amg::Vector3D& GP) const; + }; @@ -57,6 +67,14 @@ namespace Muon { { return IID_IMuonClusterOnTrackCreator; } + + inline const MuonClusterOnTrack* IMuonClusterOnTrackCreator::calibratedCluster(const Trk::PrepRawData& DC, + const Amg::Vector3D& GP) const + { + return createRIO_OnTrack(DC,GP); + } + + } // end of name space #endif // MUON_IMUONCLUSTERONTRACKCREATOR_H diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx index 721001b320591d1e8918a681591242766030fcbf..eb12d79c5a84d2057132cd6a5bb1fb06dbb77f6c 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx @@ -979,30 +979,30 @@ namespace Muon { /// correct the eta position of the MM stereo layers only, based on the Identifier clus_id = clus->identify(); if ( m_idHelperTool->isMM(clus_id) ) { - if ( m_idHelperTool->mmIdHelper().isStereo(clus_id) ) { - /// build a new MM cluster on track with correct position - newClus = m_mmClusterCreator->createRIO_OnTrack(*(clus->prepRawData()),posOnSurf); - ATH_MSG_VERBOSE("Position before correction: " << clus->globalPosition().x() << " " - << clus->globalPosition().y() << " " << clus->globalPosition().z()); - ATH_MSG_VERBOSE("Position after correction: " << newClus->globalPosition().x() << " " - << newClus->globalPosition().y() << " " << newClus->globalPosition().z()); - } - else { - /// here calibration of the MM eta strip ( all phi-dependent effects ) - newClus = clus; - } - } - else if ( m_idHelperTool->issTgc(clus->identify()) ) { - /// if it's STGC just copy the cluster -> calibration to be added - newClus = clus; - } + /// build a new MM cluster on track with correct position + newClus = m_mmClusterCreator->calibratedCluster(*(clus->prepRawData()),posOnSurf); + //newClus = clus; + ATH_MSG_VERBOSE("Position before correction: " << clus->globalPosition().x() << " " + << clus->globalPosition().y() << " " << clus->globalPosition().z()); + ATH_MSG_VERBOSE("Position after correction: " << newClus->globalPosition().x() << " " + << newClus->globalPosition().y() << " " << newClus->globalPosition().z()); + } + + else if ( m_idHelperTool->issTgc(clus->identify()) ) { + /// if it's STGC just copy the cluster -> calibration to be added + newClus = clus; + } } + else { + ATH_MSG_WARNING("Surface associated to cluster not found, not calibrating"); + newClus=clus; + } + calibratedClusters.push_back(newClus); } + return calibratedClusters; } - - }//end namespace