diff --git a/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonBucketDump/src/BucketDumperAlg.cxx b/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonBucketDump/src/BucketDumperAlg.cxx index ef8f232981a77093d65a94ea2e81a6fcd2a1ef30..c5e855d8890309d018b9b40dec4dd2e5c967eb5c 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonBucketDump/src/BucketDumperAlg.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonBucketDump/src/BucketDumperAlg.cxx @@ -25,7 +25,7 @@ namespace MuonR4{ StatusCode BucketDumperAlg::initialize() { ATH_CHECK(m_readKey.initialize()); ATH_CHECK(m_idHelperSvc.retrieve()); - ATH_CHECK(m_inSimHitKeys.initialize()); + ATH_CHECK(m_geoCtxKey.initialize()); ATH_CHECK(m_inSegmentKey.initialize(!m_inSegmentKey.empty())); ATH_CHECK(m_tree.init(this)); ATH_CHECK(m_idHelperSvc.retrieve()); @@ -50,6 +50,9 @@ namespace MuonR4{ segmentMap[segment->parent()->parentBucket()].push_back(segment); } + SG::ReadHandle gctx(m_geoCtxKey, ctx); + ATH_CHECK(gctx.isPresent()); + SG::ReadHandle<SpacePointContainer> readHandle{m_readKey, ctx}; ATH_CHECK(readHandle.isPresent()); @@ -86,7 +89,6 @@ namespace MuonR4{ m_segmentDir.push_back(segment->direction()); m_segment_chiSquared.push_back(segment->chi2()); m_segment_numberDoF.push_back(segment->nDoF()); - } } @@ -101,15 +103,24 @@ namespace MuonR4{ continue; } + m_spoint_id.push_back(sp->identify()); + + Identifier id = sp->identify(); + unsigned int mdt_ML = m_idHelperSvc->mdtIdHelper().multilayer(id); + unsigned int mdt_TL = m_idHelperSvc->mdtIdHelper().tubeLayer(id); + unsigned int mdt_nL = m_idHelperSvc->mdtIdHelper().tubeLayerMax(id); + m_spoint_mdtLayer = mdt_ML * (mdt_nL-1) + mdt_TL; + m_spoint_mdtTube = m_idHelperSvc->mdtIdHelper().tube(id); + const std::vector<int16_t>& segIdxs = spacePointToSegment[sp]; m_spoint_mat[m_spoint_mat.size()] = segIdxs; m_spoint_nSegments.push_back(segIdxs.size()); - - m_spoint_id.push_back(sp->identify()); + m_bucket_spacePoints = bucket->size(); m_spoint_localPosition.push_back(sp->positionInChamber()); m_spoint_adc.push_back(dc->adc()); + m_spoint_adc.push_back(dc->tdc()); m_spoint_covX.push_back(sp->covariance()(Amg::x, Amg::x)); m_spoint_covY.push_back(sp->covariance()(Amg::y, Amg::y)); m_spoint_covXY.push_back(sp->covariance()(Amg::x, Amg::y)); @@ -122,8 +133,9 @@ namespace MuonR4{ m_spoint_dimension.push_back(sp->dimension()); m_spoint_layer.push_back(layer); m_spoint_isMdt.push_back(true); - m_spoint_isStrip.push_back(false); + Amg::Vector3D globalPos = sp->msSector()->localToGlobalTrans(*gctx) * sp->positionInChamber(); + m_spoint_globalPosition.push_back( globalPos ); } ++layer; @@ -134,7 +146,6 @@ namespace MuonR4{ for (const auto sp : hitsInLay){ - const std::vector<int16_t>& segIdxs = spacePointToSegment[sp]; m_spoint_mat[m_spoint_mat.size()] = segIdxs; @@ -158,7 +169,9 @@ namespace MuonR4{ m_spoint_dimension.push_back(sp->dimension()); m_spoint_layer.push_back(layer); m_spoint_isStrip.push_back(true); - m_spoint_isMdt.push_back(false); + + Amg::Vector3D globalPos = sp->msSector()->localToGlobalTrans(*gctx) * sp->positionInChamber(); + m_spoint_globalPosition.push_back( globalPos ); } ++layer; diff --git a/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonBucketDump/src/BucketDumperAlg.h b/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonBucketDump/src/BucketDumperAlg.h index 7718ccac01c0216fbe1f347e34db5bd9d4c07d05..4b1b44d01fc0b59f4bf100f9b0b2638930be951d 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonBucketDump/src/BucketDumperAlg.h +++ b/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonBucketDump/src/BucketDumperAlg.h @@ -42,19 +42,20 @@ class BucketDumperAlg: public AthHistogramAlgorithm { private: - void fillChamberInfo(const MuonGMR4::SpectrometerSector* chamber); + void fillChamberInfo(const MuonGMR4::Chamber* chamber); SG::ReadHandleKey<SpacePointContainer> m_readKey{this, "ReadKey", "MuonSpacePoints", "Key to the space point container"}; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - SG::ReadHandleKeyArray<xAOD::MuonSimHitContainer> m_inSimHitKeys {this, "SimHitKeys",{}, "xAOD SimHit collections"}; SG::ReadHandleKey<MuonR4::SegmentContainer> m_inSegmentKey{this, "SegmentKey", "R4MuonSegments"}; + SG::ReadHandleKey<ActsGeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"}; + Gaudi::Property<bool> m_isMC{this, "isMC", true}; Gaudi::Property<double> m_fracToKeep{this,"dataFracToKeep", 0.055}; Gaudi::Property<std::string> m_streamName{this, "StreamName", ""}; ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; - CLHEP::HepRandomEngine* getRandomEngine(const EventContext&ctx) const; + CLHEP::HepRandomEngine* getRandomEngine(const EventContext&ctx) const; MuonVal::MuonTesterTree m_tree{"MuonBucketDump","MuonBucketDump"}; @@ -63,13 +64,18 @@ class BucketDumperAlg: public AthHistogramAlgorithm { MuonVal::ScalarBranch<uint16_t>& m_bucket_spacePoints{m_tree.newScalar<uint16_t>("bucket_spacePoints", 0)}; MuonVal::ScalarBranch<uint16_t>& m_bucket_segments{m_tree.newScalar<uint16_t>("bucket_segments", 0)}; - MuonVal::MuonIdentifierBranch m_spoint_id{m_tree, "id"}; MuonVal::ThreeVectorBranch m_spoint_localPosition{m_tree, "localPosition"}; + MuonVal::ThreeVectorBranch m_spoint_globalPosition{m_tree, "globalPosition"}; + + MuonVal::MuonIdentifierBranch m_spoint_id{m_tree, "id"}; MuonVal::VectorBranch<uint16_t>& m_spoint_layer{m_tree.newVector<uint16_t>("Layer")}; - MuonVal::VectorBranch<bool>& m_spoint_isMdt{m_tree.newVector<bool>("isMdt", false)}; MuonVal::VectorBranch<bool>& m_spoint_isStrip{m_tree.newVector<bool>("isStrip", false)}; + MuonVal::VectorBranch<bool>& m_spoint_isMdt{m_tree.newVector<bool>("isMdt", false)}; + MuonVal::ScalarBranch<short>& m_spoint_mdtLayer{m_tree.newScalar<short>("mdtLayer", 0)}; + MuonVal::ScalarBranch<short>& m_spoint_mdtTube{m_tree.newScalar<short>("mdtTube", 0)}; MuonVal::VectorBranch<uint16_t>& m_spoint_adc{m_tree.newVector<uint16_t>("adc")}; + MuonVal::VectorBranch<uint16_t>& m_spoint_tdc{m_tree.newVector<uint16_t>("tdc")}; MuonVal::VectorBranch<float>& m_spoint_covX{m_tree.newVector<float>("covX")}; MuonVal::VectorBranch<float>& m_spoint_covXY{m_tree.newVector<float>("covXY")};