diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPatternCombination.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPatternCombination.h index b23c13a0252830b96a4a6b0cb34049cfc62015cb..e3355efebf0a5aa1ef6df1b6075f9438e2417095 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPatternCombination.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern/MuonPattern/MuonPatternCombination.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // MuonPatternCombination.h @@ -58,11 +58,10 @@ namespace Muon { std::vector< MuonPatternChamberIntersect > m_chamberData; /** type of road **/ - mutable int m_roadType; + int m_roadType; public: int trackRoadType() const; - void setTrackRoadType(int roadType); }; @@ -78,10 +77,6 @@ namespace Muon { return m_roadType; } - inline void MuonPatternCombination::setTrackRoadType(const int roadType) { - m_roadType = roadType; - return; - } } diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.cxx deleted file mode 100644 index 4143920d61edf06682d3b7f1d3602ce0efcf2221..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.cxx +++ /dev/null @@ -1,263 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -////////////////////////////////////////////////////// -// -// Author : Daniel Ventura <ventura@cern.ch> -// -////////////////////////////////////////////////////// -#include "MuonPatternCombinationMissedHitFillerTool.h" -#include "AthenaKernel/errorcheck.h" -#include "TrkTruthData/TruthTrajectory.h" -#include "AtlasHepMC/GenParticle.h" -#include "TrkTruthData/PRD_MultiTruthCollection.h" -#include "MuonPattern/MuonPatternCombinationCollection.h" -#include "MuonPattern/DetailedMuonPatternTruthCollection.h" -#include "MuonTruthAlgs/MuonPatternCombinationDetailedTrackTruthMaker.h" -#include "StoreGate/StoreGateSvc.h" -#include "TrkPrepRawData/PrepRawData.h" -#include "MuonPrepRawData/MuonPrepDataContainer.h" -#include "MuonPrepRawData/MuonPrepDataCollection.h" -#include "MuonPattern/MuonPatternChamberIntersect.h" - - -using namespace std; - - -namespace D3PD { - - - MuonPatternCombinationMissedHitFillerTool::MuonPatternCombinationMissedHitFillerTool (const std::string& type, - const std::string& name, - const IInterface* parent) - : BlockFillerTool< EventInfo > (type, name, parent) , - m_idHelper(0), - m_truthTool("Trk::DetailedMuonPatternTruthBuilder/DetailedMuonPatternTruthBuilder") { - - declareProperty("DetailedMuonPatternTruthMissedHitTool", m_truthTool); - - book().ignore(); // Avoid coverity warning. - } - - - StatusCode MuonPatternCombinationMissedHitFillerTool::book() { - // branches - CHECK( addVariable("truth_barcode", m_truth_barcode) ); - CHECK( addVariable("truth_nMDT", m_truth_nMDT) ); - CHECK( addVariable("truth_nRPC", m_truth_nRPC) ); - CHECK( addVariable("truth_nTGC", m_truth_nTGC) ); - CHECK( addVariable("truth_nCSC", m_truth_nCSC) ); - CHECK( addVariable("noise_nMDT", m_noise_nMDT) ); - CHECK( addVariable("noise_nRPC", m_noise_nRPC) ); - CHECK( addVariable("noise_nTGC", m_noise_nTGC) ); - CHECK( addVariable("noise_nCSC", m_noise_nCSC) ); - CHECK( addVariable("common_nMDT", m_common_nMDT) ); - CHECK( addVariable("common_nRPC", m_common_nRPC) ); - CHECK( addVariable("common_nTGC", m_common_nTGC) ); - CHECK( addVariable("common_nCSC", m_common_nCSC) ); - - return StatusCode::SUCCESS; - } - - - StatusCode MuonPatternCombinationMissedHitFillerTool::initialize() - { - //get tools - if(m_truthTool.retrieve().isFailure() ){ - ATH_MSG_FATAL( "Could not get " << m_truthTool ); - return StatusCode::FAILURE; - } - if(!detStore()->retrieve(m_idHelper, "AtlasID").isSuccess()) { - ATH_MSG_FATAL("Unable to initialize ID helper."); - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; - } - - - StatusCode MuonPatternCombinationMissedHitFillerTool::fill(const EventInfo&) { - //build a MuonPatternCombination including all hits - Amg::Vector3D patpos(0,0,0); - Amg::Vector3D patdir(0,0,0); - std::vector<Muon::MuonPatternChamberIntersect> chambers; - //MDT - const Muon::MdtPrepDataContainer* mdtPrds = 0; - if(StatusCode::SUCCESS != evtStore()->retrieve(mdtPrds, "MDT_DriftCircles")) { - ATH_MSG_ERROR( " Cannot retrieve MDT PRD Container MDT_DriftCircles"); - return StatusCode::FAILURE; - } - Muon::MdtPrepDataContainer::const_iterator mdtit = mdtPrds->begin(); - Muon::MdtPrepDataContainer::const_iterator mdtit_end = mdtPrds->end(); - for(; mdtit!=mdtit_end; ++mdtit) { - if( (*mdtit)->size() == 0 ) continue; - - std::vector< const Trk::PrepRawData* > rios; - Muon::MdtPrepDataCollection::const_iterator it = (*mdtit)->begin(); - Muon::MdtPrepDataCollection::const_iterator it_end = (*mdtit)->end(); - for(; it != it_end; ++it) rios.push_back( *it ); - Muon::MuonPatternChamberIntersect chIntersect(patpos,patdir,rios); - chambers.push_back(chIntersect); - } - //RPC - const Muon::RpcPrepDataContainer* rpcPrds = 0; - if(StatusCode::SUCCESS != evtStore()->retrieve(rpcPrds,"RPC_Measurements")) { - ATH_MSG_ERROR( "Cannot retrieve the RPC PRD container " ); - return StatusCode::FAILURE; - } - Muon::RpcPrepDataContainer::const_iterator rpcit = rpcPrds->begin(); - Muon::RpcPrepDataContainer::const_iterator rpcit_end = rpcPrds->end(); - for(; rpcit!=rpcit_end; ++rpcit) { - if( (*rpcit)->size() == 0 ) continue; - std::vector< const Trk::PrepRawData* > rios; - Muon::RpcPrepDataCollection::const_iterator it = (*rpcit)->begin(); - Muon::RpcPrepDataCollection::const_iterator it_end = (*rpcit)->end(); - for(; it != it_end; ++it) rios.push_back( *it ); - Muon::MuonPatternChamberIntersect chIntersect(patpos,patdir,rios); - chambers.push_back(chIntersect); - } - //TGC - const Muon::TgcPrepDataContainer* tgcPrds = 0; - if(StatusCode::SUCCESS != evtStore()->retrieve(tgcPrds,"TGC_Measurements")) { - ATH_MSG_ERROR( "Cannot retrieve the TGC PRD container " ); - return StatusCode::FAILURE; - } - Muon::TgcPrepDataContainer::const_iterator tgcit = tgcPrds->begin(); - Muon::TgcPrepDataContainer::const_iterator tgcit_end = tgcPrds->end(); - for(; tgcit!=tgcit_end; ++tgcit) { - if( (*tgcit)->size() == 0 ) continue; - std::vector< const Trk::PrepRawData* > rios; - Muon::TgcPrepDataCollection::const_iterator it = (*tgcit)->begin(); - Muon::TgcPrepDataCollection::const_iterator it_end = (*tgcit)->end(); - for(; it != it_end; ++it) rios.push_back( *it ); - Muon::MuonPatternChamberIntersect chIntersect(patpos,patdir,rios); - chambers.push_back(chIntersect); - } - //CSC - const Muon::CscPrepDataContainer* cscPrds = 0; - if(StatusCode::SUCCESS != evtStore()->retrieve(cscPrds,"CSC_Clusters")) { - ATH_MSG_ERROR( "Cannot retrieve the CSC PRD container " ); - return StatusCode::FAILURE; - } - Muon::CscPrepDataContainer::const_iterator cscit = cscPrds->begin(); - Muon::CscPrepDataContainer::const_iterator cscit_end = cscPrds->end(); - for(; cscit!=cscit_end; ++cscit) { - if( (*cscit)->size() == 0 ) continue; - std::vector< const Trk::PrepRawData* > rios; - Muon::CscPrepDataCollection::const_iterator it = (*cscit)->begin(); - Muon::CscPrepDataCollection::const_iterator it_end = (*cscit)->end(); - for(; it != it_end; ++it) rios.push_back( *it ); - Muon::MuonPatternChamberIntersect chIntersect(patpos,patdir,rios); - chambers.push_back(chIntersect); - } - //build the pattern combination - auto pattern = std::make_unique<Muon::MuonPatternCombination> - (new Trk::Perigee(patpos,patdir,1,patpos), chambers); - pattern->setTrackRoadType(3); - - -// BEGIN - - if(pattern->chamberData().size() == 0) return StatusCode::SUCCESS; - - //---------------------------------------------------------------- - // Retrieve prep raw data truth - std::vector<std::string> PRD_TruthNames; - PRD_TruthNames.push_back("CSC_TruthMap"); - PRD_TruthNames.push_back("RPC_TruthMap"); - PRD_TruthNames.push_back("TGC_TruthMap"); - PRD_TruthNames.push_back("MDT_TruthMap"); - - std::vector<const PRD_MultiTruthCollection*> prdCollectionVector; - for(std::vector<std::string>::const_iterator ikey=PRD_TruthNames.begin(); ikey!=PRD_TruthNames.end(); ++ikey) { - prdCollectionVector.push_back(0); - StatusCode sc = evtStore()->retrieve(*prdCollectionVector.rbegin(), *ikey); - if (!sc.isSuccess()){ - ATH_MSG_WARNING( "PRD_MultiTruthCollection " << *ikey << " NOT found"); - } else { - ATH_MSG_DEBUG( "Got PRD_MultiTruthCollection " << *ikey); - } - } - - //---------------------------------------------------------------- - // Produce and store the output. - std::vector<DetailedTrackTruth> *dtt = new std::vector<DetailedTrackTruth>; - m_truthTool->buildDetailedTrackTruth(dtt, (*pattern), prdCollectionVector); - - bool isTruthMatched(false); - for(std::vector<DetailedTrackTruth>::const_iterator dtit=dtt->begin(); dtit!=dtt->end(); ++dtit) { - const TruthTrajectory traj = (*dtit).trajectory(); - if(traj[0].isValid()) { - isTruthMatched = true; - - vector<int> barcode_list; - for(unsigned int i = 0; i < traj.size(); i++) { - barcode_list.push_back(traj[i].barcode()); - } - m_truth_barcode->push_back(barcode_list); - m_truth_nMDT->push_back(dtit->statsTruth()[SubDetHitStatistics::MDT]); - m_truth_nRPC->push_back(dtit->statsTruth()[SubDetHitStatistics::RPC]); - m_truth_nTGC->push_back(dtit->statsTruth()[SubDetHitStatistics::TGC]); - m_truth_nCSC->push_back(dtit->statsTruth()[SubDetHitStatistics::CSC]); - m_common_nMDT->push_back(dtit->statsCommon()[SubDetHitStatistics::MDT]); - m_common_nRPC->push_back(dtit->statsCommon()[SubDetHitStatistics::RPC]); - m_common_nTGC->push_back(dtit->statsCommon()[SubDetHitStatistics::TGC]); - m_common_nCSC->push_back(dtit->statsCommon()[SubDetHitStatistics::CSC]); - m_noise_nMDT->push_back(dtit->statsTrack()[SubDetHitStatistics::MDT]-dtit->statsCommon()[SubDetHitStatistics::MDT]); - m_noise_nRPC->push_back(dtit->statsTrack()[SubDetHitStatistics::RPC]-dtit->statsCommon()[SubDetHitStatistics::RPC]); - m_noise_nTGC->push_back(dtit->statsTrack()[SubDetHitStatistics::TGC]-dtit->statsCommon()[SubDetHitStatistics::TGC]); - m_noise_nCSC->push_back(dtit->statsTrack()[SubDetHitStatistics::CSC]-dtit->statsCommon()[SubDetHitStatistics::CSC]); - } - } - if(!isTruthMatched) { - vector<int> temp; - temp.push_back(0); - m_truth_barcode->push_back(temp); - m_truth_nMDT->push_back(0); - m_truth_nRPC->push_back(0); - m_truth_nTGC->push_back(0); - m_truth_nCSC->push_back(0); - m_common_nMDT->push_back(0); - m_common_nRPC->push_back(0); - m_common_nTGC->push_back(0); - m_common_nCSC->push_back(0); - m_noise_nMDT->push_back(0); - m_noise_nRPC->push_back(0); - m_noise_nTGC->push_back(0); - m_noise_nCSC->push_back(0); - } - - delete dtt; - -// END HISTO FILLING - - - - //clean memory and return - return StatusCode::SUCCESS; - } - - SubDetHitStatistics::SubDetType MuonPatternCombinationMissedHitFillerTool::findSubDetType(Identifier id) { - if (m_idHelper->is_pixel(id)) - return SubDetHitStatistics::Pixel; - if (m_idHelper->is_sct(id)) - return SubDetHitStatistics::SCT; - if (m_idHelper->is_trt(id)) - return SubDetHitStatistics::TRT; - if (m_idHelper->is_mdt(id)) - return SubDetHitStatistics::MDT; - if (m_idHelper->is_rpc(id)) - return SubDetHitStatistics::RPC; - if (m_idHelper->is_tgc(id)) - return SubDetHitStatistics::TGC; - if (m_idHelper->is_csc(id)) - return SubDetHitStatistics::CSC; - - - ATH_MSG_WARNING("findSubDetType(): UNKNOWN subdet for id="<<id); - return SubDetHitStatistics::NUM_SUBDETECTORS; - } - - -} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.h deleted file mode 100644 index 7e199dbaafd6c9f3036b2543da690a701fe06da3..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @file MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.h - * @author Daniel Ventura <ventura@cern.ch> - * @date November 2012 - * @brief Block filler tool for hits not contained in MuonPatternCombinations, detail level 1 - */ - -#ifndef D3PDMAKER_MUONPATTERNCOMBINATIONMISSEDHITFILLERTOOL_H -#define D3PDMAKER_MUONPATTERNCOMBINATIONMISSEDHITFILLERTOOL_H - -#include "GaudiKernel/ToolHandle.h" -#include "D3PDMakerUtils/BlockFillerTool.h" -#include "MuonPattern/MuonPatternCombination.h" -#include "MuonRecToolInterfaces/IDetailedMuonPatternTruthBuilder.h" -#include "TrkTruthData/SubDetHitStatistics.h" -#include "AtlasDetDescr/AtlasDetectorID.h" -#include "EventInfo/EventInfo.h" -#include <vector> - - -namespace D3PD { - - -class MuonPatternCombinationMissedHitFillerTool - : public BlockFillerTool< EventInfo > -{ -public: - MuonPatternCombinationMissedHitFillerTool (const std::string& type, - const std::string& name, - const IInterface* parent); - - virtual StatusCode book(); - virtual StatusCode initialize(); - - virtual StatusCode fill(const EventInfo& p); - virtual SubDetHitStatistics::SubDetType findSubDetType(Identifier id); - -private: - std::vector<std::vector<int> >* m_truth_barcode; - std::vector<int>* m_truth_nMDT; - std::vector<int>* m_truth_nRPC; - std::vector<int>* m_truth_nTGC; - std::vector<int>* m_truth_nCSC; - std::vector<int>* m_noise_nMDT; - std::vector<int>* m_noise_nRPC; - std::vector<int>* m_noise_nTGC; - std::vector<int>* m_noise_nCSC; - std::vector<int>* m_common_nMDT; - std::vector<int>* m_common_nRPC; - std::vector<int>* m_common_nTGC; - std::vector<int>* m_common_nCSC; - - const AtlasDetectorID *m_idHelper; - ToolHandle<Trk::IDetailedMuonPatternTruthBuilder> m_truthTool; -}; - -} // namespace D3PD - -#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/components/MuonD3PDMaker_entries.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/components/MuonD3PDMaker_entries.cxx index c28d6f28368e6d1afd8412c729916006cf713ef5..6aba03101c56723f0890cb8f2c16fc05f0723588 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/components/MuonD3PDMaker_entries.cxx +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/components/MuonD3PDMaker_entries.cxx @@ -19,7 +19,6 @@ #include "../TgcPrepDataCollectionGetterTool.h" // David #include "../CscPrepDataCollectionGetterTool.h" // David #include "../MuonPatternCombinationFillerTool.h" // Daniel -#include "../MuonPatternCombinationMissedHitFillerTool.h" // Daniel #include "../MuonSegmentTruthFillerTool.h" // Daniel #include "../MDTSimHitFillerTool.h" @@ -49,7 +48,6 @@ DECLARE_COMPONENT( D3PD::RpcPrepDataCollectionGetterTool ) // David DECLARE_COMPONENT( D3PD::TgcPrepDataCollectionGetterTool ) // David DECLARE_COMPONENT( D3PD::CscPrepDataCollectionGetterTool ) // David DECLARE_COMPONENT( D3PD::MuonPatternCombinationFillerTool ) // Daniel -DECLARE_COMPONENT( D3PD::MuonPatternCombinationMissedHitFillerTool ) // Daniel DECLARE_COMPONENT( D3PD::MuonSegmentTruthFillerTool ) // Daniel DECLARE_COMPONENT( D3PD::MDTSimHitFillerTool )