From 76eeb5b6f9b2fb67712d35190b810dadaac91966 Mon Sep 17 00:00:00 2001 From: Apostolos Tsirigotis <apostolos.tsirigotis@cern.ch> Date: Mon, 20 Jan 2020 09:12:19 +0100 Subject: [PATCH 1/2] Replaced all cout printing code with ATH_MSG_*, or MsgStream log, cleaned code from commented out lines, and checked for tread safety. --- .../MuonHoughPatternFinderTool.h | 4 +- .../MuonLayerHoughTool.h | 42 +++-- .../src/MuonHoughPatternFinderTool.cxx | 42 ++--- .../src/MuonHoughPatternTool.cxx | 105 ++++++------- .../src/MuonLayerHoughAlg.cxx | 30 +--- .../src/MuonLayerHoughAlg.h | 28 ++-- .../src/MuonLayerHoughTool.cxx | 143 +++--------------- .../MuonHoughPatternEvent/MuonHoughHisto2D.h | 14 +- .../MuonHoughHisto2DContainer.h | 4 +- .../MuonHoughPatternEvent/MuonHoughHit.h | 4 +- .../MuonHoughMathUtils.h | 4 +- .../MuonHoughPatternEvent/MuonHoughPattern.h | 4 +- .../MuonHoughTransformer_rz.h | 11 +- .../MuonHoughTransformer_xy.h | 4 +- .../MuonHoughTransformer_xyz.h | 4 +- .../MuonHoughTransformer_yz.h | 4 +- .../src/MuonHoughHisto2D.cxx | 50 +++--- .../src/MuonHoughHisto2DContainer.cxx | 18 +-- .../src/MuonHoughHit.cxx | 12 +- .../src/MuonHoughMathUtils.cxx | 79 ++-------- .../src/MuonHoughPattern.cxx | 34 +++-- .../src/MuonHoughTransformSteering.cxx | 24 +-- .../src/MuonHoughTransformer.cxx | 56 +++---- ...MuonHoughTransformer_CurvedAtACylinder.cxx | 72 ++++----- .../src/MuonHoughTransformer_rz.cxx | 78 ++++------ .../src/MuonHoughTransformer_rzcosmics.cxx | 48 +++--- .../src/MuonHoughTransformer_xy.cxx | 6 +- .../src/MuonHoughTransformer_xyz.cxx | 82 ++++------ .../src/MuonHoughTransformer_yz.cxx | 6 +- 29 files changed, 346 insertions(+), 666 deletions(-) diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h index 2e04077e4f64..f9ffd433a3fa 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONHOUGHPATTERNALGS_MUONHOUGHPATTERNFINDERTOOL_H @@ -40,7 +40,7 @@ namespace Muon { MuonHoughPatternFinderTool(const std::string&, const std::string&, const IInterface*); /** destructor */ - virtual ~MuonHoughPatternFinderTool(); + virtual ~MuonHoughPatternFinderTool() = default; /** initialize */ virtual StatusCode initialize(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h index fe7f6c23307c..b25af5434d45 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONHOUGHPATTERNTOOLS_MUONLAYERHOUGHTOOL_H @@ -34,6 +34,7 @@ #include "MuonDetDescrUtils/MuonSectorMapping.h" #include "xAODTruth/TruthParticleContainer.h" #include "xAODMuon/MuonSegmentContainer.h" +#include "TrkTruthData/PRD_MultiTruthCollection.h" namespace Trk{ class PrepRawData; @@ -41,7 +42,6 @@ namespace Trk{ class TFile; class TTree; -class PRD_MultiTruthCollection; namespace MuonGM { class MuonDetectorManager; @@ -54,9 +54,6 @@ static const InterfaceID IID_MuonLayerHoughTool("Muon::MuonLayerHoughTool",1,0); namespace Muon { - class MuonIdHelperTool; - - class MuonLayerHoughTool: virtual public IMuonHoughPatternFinderTool, public AthAlgTool { public: @@ -114,7 +111,7 @@ namespace Muon { MuonLayerHoughTool(const std::string& type, const std::string& name, const IInterface* parent); /** Destructor */ - virtual ~MuonLayerHoughTool(); + virtual ~MuonLayerHoughTool() = default; /** @brief access to tool interface */ static const InterfaceID& interfaceID() { return IID_MuonLayerHoughTool; } @@ -229,33 +226,33 @@ namespace Muon { std::unique_ptr<HoughDataPerSectorVec>& houghDataPerSectorVec, std::vector<Road>& roads ) const; void mergePhiMaxima( Road& road ) const; - bool m_useSeeds; + Gaudi::Property<bool> m_useSeeds{this,"UseSeeds",true}; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", + ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "MuonIdHelperTool", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - ToolHandle<MuonEDMPrinterTool> m_printer; - ToolHandle<Muon::IMuonTruthSummaryTool> m_truthSummaryTool; + ToolHandle<MuonEDMPrinterTool> m_printer{this, "printerTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}; + ToolHandle<Muon::IMuonTruthSummaryTool> m_truthSummaryTool{this, "MuonTruthSummaryTool", "Muon::MuonTruthSummaryTool/MuonTruthSummaryTool"}; const MuonGM::MuonDetectorManager* m_detMgr; std::vector<MuonHough::MuonLayerHoughSelector> m_selectors; std::vector<MuonHough::MuonLayerHoughSelector> m_selectorsLoose; - bool m_doNtuple; + Gaudi::Property<bool> m_doNtuple{this,"DoNtuple",false}; TFile* m_file; TTree* m_tree; mutable MuonHough::HitNtuple* m_ntuple ATLAS_THREAD_SAFE; // Marked as thread-safe because it's disabled when running multi-threaded - SG::ReadHandleKeyArray< PRD_MultiTruthCollection > m_truthNames; - SG::ReadHandleKey<xAOD::TruthParticleContainer> m_MuonTruthParticlesKey; - SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_MuonTruthSegmentsKey; + SG::ReadHandleKeyArray< PRD_MultiTruthCollection > m_truthNames{this, "TruthNames", {}}; + SG::ReadHandleKey<xAOD::TruthParticleContainer> m_MuonTruthParticlesKey{this,"MuonTruthParticlesKey","MuonTruthParticles"}; + SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_MuonTruthSegmentsKey{this,"MuonTruthSegmentsKey","MuonTruthSegments"}; - bool m_useRpcTimeVeto; - bool m_requireTriggerConfirmationNSW; - bool m_onlyUseCurrentBunch; - bool m_doTruth; - bool m_debugHough; - bool m_doParabolicExtrapolation; // if true, do parabolic; if false, do linear extrapolation - float m_extrapolationDistance; // default value is 1500 - bool m_addSectors; // default true + Gaudi::Property<bool> m_useRpcTimeVeto{this,"RpcTimeVeto",false}; + Gaudi::Property<bool> m_requireTriggerConfirmationNSW{this,"TriggerConfirmationNSW",false}; + Gaudi::Property<bool> m_onlyUseCurrentBunch{this,"OnlyUseCurrentBunch",false}; + Gaudi::Property<bool> m_doTruth{this,"DoTruth",false}; + Gaudi::Property<bool> m_debugHough{this,"DebugHough",false}; + Gaudi::Property<bool> m_doParabolicExtrapolation{this,"DoParabolicExtrapolation",true}; // if true, do parabolic; if false, do linear extrapolation + Gaudi::Property<float> m_extrapolationDistance{this,"ExtrapolationDistance",1500.}; // default value is 1500 + Gaudi::Property<bool> m_addSectors{this,"AddSectors",false}; // default false unsigned int m_ntechnologies; CollectionsPerSectorVec m_collectionsPerSector; @@ -295,7 +292,6 @@ namespace Muon { } inline int MuonLayerHoughTool::sublay( const Identifier& id, float /*z*/ ) const { - int sublayer = 0; if( m_muonIdHelperTool->isMdt(id) ) { sublayer = m_muonIdHelperTool->mdtIdHelper().tubeLayer(id)-1; diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx index b1b3c656a93a..904fcb072f2f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternTools/MuonHoughPatternFinderTool.h" @@ -99,10 +99,6 @@ namespace Muon { declareProperty("COMBINED_PATTERNS", m_COMBINED_PATTERNSKey); } - MuonHoughPatternFinderTool::~MuonHoughPatternFinderTool() - { - } - StatusCode MuonHoughPatternFinderTool::initialize() { if (m_use_histos == true) { @@ -149,7 +145,6 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo const MuonSegmentCombinationCollection* cscSegmentCombis ) const { // read event_data: const MuonHoughHitContainer* hitcontainer = getAllHits( mdtCols, cscCols, tgcCols, rpcCols, cscSegmentCombis ); - // analyse data std::unique_ptr<MuonPatternCombinationCollection> patCombiCol; if( hitcontainer ) { @@ -438,24 +433,18 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo } - // if statement for verbose: - - if (this->msgLvl (MSG::VERBOSE)) { - - ATH_MSG_VERBOSE ("MuonHoughPatternFinderTool::getAllHits() saving " - << hitcontainer->size()<<" converted hits"); + ATH_MSG_VERBOSE ("MuonHoughPatternFinderTool::getAllHits() saving " + << hitcontainer->size()<<" converted hits"); - for(unsigned int i=0;i<hitcontainer->size();i++) - { - ATH_MSG_VERBOSE (" hit " << hitcontainer->getHit(i)->getWhichDetector() - << " (" << hitcontainer->getHit(i)->getHitx() << "," << hitcontainer->getHit(i)->getHity() - << "," << hitcontainer->getHit(i)->getHitz() << ") " << " weight: " << hitcontainer->getHit(i)->getWeight() << " measures phi: " << hitcontainer->getHit(i)->getMeasuresPhi()); - } + for(unsigned int i=0;i<hitcontainer->size();i++) + { + ATH_MSG_VERBOSE (" hit " << hitcontainer->getHit(i)->getWhichDetector() + << " (" << hitcontainer->getHit(i)->getHitx() << "," << hitcontainer->getHit(i)->getHity() + << "," << hitcontainer->getHit(i)->getHitz() << ") " << " weight: " << hitcontainer->getHit(i)->getWeight() << " measures phi: " << hitcontainer->getHit(i)->getMeasuresPhi()); + } - ATH_MSG_VERBOSE ("MuonHoughPatternFinderTool::getAllHits() saving " << m_phietahitassociation->size() - << "associated hits "); - } - + ATH_MSG_VERBOSE ("MuonHoughPatternFinderTool::getAllHits() saving " << m_phietahitassociation->size() + << "associated hits "); return hitcontainer; } // getAllHits @@ -490,12 +479,10 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo { if (1) { - //msg() << MSG::VERBOSE << "Event through Cut()" << endmsg; return true; } else { - //msg() << MSG::VERBOSE << "Event not through Cut()" << endmsg; return false; } } @@ -670,7 +657,6 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo { const Muon::TgcPrepData* prd = *cit; Identifier id = prd->identify(); - //bool channel_type = prd->channelType(); bool channel_type = m_muonIdHelperTool->tgcIdHelper().isStrip(id); // like measuresPhi() int channel = m_muonIdHelperTool->tgcIdHelper().channel(id); // between 1 and 135! if (channel_type==true) {channel+=m_muonIdHelperTool->tgcIdHelper().channelMax();} @@ -758,7 +744,6 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo if (channel_type==true) layer_number = layer_number + 3 ; double number_of_hits = (double) number_of_hits_per_layer[layer_number]; if (number_of_hits > 0) { -// weight = 1. / (0.75*std::sqrt(number_of_hits)+0.25*number_of_hits); weight = 1. / (0.25*std::sqrt(number_of_hits)+0.75*number_of_hits); if( layers.size() == 2) weight = weight/2.; } else { @@ -858,8 +843,6 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo std::vector<int> multilayer; std::vector<int> tubelayer; std::vector<int> tubes; - // std::vector<double> w1; - // std::vector<double> w2; std::vector<int> onsegment; // non-zero if on segment, int indicates how many hits in same layer are on segment (used in weighting) std::vector<double> psi; std::vector<double> weight_trigger; @@ -962,7 +945,6 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo m_weighthistogram->Fill(0); m_weighthistogrammdt->Fill(0); } - //msg() << MSG::DEBUG << "Hit accepted" << endmsg; } // collection return; @@ -973,7 +955,6 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo for (unsigned int i=0; i<prdsize; i++) { if (tubecount[tubes[i]] > 1 ) ++number_of_hits_per_layer[layers[i]]; - // if (tubecount[i] > tubem ) tubem = tubecount[i]; // KILL 1 hit cases if (tubecount[tubes[i]] <= 1 ) prob[i] = 0; @@ -1209,7 +1190,6 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo m_weighthistogram->Fill(weights[i]); m_weighthistogrammdt->Fill(weights[i]); } - //msg() << MSG::DEBUG << "Hit accepted" << endmsg; } // collection } diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternTool.cxx index 78b8dcf6a18e..a59be0446400 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-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternTools/MuonHoughPatternTool.h" @@ -133,7 +133,6 @@ void MuonHoughPatternTool::useIPMuons() void MuonHoughPatternTool::makePatterns(const MuonHoughHitContainer* hitcontainer) const { m_event = hitcontainer; - /** empty and reinitialize the houghpattern vectors */ reset(); init(); @@ -159,22 +158,19 @@ void MuonHoughPatternTool::makePatterns(const MuonHoughHitContainer* hitcontaine // reset weights, based on rejection factor and m_weightmdt calculateWeights(m_event); - if( msgLvl(MSG::VERBOSE) ) { - msg(MSG::VERBOSE) << "Event Info"; + ATH_MSG_VERBOSE("Event Info"); - msg(MSG::VERBOSE) << "Size: " << m_event->size() << endmsg; - - for (unsigned int i=0; i<m_event->size(); i++) { - msg(MSG::VERBOSE) << m_event->getHit(i)->getHitx() << " " - << m_event->getHit(i)->getHity() << " " - << m_event->getHit(i)->getHitz() << " " - << m_event->getHit(i)->getMeasuresPhi() << " " - << m_event->getHit(i)->getWhichDetector() << " " - << m_event->getHit(i)->getProbability() << " " - << m_event->getHit(i)->getWeight() << " " - << m_event->getHit(i)->getAssociated() << - endmsg; - } + ATH_MSG_VERBOSE("Size: " << m_event->size()); + + for (unsigned int i=0; i<m_event->size(); i++) { + ATH_MSG_VERBOSE(m_event->getHit(i)->getHitx() << " " + << m_event->getHit(i)->getHity() << " " + << m_event->getHit(i)->getHitz() << " " + << m_event->getHit(i)->getMeasuresPhi() << " " + << m_event->getHit(i)->getWhichDetector() << " " + << m_event->getHit(i)->getProbability() << " " + << m_event->getHit(i)->getWeight() << " " + << m_event->getHit(i)->getAssociated()); } makePatterns(MuonHough::hough_xy); @@ -204,34 +200,28 @@ void MuonHoughPatternTool::makePatterns(int id_number) const MuonHoughHitContainer* event_for_hough = whichEventHough(id_number, m_event); MuonHoughHitContainer* event_for_association = whichEventAssociation(id_number, m_event); - if (msgLvl(MSG::VERBOSE)) { - msg(MSG::VERBOSE) << "Size event fill: " << event_for_hough->size() << endmsg; - for (unsigned int i=0; i<event_for_hough->size(); i++) { - msg(MSG::VERBOSE) << event_for_hough->getHit(i)->getHitx() << " " - << event_for_hough->getHit(i)->getHity() << " " - << event_for_hough->getHit(i)->getHitz() << " " - << event_for_hough->getHit(i)->getMeasuresPhi() << " " - << event_for_hough->getHit(i)->getWhichDetector() << " " - << event_for_hough->getHit(i)->getProbability() << " " - << event_for_hough->getHit(i)->getWeight() << " " - << event_for_hough->getHit(i)->getAssociated() << - endmsg; - } - - if( msgLvl(MSG::VERBOSE) ) { - msg(MSG::VERBOSE) << "Size event association: " << event_for_association->size() << endmsg; - for (unsigned int i=0; i<event_for_association->size(); i++) { - msg(MSG::VERBOSE) << event_for_association->getHit(i)->getHitx() << " " - << event_for_association->getHit(i)->getHity() << " " - << event_for_association->getHit(i)->getHitz() << " " - << event_for_association->getHit(i)->getMeasuresPhi() << " " - << event_for_association->getHit(i)->getWhichDetector() << " " - << event_for_association->getHit(i)->getProbability() << " " - << event_for_association->getHit(i)->getWeight() << " " - << event_for_association->getHit(i)->getAssociated() << - endmsg; - } - } + ATH_MSG_VERBOSE("Size event fill: " << event_for_hough->size()); + for (unsigned int i=0; i<event_for_hough->size(); i++) { + ATH_MSG_VERBOSE(event_for_hough->getHit(i)->getHitx() << " " + << event_for_hough->getHit(i)->getHity() << " " + << event_for_hough->getHit(i)->getHitz() << " " + << event_for_hough->getHit(i)->getMeasuresPhi() << " " + << event_for_hough->getHit(i)->getWhichDetector() << " " + << event_for_hough->getHit(i)->getProbability() << " " + << event_for_hough->getHit(i)->getWeight() << " " + << event_for_hough->getHit(i)->getAssociated()); + } + + ATH_MSG_VERBOSE("Size event association: " << event_for_association->size()); + for (unsigned int i=0; i<event_for_association->size(); i++) { + ATH_MSG_VERBOSE(event_for_association->getHit(i)->getHitx() << " " + << event_for_association->getHit(i)->getHity() << " " + << event_for_association->getHit(i)->getHitz() << " " + << event_for_association->getHit(i)->getMeasuresPhi() << " " + << event_for_association->getHit(i)->getWhichDetector() << " " + << event_for_association->getHit(i)->getProbability() << " " + << event_for_association->getHit(i)->getWeight() << " " + << event_for_association->getHit(i)->getAssociated()); } ATH_MSG_DEBUG("size of event: " << event_for_association->size() << " id_number: " << id_number); @@ -513,9 +503,6 @@ bool MuonHoughPatternTool::analyseHisto(int id_number,int level,const MuonHoughH // print_of houghpatterns: ATH_MSG_DEBUG("Size of HoughPatterns: " << houghpattern->size()); - //m_log << MSG::DEBUG << "(ABsolut) Maxima: "); - - //m_log << MSG::DEBUG << "id " << id_number << ": " << "withoutbinregion: " << histogram->getMaximum(maximum_number,which_segment,m_printlevel) << " with: " << numberofmaxima); } // check op houghpattern pointer } //maximum_number @@ -1649,17 +1636,15 @@ Muon::MuonPrdPattern* MuonHoughPatternTool::houghPatternToCleanPhiPattern(MuonHo ATH_MSG_DEBUG("houghPatternToCleanPhiPattern"); - if (msgLvl(MSG::VERBOSE)) { - for (unsigned int i=0; i<houghpattern->size(); i++) { - msg(MSG::VERBOSE) << houghpattern->getHit(i)->getHitx() << " " - << houghpattern->getHit(i)->getHity() << " " - << houghpattern->getHit(i)->getHitz() << " " - << houghpattern->getHit(i)->getPhi() << " " - << houghpattern->getHit(i)->getMeasuresPhi() << " " - << houghpattern->getHit(i)->getWhichDetector() << " " - << houghpattern->getHit(i)->getWeight() << " " - << houghpattern->getHit(i)->getAssociated() << endmsg; - } + for (unsigned int i=0; i<houghpattern->size(); i++) { + ATH_MSG_VERBOSE(houghpattern->getHit(i)->getHitx() << " " + << houghpattern->getHit(i)->getHity() << " " + << houghpattern->getHit(i)->getHitz() << " " + << houghpattern->getHit(i)->getPhi() << " " + << houghpattern->getHit(i)->getMeasuresPhi() << " " + << houghpattern->getHit(i)->getWhichDetector() << " " + << houghpattern->getHit(i)->getWeight() << " " + << houghpattern->getHit(i)->getAssociated()); } double theta = houghpattern->getETheta(); @@ -1744,8 +1729,8 @@ Muon::MuonPrdPattern* MuonHoughPatternTool::houghPatternToCleanPhiPattern(MuonHo ATH_MSG_DEBUG("END Clean Phi hits " << newsize << " theta " << thetanew); + ATH_MSG_VERBOSE("cleaned pattern: "); if (msgLvl(MSG::VERBOSE)) { - msg(MSG::VERBOSE) << "cleaned pattern: " << endmsg; printPattern(muonpattern); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx index edb121fce032..7880cd0b61dd 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonLayerHoughAlg.h" @@ -12,32 +12,7 @@ #include "MuonPrepRawData/MMPrepDataCollection.h" MuonLayerHoughAlg::MuonLayerHoughAlg(const std::string& name, ISvcLocator* pSvcLocator): - AthAlgorithm(name,pSvcLocator), - m_keyTgc("TGC_Measurements"), - m_keyRpc("RPC_Measurements"), - m_keyCsc("CSC_Clusters"), - m_keyMdt("MDT_DriftCircles"), - m_keysTgc("STGC_Measurements"), - m_keyMM("MM_Measurements"), - m_combis("MuonLayerHoughCombis"), - m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_layerTool("Muon::MuonLayerHoughTool/MuonLayerHoughTool", this) -{ - - declareProperty("CscPrepDataContainer", m_keyCsc); - declareProperty("MdtPrepDataContainer", m_keyMdt); - declareProperty("RpcPrepDataContainer", m_keyRpc); - declareProperty("TgcPrepDataContainer", m_keyTgc); - declareProperty("TgcPrepDataContainerPriorBC", m_keyTgcPriorBC = "TGC_MeasurementsPriorBC");//unused - declareProperty("TgcPrepDataContainerNextBC", m_keyTgcNextBC = "TGC_MeasurementsNextBC");//unused - declareProperty("sTgcPrepDataContainer", m_keysTgc); - declareProperty("MMPrepDataContainer", m_keyMM); - declareProperty("PrintSummary", m_printSummary = false ); - declareProperty("MuonPatternCombinationCollection", m_combis); - declareProperty("MuonLayerScanTool", m_layerTool ); -} - -MuonLayerHoughAlg::~MuonLayerHoughAlg() + AthAlgorithm(name,pSvcLocator) { } @@ -71,7 +46,6 @@ StatusCode MuonLayerHoughAlg::execute() const Muon::CscPrepDataContainer* cscPrds = GetObject(m_keyCsc); const Muon::sTgcPrepDataContainer* stgcPrds = GetObject(m_keysTgc); const Muon::MMPrepDataContainer* mmPrds =GetObject(m_keyMM); - ATH_MSG_VERBOSE("calling layer tool "); auto [combis, houghDataPerSectorVec] = m_layerTool->analyse(mdtPrds,cscPrds,tgcPrds,rpcPrds,stgcPrds,mmPrds); diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.h index 77e41d54a15c..46aff7555fbe 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughAlg.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 */ #ifndef MUONLAYERHOUGHALG_H @@ -13,7 +13,7 @@ class MuonLayerHoughAlg : public AthAlgorithm public: MuonLayerHoughAlg(const std::string& name, ISvcLocator* pSvcLocator); - virtual ~MuonLayerHoughAlg(); + virtual ~MuonLayerHoughAlg() = default; virtual StatusCode initialize() override; virtual StatusCode execute() override; @@ -26,21 +26,19 @@ class MuonLayerHoughAlg : public AthAlgorithm /** storegate location of the MuonPrepDataContainer for all four technologies */ - SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_keyTgc; - std::string m_keyTgcPriorBC;//unused - std::string m_keyTgcNextBC;//unused - SG::ReadHandleKey<Muon::RpcPrepDataContainer> m_keyRpc; - SG::ReadHandleKey<Muon::CscPrepDataContainer> m_keyCsc; - SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_keyMdt; - SG::ReadHandleKey<Muon::sTgcPrepDataContainer> m_keysTgc; - SG::ReadHandleKey<Muon::MMPrepDataContainer> m_keyMM; - - SG::WriteHandleKey<MuonPatternCombinationCollection> m_combis; + SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_keyTgc{this,"TgcPrepDataContainer","TGC_Measurements"}; + SG::ReadHandleKey<Muon::RpcPrepDataContainer> m_keyRpc{this,"RpcPrepDataContainer","RPC_Measurements"}; + SG::ReadHandleKey<Muon::CscPrepDataContainer> m_keyCsc{this,"CscPrepDataContainer","CSC_Clusters"}; + SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_keyMdt{this,"MdtPrepDataContainer","MDT_DriftCircles"}; + SG::ReadHandleKey<Muon::sTgcPrepDataContainer> m_keysTgc{this,"sTgcPrepDataContainer","STGC_Measurements"}; + SG::ReadHandleKey<Muon::MMPrepDataContainer> m_keyMM{this,"MMPrepDataContainer","MM_Measurements"}; + + SG::WriteHandleKey<MuonPatternCombinationCollection> m_combis{this,"MuonPatternCombinationCollection","MuonLayerHoughCombis"}; SG::WriteHandleKey<Muon::MuonLayerHoughTool::HoughDataPerSectorVec> m_houghDataPerSectorVecKey {this, "Key_MuonLayerHoughToolHoughDataPerSectorVec", "HoughDataPerSectorVec", "HoughDataPerSectorVec key"}; - ToolHandle<Muon::MuonEDMPrinterTool> m_printer; - ToolHandle<Muon::MuonLayerHoughTool> m_layerTool; - bool m_printSummary; + ToolHandle<Muon::MuonEDMPrinterTool> m_printer{this,"printerTool","Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}; + ToolHandle<Muon::MuonLayerHoughTool> m_layerTool{this,"MuonLayerScanTool","Muon::MuonLayerHoughTool/MuonLayerHoughTool"}; + Gaudi::Property<bool> m_printSummary{this,"PrintSummary",false}; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx index df174c0527e3..d58bbab86db8 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternTools/MuonLayerHoughTool.h" @@ -11,8 +11,6 @@ #include "MuonPattern/MuonPatternChamberIntersect.h" #include "TFile.h" #include "TTree.h" -#include <iostream> -#include "TrkTruthData/PRD_MultiTruthCollection.h" #include "HepMC/GenEvent.h" #include "GaudiKernel/ConcurrencyFlags.h" #include "CxxUtils/sincos.h" @@ -23,38 +21,11 @@ namespace Muon { MuonLayerHoughTool::MuonLayerHoughTool(const std::string& type, const std::string& name, const IInterface* parent): AthAlgTool(type,name,parent), - m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_truthSummaryTool("Muon::MuonTruthSummaryTool/MuonTruthSummaryTool"), m_detMgr(0), - m_truthNames{}, - m_MuonTruthParticlesKey("MuonTruthParticles"), - m_MuonTruthSegmentsKey("MuonTruthSegments"), m_ntechnologies(4) { declareInterface<MuonLayerHoughTool>(this); declareInterface<IMuonHoughPatternFinderTool>(this); - - declareProperty("MuonIdHelperTool",m_muonIdHelperTool); - declareProperty("MuonTruthSummaryTool",m_truthSummaryTool); - declareProperty("DoNtuple",m_doNtuple = false); - - declareProperty("TruthNames", m_truthNames); - - declareProperty("TriggerConfirmationNSW",m_requireTriggerConfirmationNSW = false ); - declareProperty("OnlyUseCurrentBunch",m_onlyUseCurrentBunch = false ); - declareProperty("RpcTimeVeto",m_useRpcTimeVeto = false ); - declareProperty("DoTruth",m_doTruth = false ); - declareProperty("DebugHough",m_debugHough = false ); - declareProperty("UseSeeds",m_useSeeds = true ); - declareProperty("DoParabolicExtrapolation",m_doParabolicExtrapolation = true ); - declareProperty("ExtrapolationDistance",m_extrapolationDistance = 1500. ); - declareProperty("MuonTruthParticlesKey", m_MuonTruthParticlesKey); - declareProperty("MuonTruthSegmentsKey", m_MuonTruthSegmentsKey); - declareProperty("AddSectors", m_addSectors = false); - } - - MuonLayerHoughTool::~MuonLayerHoughTool() - { } StatusCode MuonLayerHoughTool::initialize() { @@ -74,6 +45,9 @@ namespace Muon { if (Gaudi::Concurrency::ConcurrencyFlags::concurrent()) { // Disabled under concurrency due to thread-safety concerns, but we want to keep it as a debug tool ATH_MSG_DEBUG("HitNtuple disabled because of concurrency"); + m_file = 0; + m_tree = 0; + m_ntuple = 0; } else { TDirectory* cdir = gDirectory; m_file = new TFile("HitNtuple.root","RECREATE"); @@ -148,26 +122,12 @@ namespace Muon { m_selectorsLoose[MuonStationIndex::EES] = MuonHough::MuonLayerHoughSelector({std::make_pair(0,2.9)}); // old values: 2.9; optimized: 2.9 m_selectorsLoose[MuonStationIndex::EEL] = MuonHough::MuonLayerHoughSelector({std::make_pair(0,2.9)}); // old values: 2.9; optimized: 2.9 - // /// test layerhash - // for( int reg = 0;reg<MuonStationIndex::DetectorRegionIndexMax;++reg ){ - // MuonStationIndex::DetectorRegionIndex region = static_cast<MuonStationIndex::DetectorRegionIndex>(reg); - // for( int lay=0;lay<Muon::MuonStationIndex::LayerIndexMax;++lay ){ - // MuonStationIndex::LayerIndex layer = static_cast<MuonStationIndex::LayerIndex>(lay); - // unsigned int layerHash = MuonStationIndex::sectorLayerHash(region,layer); - // auto regionLayer = MuonStationIndex::decomposeSectorLayerHash( layerHash ); - // if( region != regionLayer.first || layer != regionLayer.second ){ - // ATH_MSG_WARNING("Bad hash conversion " << MuonStationIndex::regionName(region) << " - " << MuonStationIndex::regionName(regionLayer.first) - // << " layer " << MuonStationIndex::layerName(layer) << " - " << MuonStationIndex::layerName(regionLayer.second)); - // } - // } - // } - return StatusCode::SUCCESS; } StatusCode MuonLayerHoughTool::finalize() { // ??? finalizeNTuple -> may be moved somewhere - if( m_doNtuple ){ + if( m_doNtuple && m_ntuple){ TDirectory* cdir = gDirectory; m_file->cd(); m_tree->Write(); @@ -548,16 +508,14 @@ namespace Muon { // add maxima to seed exclusion list associatedMaxima.insert(road.maxima.begin(),road.maxima.end()); - if( msgLvl(MSG::DEBUG) ){ - ATH_MSG_DEBUG(" New road " << road.maxima.size() ); - for( auto max : road.maxima ){ - MuonStationIndex::ChIndex chIndex = max->hough->m_descriptor.chIndex; - MuonStationIndex::LayerIndex layer = Muon::MuonStationIndex::toLayerIndex(chIndex); - MuonStationIndex::DetectorRegionIndex region = max->hough->m_descriptor.region; - ATH_MSG_DEBUG(" Sector " << max->hough->m_descriptor.sector << " " << Muon::MuonStationIndex::regionName(region) - << " " << Muon::MuonStationIndex::layerName(layer) - << " maximum " << max->max << " position " << max->pos << " angle " << max->theta << " ptr " << max); - } + ATH_MSG_DEBUG(" New road " << road.maxima.size() ); + for( auto max : road.maxima ){ + MuonStationIndex::ChIndex chIndex = max->hough->m_descriptor.chIndex; + MuonStationIndex::LayerIndex layer = Muon::MuonStationIndex::toLayerIndex(chIndex); + MuonStationIndex::DetectorRegionIndex region = max->hough->m_descriptor.region; + ATH_MSG_DEBUG(" Sector " << max->hough->m_descriptor.sector << " " << Muon::MuonStationIndex::regionName(region) + << " " << Muon::MuonStationIndex::layerName(layer) + << " maximum " << max->max << " position " << max->pos << " angle " << max->theta << " ptr " << max); } bool insert = true; @@ -699,7 +657,7 @@ namespace Muon { // untrue -> look in neighboring layer // true -> look only in this layer - double distanceCut = layer == seedLayer ? 500. : m_extrapolationDistance; + double distanceCut = layer == seedLayer ? 500. : (double)m_extrapolationDistance; unsigned int layerHash = MuonStationIndex::sectorLayerHash(region,layer); @@ -1100,42 +1058,7 @@ namespace Muon { } else if( phiHit.prd ){ Identifier colId = phiHit.prd->identify(); - Identifier layId = m_muonIdHelperTool->gasGapId( colId ); // !!!! - //std::pair<std::map<Identifier,std::pair<double,double> >::iterator,bool> resins; - - // for sTGC PAD compute the boundaries in the radial coordinate - if ( m_muonIdHelperTool->issTgc( colId ) && m_muonIdHelperTool->stgcIdHelper().channelType( colId )==0 ) { - // const sTgcPrepData* prd = dynamic_cast<const sTgcPrepData*>(hit.prd); - // const MuonGM::MuonPadDesign* design = prd->detectorElement()->getPadDesign( colId ); - // if( !design ) { - // ATH_MSG_WARNING("No design found for " << m_muonIdHelperTool->toString( colId ) ); - // continue; - // } - // double chWidth = 0.5*design->channelWidth(prd->localPosition(),false); - - // // calculate lower edge - // Amg::Vector2D lp1(prd->localPosition().x(),prd->localPosition().y()-chWidth); - // Amg::Vector3D gp1; - // prd->detectorElement()->surface(colId).localToGlobal(lp1,gp1,gp1); - // rmin = gp1.perp(); - - // // calculate upper edge - // lp1[1] = prd->localPosition().y()+chWidth; - // prd->detectorElement()->surface(colId).localToGlobal(lp1,gp1,gp1); - // rmax = gp1.perp(); - - - // ATH_MSG_DEBUG("Eta dimension of PAD projected along the Phi chamber axis: r min=" << rmin - // << ", r max=" << rmax); - - // // for other technologies no boundaries are set because min and max are set to 0. - // std::pair<double,double> v = std::pair<double,double>(rmin,rmax); - // resins = triggerLayersP.insert(std::pair<Identifier,std::pair<double,double> >(layId,v)); - // if (!resins.second) { - // ATH_MSG_WARNING("Cannot insert the boundaries into the map!"); - // } - } - + Identifier layId = m_muonIdHelperTool->gasGapId( colId ); // !!!! triggerLayers.insert(layId); } } @@ -1224,18 +1147,6 @@ namespace Muon { if( triggerLayers.count(layId) ){ if( m_muonIdHelperTool->isRpc(layId) ) ++nrpcOverlaps; else if( m_muonIdHelperTool->issTgc(layId) ) ++nstgcOverlaps; - -// std::map<Identifier,std::pair<double,double> >::iterator it = triggerLayersP.find( layId ); -// if (it==triggerLayersP.end()) { -// ATH_MSG_DEBUG("Could not find the PAD ssociated to layer ID "); -// } else { -// std::pair<double,double> bounds = (*it).second; -// ATH_MSG_DEBUG("Eta maximum at radiual position " << maximum.pos << ", PAD rmin=" << bounds.first -// << ", PAD rmax=" << bounds.second ); -// if (bounds.first<=maximum.pos && bounds.second>=maximum.pos) ++nstgcOverlaps; -// else ++nstgcNoOverlaps; -// } -// } } else{ if( m_muonIdHelperTool->isRpc(layId) ) ++nrpcNoOverlaps; @@ -1347,11 +1258,6 @@ namespace Muon { RegionMaximumVec::iterator lit_end = maxima.end(); for( ;lit!=lit_end;++lit ){ - // if( isEndcap && lit!=maxima.begin()+1 ) { - // ATH_MSG_DEBUG("In Endcap skipping all but the inner layer "); - // break; - // } - // create vector for prds per chamber std::map< Identifier, std::set< const Trk::PrepRawData* > > prdsPerChamber; @@ -2051,7 +1957,7 @@ namespace Muon { if(design) { double stripWidth=design->inputWidth; double stripLength=design->channelLength(m_muonIdHelperTool->stgcIdHelper().channel(id)); - if(m_debugHough) std::cout << " eta strip width " << stripWidth << " stripLength " << stripLength << std::endl; + if(m_debugHough) ATH_MSG_DEBUG(" eta strip width " << stripWidth << " stripLength " << stripLength); stripCor = 0.5*stripWidth; } debug->r = stripCor; @@ -2077,9 +1983,9 @@ namespace Muon { // inputPhiPitch is in degrees float radius = prd.globalPosition().perp(); chWidth = 0.5*design->inputPhiPitch*M_PI/180.*radius; - if(m_debugHough) std::cout << " sPadWidth " << design->sPadWidth << " lPadWidth " << design->lPadWidth << " inputRowWidth " << design->inputRowWidth << std::endl; + if(m_debugHough) ATH_MSG_DEBUG(" sPadWidth " << design->sPadWidth << " lPadWidth " << design->lPadWidth << " inputRowWidth " << design->inputRowWidth); - if(m_debugHough) std::cout << " Pad chWidth " << chWidth << " OLD " << chWidthOLD << " phi global " << prd.globalPosition().phi() << std::endl; + if(m_debugHough) ATH_MSG_DEBUG(" Pad chWidth " << chWidth << " OLD " << chWidthOLD << " phi global " << prd.globalPosition().phi()); } else if( m_muonIdHelperTool->stgcIdHelper().channelType(id) == 2 ) { const MuonGM::MuonChannelDesign* design = prd.detectorElement()->getDesign(id); @@ -2094,7 +2000,7 @@ namespace Muon { double chWidthOLD = 0.5*design->channelWidth(prd.localPosition()); chWidth = 0.5*phiMaxWidth; - if(m_debugHough) std::cout << " Wire Gang chWidth " << chWidth << " OLD " << chWidthOLD << " phi global " << prd.globalPosition().phi() << std::endl; + if(m_debugHough) ATH_MSG_DEBUG(" Wire Gang chWidth " << chWidth << " OLD " << chWidthOLD << " phi global " << prd.globalPosition().phi()); } Amg::Vector2D lp1(prd.localPosition().x()+chWidth,prd.localPosition().y()); @@ -2195,8 +2101,6 @@ namespace Muon { double phimax = std::max( std::max(phi11,phi12), std::max(phi21,phi22) ); double phi1 = phimin; //phiCor(phimin,sector); double phi2 = phimax; //phiCor(phimax,sector); - //ATH_MSG_DEBUG("local phi: in " << phimin << ", " << phimax << " sector phi " << m_sectorMapping.sectorPhi(sector) << " phicor " << phi1 << ", " << phi2 ); - int sublayer = sublay(id,x); MuonHough::HitDebugInfo* debug = new MuonHough::HitDebugInfo(technology,sector,region,layer,sublayer); @@ -2211,8 +2115,6 @@ namespace Muon { phiDebug->clusterLayers = cl.phiCluster.layers(); phiDebug->isEtaPhi = cl.etaCluster.layers(); - //ATH_MSG_VERBOSE(" " << m_muonIdHelperTool->toString(id) << " x " << x << " ymin " << ymin << " ymax " << ymax << " sublay " << sublayer << " tgc " << &cl ); - MuonHough::Hit* hit = new MuonHough::Hit(sublayer,x,ymin,ymax,2*cl.etaCluster.layers(),debug,0,&cl); MuonHough::PhiHit* phiHit = new MuonHough::PhiHit(sublayer,y11,phi1,phi2,2*cl.phiCluster.layers(), phiDebug,0,&cl); hits.push_back(hit); @@ -2232,13 +2134,6 @@ namespace Muon { void MuonLayerHoughTool::insertHash( int sector, const IdentifierHash& hash, const Identifier& id ) { MuonStationIndex::TechnologyIndex techIndex = m_muonIdHelperTool->technologyIndex(id); int sectorLayerHash = MuonStationIndex::sectorLayerHash(m_muonIdHelperTool->regionIndex(id),m_muonIdHelperTool->layerIndex(id)); - // ATH_MSG_VERBOSE("Inserting " << m_muonIdHelperTool->toStringChamber(id) << " sector " << sector << " sectorLayerHash " - // << sectorLayerHash << " tech " << tech << " tech index " << MuonStationIndex::technologyName(techIndex) ); - // if( sector < 1 || sector > m_collectionsPerSector.size() ) ATH_MSG_WARNING("Bad sector index " << sector << " max " << m_collectionsPerSector.size() ); - // if( tech < 0 || tech >= m_collectionsPerSector[sector-1].technologyRegionHashVecs.size() ) - // ATH_MSG_WARNING("Bad technology index " << tech << " max " << m_collectionsPerSector[sector-1].technologyRegionHashVecs.size() ); - // if( sectorLayerHash < 0 || sectorLayerHash >= m_collectionsPerSector[sector-1].technologyRegionHashVecs[tech].size() ) - // ATH_MSG_WARNING("Bad layer hash " << sectorLayerHash << " max " << m_collectionsPerSector[sector-1].technologyRegionHashVecs[tech].size() ); m_collectionsPerSector[sector-1].technologyRegionHashVecs[techIndex][sectorLayerHash].push_back(hash); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHisto2D.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHisto2D.h index b90ec59e5525..c7c4a9369055 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHisto2D.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHisto2D.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 */ #ifndef MUONHOUGHPATTERNEVENT_MUONHOUGHHISTO2D_H @@ -175,9 +175,9 @@ class MuonHoughHisto2D bool m_maxima_found; /** maximum */ - mutable int m_maximumBin; - mutable unsigned int m_maximum; - mutable bool m_maximumIsValid; // flag whether the maximum can be trusted + int m_maximumBin; + unsigned int m_maximum; + bool m_maximumIsValid; // flag whether the maximum can be trusted /** set bin content of binnumber */ void setBinContent(int binnumber,double value); /** set bin content of binnumber corresponding to coordinates */ @@ -194,12 +194,6 @@ inline int MuonHoughHisto2D::fill(double x,double y, double w){ return binnumber; } -/* inline int MuonHoughHisto2D::fill(int binx, double y, double w){ */ -/* int biny = coordToBiny(y); */ -/* fill(binx,biny,w); */ -/* return binx+biny*m_nbinsx_plus2; */ -/* } */ - inline void MuonHoughHisto2D::fill(int binnumber, double weight){ unsigned int& binval = m_histBuffer[binnumber]; binval +=m_scale*weight; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHisto2DContainer.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHisto2DContainer.h index 5cece185666e..48eb2d299b9a 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHisto2DContainer.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHisto2DContainer.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 */ #ifndef MUONHOUGHPATTERNEVENT_MUONHOUGHHISTO2DCONTAINER_H @@ -14,7 +14,7 @@ class MuonHoughHisto2DContainer /** constructor */ MuonHoughHisto2DContainer(); /** destructor */ - ~MuonHoughHisto2DContainer(); + virtual ~MuonHoughHisto2DContainer() = default; /** return histogram at place id */ MuonHoughHisto2D* getHisto(int id)const; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHit.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHit.h index 90a32da02d4a..835225ace9cd 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHit.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughHit.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONHOUGHPATTERNEVENT_MUONHOUGHHIT_H @@ -32,7 +32,7 @@ class MuonHoughHit /** constructor */ MuonHoughHit(double x,double y,double z,bool measures_phi,MuonHough::DetectorTechnology detector_id, double prob = 1, double weight = 1., const Trk::PrepRawData* prd = 0, int id = -1); /** destructor */ - virtual ~MuonHoughHit(); + virtual ~MuonHoughHit() = default; /** return DetectorTechnology */ MuonHough::DetectorTechnology getDetectorId() const; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughMathUtils.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughMathUtils.h index 101bd1a0262f..e35d94f0f1bd 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughMathUtils.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughMathUtils.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONHOUGHPATTERNEVENT_MUONHOUGHMATHUTILS_H @@ -41,7 +41,7 @@ class MuonHoughMathUtils /** default constructor */ MuonHoughMathUtils(); /** destructor */ - ~MuonHoughMathUtils(); + virtual ~MuonHoughMathUtils() = default; /** sign (-1 or 1) of a double */ int sgn(double d)const; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughPattern.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughPattern.h index 119e5770f056..12e4ec93dcca 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughPattern.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughPattern.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 */ #ifndef MUONHOUGHPATTERNEVENT_MUONHOUGHPATTERN_H @@ -23,7 +23,7 @@ class MuonHoughPattern : public MuonHoughHitContainer MuonHoughPattern(int id_number, bool ownhits = false); /** destructor */ - virtual ~MuonHoughPattern(); + virtual ~MuonHoughPattern() = default; /** clear pattern */ void resetTracksegment(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_rz.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_rz.h index 4607b2b2f28d..02f2ae576955 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_rz.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_rz.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 */ #ifndef MUONHOUGHPATTERNEVENT_MUONHOUGHTRANSFORMER_RZ_H @@ -13,7 +13,7 @@ class MuonHoughTransformer_rz: public MuonHoughTransformer public: MuonHoughTransformer_rz(int nbins, int nbins_angle, double detectorsize, double detectorsize_angle, double threshold_histo,int number_of_sectors=1); - ~MuonHoughTransformer_rz(); + virtual ~MuonHoughTransformer_rz() = default; virtual void fillHit(MuonHoughHit* hit, double weight=1.); virtual int fillHisto(double rz0, double theta, double weight=1., int sector=0); @@ -26,17 +26,10 @@ class MuonHoughTransformer_rz: public MuonHoughTransformer virtual int sector(MuonHoughHit* hit)const; // 0..15 same as atlas sector 1..16 // returns 0 if number_of_sectors == 0 protected: - //virtual void fill(const MuonHoughHitContainer* event); virtual MuonHoughPattern* hookAssociateHitsToMaximum(const MuonHoughHitContainer* event,std::pair <double,double> coordsmaximum, double residu_mm,double residu_grad, int sector=0, bool which_segment=0, int printlevel=999)const; const bool m_use_residu_grad; //0 is advisable //only used for rz - //const bool m_add_weight_rz; // apply weight function to give more importance to patterns close to origin // each transform its own weight - //const double m_weight_constant_rz; // in mm // 1/(r/w_c+1) // was 15000 // each transform its own weight - - //const bool m_add_weight_theta; // when on from 0.5 to 0.47 - - //const int m_threshold_for_next_houghpattern_rz; }; inline int MuonHoughTransformer_rz::sector(MuonHoughHit* hit)const{return hit->phiSector();} diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_xy.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_xy.h index f5ade35bae6a..85030c23179f 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_xy.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_xy.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 */ #ifndef MUONHOUGHPATTERNEVENT_MUONHOUGHTRANSFORMER_XY_H @@ -13,7 +13,7 @@ class MuonHoughTransformer_xy : public MuonHoughTransformer_xyz /** constructor */ MuonHoughTransformer_xy(int nbins, int nbins_angle, double detectorsize, double detectorsize_angle, double threshold_histo,int number_of_sectors=1); /** destructor */ - virtual ~MuonHoughTransformer_xy(); + virtual ~MuonHoughTransformer_xy() = default; /** returns the hit position in xy frame */ virtual std::pair <double,double> getHitPos(const MuonHoughHitContainer* event, int hitid)const; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_xyz.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_xyz.h index 9078b37b4027..f534ba9d28b9 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_xyz.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_xyz.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 */ #ifndef MUONHOUGHPATTERNEVENT_MUONHOUGHTRANSFORMER_XYZ_H @@ -19,7 +19,7 @@ class MuonHoughTransformer_xyz : public MuonHoughTransformer public: /** destructor */ - virtual ~MuonHoughTransformer_xyz(); + virtual ~MuonHoughTransformer_xyz() = default; /** fill hit in histogram */ virtual void fillHit(MuonHoughHit* hit, double weight=1.); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_yz.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_yz.h index b0a88340922d..3a997682d3f7 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_yz.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/MuonHoughPatternEvent/MuonHoughTransformer_yz.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 */ #ifndef MUONHOUGHPATTERNEVENT_MUONHOUGHTRANSFORMER_YZ_H @@ -13,7 +13,7 @@ class MuonHoughTransformer_yz : public MuonHoughTransformer_xyz /** constructor */ MuonHoughTransformer_yz(int nbins, int nbins_angle, double detectorsize, double detectorsize_angle, double threshold_histo, int number_of_sectors=1); /** destructor */ - virtual ~MuonHoughTransformer_yz(); + virtual ~MuonHoughTransformer_yz() = default; /** returns the hit position in yz frame */ virtual std::pair <double,double> getHitPos(const MuonHoughHitContainer* event, int hitid)const; //returns the relevant position of the hit (xy-RPC in case of id==id_xy_rpc etc.) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHisto2D.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHisto2D.cxx index acb299aa772a..0e8987c765ab 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHisto2D.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHisto2D.cxx @@ -1,17 +1,16 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternEvent/MuonHoughHisto2D.h" #include "TH2F.h" -#include <iostream> #include "TFile.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" MuonHoughHisto2D::~MuonHoughHisto2D() { delete[] m_histBuffer; - - // std::cout << "Destructor of MuonHoughHisto2D" << std::endl; } MuonHoughHisto2D::MuonHoughHisto2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax,int number_of_maxima):m_nbinsx(nbinsx), m_xmin(xmin), m_xmax(xmax), m_nbinsy(nbinsy), m_ymin(ymin), m_ymax(ymax), m_number_of_maxima(number_of_maxima), m_scale(10000),m_threshold(2.1*m_scale), m_distance_to_next_maximum(100) @@ -43,8 +42,6 @@ void MuonHoughHisto2D::reset() { resetHisto(); -// std::cout << "m_bins_above_threshold size: " << m_bins_above_threshold.size() << " size: " << m_size << std::endl; -// std::cout << "occupancy: " << (m_bins_above_threshold.size()+0.)/(m_size+0.) << std::endl; m_bins_above_threshold.clear(); m_maximumbins.clear(); // obsolete? m_maxima_found=0; @@ -55,6 +52,7 @@ void MuonHoughHisto2D::reset() void MuonHoughHisto2D::findMaxima(int printlevel, bool which_segment) { + MsgStream log(Athena::getMessageSvc(),"MuonHoughHisto2D::findMaxima"); m_maximumbins.clear(); // clear old m_maxima_vector and start searching again int maximum_number=0; @@ -64,7 +62,7 @@ void MuonHoughHisto2D::findMaxima(int printlevel, bool which_segment) double maximum=-1.; int maxbin=-1; - if (printlevel>=3){std::cout << "MuonHoughHisto2D::size bins above threshold: " << m_bins_above_threshold.size() <<std::endl;} + if (printlevel>=3 || log.level()<=MSG::DEBUG){log << MSG::DEBUG << "MuonHoughHisto2D::size bins above threshold: " << m_bins_above_threshold.size() <<endmsg;} std::set<int>::iterator it = m_bins_above_threshold.begin(); std::set<int>::iterator it_end = m_bins_above_threshold.end(); @@ -77,35 +75,34 @@ void MuonHoughHisto2D::findMaxima(int printlevel, bool which_segment) if (maximum < m_threshold) { - if (printlevel>=2) + if (printlevel>=2 || log.level()<=MSG::INFO) { - std::cout << "MuonHoughHisto2D:: no maximum found" << std::endl; + log << MSG::INFO << "MuonHoughHisto2D:: no maximum found" << endmsg; } break; } else { - if (printlevel>=2) + if (printlevel>=2 || log.level()<=MSG::INFO) { std::pair <double,double> coords; coords = binnumberToCoords(maxbin); - std::cout << "MuonHoughHisto2D:: Maximum found: " << maximum << " binnumber: "<< maxbin << " R (z) " << coords.first << " angle " << coords.second << std::endl; + log << MSG::INFO << "MuonHoughHisto2D:: Maximum found: " << maximum << " binnumber: "<< maxbin << " R (z) " << coords.first << " angle " << coords.second << endmsg; } m_maximumbins.push_back(maxbin); } // maxbin <> m_threshold - if (printlevel>=10) + if (printlevel>=10 || log.level()<=MSG::VERBOSE) { if (maximum==-1.) { - std::cout << "MuonHoughHisto2D::No Bins Above Threshold" << std::endl; + log << MSG::VERBOSE << "MuonHoughHisto2D::No Bins Above Threshold" << endmsg; } else { std::pair <double,double> coords; coords = binnumberToCoords(maxbin); - - std::cout << "MuonHoughHisto2D::Maximum Number: " << maximum_number << " Maximum: " << maximum << " binnumber: " << maxbin << " x: " << coords.first << " y: " << coords.second <<std::endl; + log << MSG::VERBOSE << "MuonHoughHisto2D::Maximum Number: " << maximum_number << " Maximum: " << maximum << " binnumber: " << maxbin << " x: " << coords.first << " y: " << coords.second <<endmsg; } } // printlevel @@ -142,6 +139,7 @@ std::pair <int,double> MuonHoughHisto2D::getMax()const std::pair <int,double> MuonHoughHisto2D::getMaximumBin(unsigned int maximum_number,bool which_segment, int printlevel) { + MsgStream log(Athena::getMessageSvc(),"MuonHoughHisto2D::getMaximumBin"); if (m_maxima_found==0) { findMaxima(printlevel,which_segment); // fills m_maximumbins @@ -150,9 +148,9 @@ std::pair <int,double> MuonHoughHisto2D::getMaximumBin(unsigned int maximum_numb int maxbin = -1; double maximum= -1.; - if (printlevel>=3) + if (printlevel>=3 || log.level()<=MSG::DEBUG) { - std::cout << "MuonHoughHisto2D:: m_maximumbins.size: " << m_maximumbins.size() << std::endl; + log << MSG::VERBOSE << "MuonHoughHisto2D:: m_maximumbins.size: " << m_maximumbins.size() << endmsg; } if (m_maximumbins.size() > maximum_number) @@ -169,6 +167,7 @@ std::pair <int,double> MuonHoughHisto2D::getMaximumBin(unsigned int maximum_numb std::pair <double, double> MuonHoughHisto2D::getCoordsMaximum(unsigned int maximum_number, bool which_segment, int printlevel) { + MsgStream log(Athena::getMessageSvc(),"MuonHoughHisto2D::getCoordsMaximum"); std::pair <double,double> coordsmaximum; int binnumber = getMaxBin(maximum_number,which_segment,printlevel); @@ -178,7 +177,7 @@ std::pair <double, double> MuonHoughHisto2D::getCoordsMaximum(unsigned int maxim } else { - std::cout << "HoughTransform::No Maximum Found" << std::endl; + if (log.level()<=MSG::WARNING)log << MSG::WARNING << "HoughTransform::No Maximum Found" << endmsg; coordsmaximum.first = 99999.; coordsmaximum.second = 99999.; } @@ -242,10 +241,11 @@ int MuonHoughHisto2D::distanceBins(int binnumber1,int binnumber2)const std::pair <double,double> MuonHoughHisto2D::binnumberToCoords(int binnumber, int printlevel)const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughHisto2D::binnumberToCoords"); std::pair <double,double> coordsbin; if (binnumber < 0) { - std::cout << "MuonHoughHisto2D::ERROR: negativebinnumber: " << binnumber << std::endl; + if (log.level()<=MSG::WARNING)log << MSG::WARNING << "MuonHoughHisto2D::ERROR: negativebinnumber: " << binnumber << endmsg; coordsbin.first=99999.; coordsbin.second=99999.; return coordsbin; @@ -254,7 +254,7 @@ std::pair <double,double> MuonHoughHisto2D::binnumberToCoords(int binnumber, int double xcoord = binnumberToXCoord(binnumber); double ycoord = binnumberToYCoord(binnumber); - if (printlevel>=4){std::cout << "MuonHoughHisto2D::Maximum: " << getBinContent(binnumber) << " binnumber: " << binnumber << " x: " << xcoord << " y: " << ycoord <<std::endl;} + if (printlevel>=4 || log.level()<=MSG::VERBOSE){log << MSG::VERBOSE << "MuonHoughHisto2D::Maximum: " << getBinContent(binnumber) << " binnumber: " << binnumber << " x: " << xcoord << " y: " << ycoord <<endmsg;} coordsbin.first = xcoord; coordsbin.second = ycoord; @@ -275,17 +275,9 @@ int MuonHoughHisto2D::binInHistogram(unsigned int binnumber)const TH2F* MuonHoughHisto2D::bookAndFillRootHistogram(std::string hname)const { - -// std::pair <int,double> theMax = getMax(); -// int mix = theMax.first%m_nbinsx_plus2; -// int miy = theMax.first/m_nbinsx_plus2; - -// if( theMax.first != -1 ) std::cout << " getting maximum for " << hname << " maxbin " << theMax.first -// << " x " << mix << " y " << miy << " val " << theMax.second/(double)m_scale << std::endl; TH2F* histogram = new TH2F(hname.c_str(),hname.c_str(),m_nbinsx,m_xmin,m_xmax,m_nbinsy,m_ymin,m_ymax); for (unsigned int i=0; i<m_size; i++) - { - + { int ix = i%m_nbinsx_plus2; int iy = i/m_nbinsx_plus2; histogram->SetBinContent(ix,iy,m_histBuffer[i]/(double)m_scale); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHisto2DContainer.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHisto2DContainer.cxx index 03cc633c6d43..12a0d117e9e2 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHisto2DContainer.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHisto2DContainer.cxx @@ -1,44 +1,36 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternEvent/MuonHoughHisto2DContainer.h" -#include <iostream> +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" MuonHoughHisto2DContainer::MuonHoughHisto2DContainer() { } -MuonHoughHisto2DContainer::~MuonHoughHisto2DContainer() -{ -} - std::pair <int,int> MuonHoughHisto2DContainer::getMaximumBinnumber(unsigned int maximum_number,bool which_segment,int printlevel)const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughHisto2DContainer::getMaximumBinnumber"); // does only work for maximum_number==0! if (maximum_number!=0) { - std::cout << "WARNING: possibly maximum taken which is not " << maximum_number+1 << "rd maximum" << std::endl; + if(log.level()<=MSG::WARNING)log << MSG::WARNING << "WARNING: possibly maximum taken which is not " << maximum_number+1 << "rd maximum" << endmsg; } double maximum = 0.; int maxid = -1; int maxbin = -1; - // std::vector < std::pair <int,double> > maxima_vector; - for (int histoid=0; histoid<size(); histoid++) { std::pair <int, double> histomax = getHisto(histoid)->getMaximumBin(0,which_segment,printlevel); // binnumber and value of the area of the bin - //maxima_vector.push_back(histomax); - if (histomax.second > maximum) { maximum = histomax.second; maxid = histoid; maxbin = histomax.first;} } - // maxima_vector.nth_element(); - std::pair <int,int> coordsmaximum (maxid, maxbin); return coordsmaximum; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHit.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHit.cxx index 4dd97de2159f..105d57808427 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHit.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughHit.cxx @@ -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 */ #include "MuonHoughPatternEvent/MuonHoughHit.h" @@ -8,6 +8,8 @@ #include "TrkDetElementBase/TrkDetElementBase.h" #include "TrkSurfaces/Surface.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" MuonHoughHit::MuonHoughHit(const Trk::PrepRawData* prd):m_orig_weight(1.) { @@ -68,13 +70,9 @@ MuonHoughHit::MuonHoughHit(double x, double y, double z, bool measures_phi, Muon m_magnetic_trackratio = calcMagneticTrackRatio(); } -MuonHoughHit::~MuonHoughHit() -{ - // std::cout << "Destructor MuonHoughHit" << std::endl; -} - std::string MuonHoughHit::getWhichDetector()const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughHit::getWhichDetector"); std::string detector_name; switch (m_detector_id) { @@ -90,7 +88,7 @@ std::string MuonHoughHit::getWhichDetector()const case MuonHough::TGC: detector_name="TGC"; break; - default: std::cout << "MuonHoughHit:: no valid detector_id" << std::endl; + default: if(log.level()<=MSG::WARNING) log << MSG::WARNING << "MuonHoughHit:: no valid detector_id" << endmsg; } return detector_name; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughMathUtils.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughMathUtils.cxx index 6b7c4b540795..a2676790efe4 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughMathUtils.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughMathUtils.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternEvent/MuonHoughMathUtils.h" @@ -8,15 +8,13 @@ #include <sstream> #include <iostream> #include <cassert> +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" MuonHoughMathUtils::MuonHoughMathUtils() { } -MuonHoughMathUtils::~MuonHoughMathUtils() -{ -} - int MuonHoughMathUtils::sgn(double d)const { if (d<0) {return -1;} @@ -27,7 +25,8 @@ int MuonHoughMathUtils::sgn(double d)const int MuonHoughMathUtils::step(double d, double x0)const { - if (d==x0) {std::cout << "WARNING: Possible mistake in Step function" << std::endl;} + MsgStream log(Athena::getMessageSvc(),"MuonHoughMathUtils::step"); + if (d==x0) {if (log.level()<=MSG::WARNING) log << MSG::WARNING << "WARNING: Possible mistake in Step function" << endmsg;} if (d<=x0) {return 0;} if (d>x0) {return 1;} return -1; @@ -36,7 +35,7 @@ int MuonHoughMathUtils::step(double d, double x0)const double MuonHoughMathUtils::signedDistanceToLine(double x0, double y0, double r0, double phi)const //distance from (x0,y0) to the line (r0,phi) , phi in [-Pi,Pi] ,different phi than in calculateangle() (==angle(2)) { CxxUtils::sincos scphi(phi); - double distance = scphi.apply(x0,-y0) - r0; //x0*scphi.sn-y0*scphi.cs-r0; + double distance = scphi.apply(x0,-y0) - r0; return distance; } @@ -150,15 +149,13 @@ double MuonHoughMathUtils::distanceToLine3D(double x0,double y0,double z0, doubl double MuonHoughMathUtils::distanceOfLineToOrigin2D(double a, double b)const { - // return signedDistanceOfLineToOrigin2D(0,b,std::atan(a)); - return std::abs(b/(std::sqrt(a*a+1))); } double MuonHoughMathUtils::signedDistanceOfLineToOrigin2D(double x, double y, double phi)const { CxxUtils::sincos scphi(phi); - return scphi.apply(x,-y); //(-y*scphi.cs+x*scphi.sn); + return scphi.apply(x,-y); } std::vector<double> MuonHoughMathUtils::shortestPointOfLineToOrigin3D(double x, double y, double z, double phi, double theta)const // actually this is the 3d-point closest to origin in xy-plane @@ -210,8 +207,6 @@ std::vector<double> MuonHoughMathUtils::shortestPointOfLineToOrigin(double x, do x3[1]= scphi.sn*sctheta.sn; x3[2]= sctheta.cs; - // sqrt(x3^2) == 1; ! - double time=0; double x5=0; x5 = dotProduct(x1,x3); @@ -230,10 +225,6 @@ std::vector<double> MuonHoughMathUtils::shortestPointOfLineToOrigin(double x, do bool MuonHoughMathUtils::lineThroughCylinder(double x_0, double y_0, double z_0, double phi, double theta, double r_cyl, double z_cyl)const { // if there is one, then track will be split - // C:x^2+y^2=r_cyl^2 , |z|<z_cyl - // l:(x_0,y_0,z_0)+t*(cos(phi)*sin(theta),sin(phi)*sin(theta),cos(theta)) - - // assert(z_cyl>=0); assert(r_cyl>=0); CxxUtils::sincos scphi(phi); @@ -255,30 +246,16 @@ bool MuonHoughMathUtils::lineThroughCylinder(double x_0, double y_0, double z_0, if (r_2<r_cyl) {return true;} // 2 -- check if there is an intersection with the circle x^2 + y^2 = r_cyl^2 and the line y=px+q, p = tan(phi), q = y_0 - x_0 tan(phi) <--> r_cyl^2 = (px+q)^2 + x^2 - // D = b^2-4ac a= (p^2+1) = (1/cos^2), b = 2pq, c = q^2-r_cyl^2 - // D = 4 (r_cyl^2 * a - q^2) - // D = 4 /cos^2 (r_cyl^2 - (y_0*cos - x_0*sin)^2) - - double r_0 = scphi.apply(-x_0,y_0); // y_0*scphi.cs - x_0*scphi.sn; - - // D = 4* (scphi.cs*scphi.cs)* ( r_cyl*r_cyl - r_0*r_0) - - // D>0 <--> |r_0| < r_cyl + double r_0 = scphi.apply(-x_0,y_0); if (std::abs(r_0) > r_cyl) return false; // 3 -- check if the intersection is cylinder: for -z_cyl<z<z_cyl - - // x_1,2 = (-b+-sqrt(D) / 2a) = .. = - sin * r_0 +- cos * sqrt(r_cyl^2-r_0^2) - double s_1 = - scphi.sn * r_0; double s_2 = scphi.cs * std::sqrt(r_cyl*r_cyl-r_0*r_0); x_1 = s_1 + s_2; - // t = (x-x_0)/cos(phi)* sin(theta) - // z = z_0 + t * cos(theta) = z_0 + (x-x_0) * cos(theta) / (cos(phi) * sin(theta) ) - double inv_angle = 1/(scphi.cs * tantheta); double z_1 = z_0 + (x_1-x_0) * inv_angle; @@ -387,7 +364,7 @@ void MuonHoughMathUtils::extrapolateCurvedRoad(const Amg::Vector3D& roadpos, con double tantheta = sctheta.sn/sctheta.cs; - double r0 = scphi.apply(roadpos.x(),-roadpos.y()); // - roadpos.y()*scphi.cs + roadpos.x()*scphi.sn ; + double r0 = scphi.apply(roadpos.x(),-roadpos.y()); double charge = 1.; if ( r0 < 0) charge = -1.; double invcurvature = charge/roadmom.mag(); @@ -412,14 +389,10 @@ void MuonHoughMathUtils::extrapolateCurvedRoad(const Amg::Vector3D& roadpos, con double len = posr - fabs(r0); double diffr = posr-MuonHough::radius_cylinder; rotationangle = diffr*invcurvature/sctheta.sn; - // std::cout << " road x " << roadpos.x()<< " y " << roadpos.y() << " z " << roadpos.z() << std::endl; - // std::cout << " Position xe " << xe << " y " << ye << " z " << ze << std::endl; xe = roadpos.x() + lenr * scphi.cs; ye = roadpos.y() + lenr * scphi.sn; ze = roadpos.z() + len/tantheta + diffr*rotationangle; thetan = std::atan2(1.,1/tantheta + 2*rotationangle); - // std::cout << " Extrapolated Position xe " << xe << " y " << ye << " z " << ze << std::endl; - // m_log << MSG::VERBOSE << " Barrel extrapolation " <<endmsg; } } else { double lext=0., rotationangle=0.; @@ -428,44 +401,24 @@ void MuonHoughMathUtils::extrapolateCurvedRoad(const Amg::Vector3D& roadpos, con double diffz = pos.z()-sign*MuonHough::z_cylinder; rotationangle = diffz*invcurvature/sctheta.cs; lext = (pos.z()-roadpos.z())*tantheta - diffz*rotationangle; - // m_log << MSG::VERBOSE << " Forward extrapolation " <<endmsg; - } else { // Forward OutSide EC Toroid double effcurv = invcurvature/sctheta.cs; rotationangle = sign*(MuonHough::z_end-MuonHough::z_cylinder)*effcurv; lext = (pos.z()-roadpos.z())*tantheta + (MuonHough::z_magnetic_range_squared - 2*sign*pos.z()*MuonHough::z_magnetic_range)*effcurv; - // m_log << MSG::VERBOSE << " Forward Outside EC Toroid extrapolation " <<endmsg; } xe = roadpos.x() + lext * scphi.cs; ye = roadpos.y() + lext * scphi.sn; - //ze = pos.z(); double dx = tantheta - 2*rotationangle; if (dx !=0) thetan = std::atan2(1.,1/dx); } -// In case direction theta is rotated for low momenta: flip direction vector + // In case direction theta is rotated for low momenta: flip direction vector CxxUtils::sincos scthetan(thetan); - - // std::cout << " thetan: " << thetan << " rotationangle: " << rotationangle << std::endl; - - if (sctheta.cs*scthetan.cs+sctheta.sn*scthetan.sn < 0) { - // std::cout<< " flip direction" << std::endl; - roaddire = Amg::Vector3D(scthetan.sn*scphi.cs,scthetan.sn*scphi.sn,-scthetan.cs); - } else { - // std::cout<< " no flip" << std::endl; - roaddire = Amg::Vector3D(scthetan.sn*scphi.cs,scthetan.sn*scphi.sn,scthetan.cs); - } - roadpose = Amg::Vector3D(xe,ye,ze); - -// std::cout << " direction theta " << theta << " new " << thetan << std::endl; -// if (std::abs(theta-thetan) > 0.1 ) std::cout << " Large theta difference " << std::endl; -// std::cout << " position x " << pos.x() << " y " << pos.y() << " r " << posr << " z " << pos.z() << std::endl; -// double dr = std::sqrt(roadpose.x()*roadpose.x() + roadpose.y()*roadpose.y()) - posr; -// double dz = roadpose.z() - pos.z(); -// double dist = std::sqrt(dr*dr+dz*dz); -// std::cout << " Extrapol position x " << roadpose.x() << " y " << roadpose.y() << " r " << std::sqrt(roadpose.x()*roadpose.x() + roadpose.y()*roadpose.y()) <<" z " << roadpose.z() << " Distance " << dist << std::endl; -// if ( dist > 100.) std::cout << " Large Distance " << dist << " dR " << dr << " dZ " << dz << std::endl; -// std::cout << " charge " << charge << " curvature " << roadmom.mag() << " inv curvature " << invcurvature << std::endl; - + if (sctheta.cs*scthetan.cs+sctheta.sn*scthetan.sn < 0) { + roaddire = Amg::Vector3D(scthetan.sn*scphi.cs,scthetan.sn*scphi.sn,-scthetan.cs); + } else { + roaddire = Amg::Vector3D(scthetan.sn*scphi.cs,scthetan.sn*scphi.sn,scthetan.cs); + } + roadpose = Amg::Vector3D(xe,ye,ze); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughPattern.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughPattern.cxx index 8d1ec1710310..d1cb224a1d05 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughPattern.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughPattern.cxx @@ -1,18 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternEvent/MuonHoughPattern.h" #include "CxxUtils/sincos.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" MuonHoughPattern::MuonHoughPattern(int id_number,bool ownhits):MuonHoughHitContainer(ownhits),m_id_number(id_number),m_whichsegment(false),m_ephi(-M_PI/2.),m_erphi(0.),m_etheta(M_PI/2.), m_ertheta(0.),m_ecurvature(1.),m_maximumhistogram(0.) { } -MuonHoughPattern::~MuonHoughPattern() -{ -} - void MuonHoughPattern::resetTracksegment() { for (unsigned int i=0; i<m_hit.size(); i++) @@ -39,6 +37,7 @@ bool MuonHoughPattern::hitInHoughPattern(MuonHoughHit * hit)const // adviced not double MuonHoughPattern::patternLength()const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughPattern::patternLength"); // takes the first 2 hits and calculates distance and then takes next hit, and calculates from previous 2 hits which 2 are farthest away, etc.. // also possible to calculate point closest to IP and determine if left/ right to pattern, app. just as fast. @@ -84,7 +83,7 @@ double MuonHoughPattern::patternLength()const } } } - else {std::cout << "MuonHoughPattern::pattern_size <2" << std::endl;} + else {if(log.level()<=MSG::VERBOSE)log << MSG::VERBOSE << "MuonHoughPattern::pattern_size <2" << endmsg;} return max_patternlength; } @@ -118,20 +117,22 @@ double MuonHoughPattern::calculateEZ()const void MuonHoughPattern::printHoughPattern()const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughPattern::printHoughPattern"); if (m_hit.size()==0) { - std::cout <<"MuonHoughPattern::No pattern_Segment" << std::endl; + if(log.level()<=MSG::VERBOSE)log << MSG::VERBOSE <<"MuonHoughPattern::No pattern_Segment" << endmsg; } - std::cout << "MuonHoughPattern::Size of MuonHoughPattern: " << m_hit.size() << std::endl; + if(log.level()<=MSG::VERBOSE)log << MSG::VERBOSE << "MuonHoughPattern::Size of MuonHoughPattern: " << m_hit.size() << endmsg; for (unsigned int i=0; i<m_hit.size(); i++) { - std::cout << m_hit[i]->getHitx() << " " << m_hit[i]->getHity() << " " << m_hit[i]->getHitz() << " " << m_hit[i]->getId() << std::endl; + if(log.level()<=MSG::VERBOSE)log << MSG::VERBOSE << m_hit[i]->getHitx() << " " << m_hit[i]->getHity() << " " << m_hit[i]->getHitz() << " " << m_hit[i]->getId() << endmsg; } } double MuonHoughPattern::getEAngle()const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughPattern::getEAngle"); double eangle=0; switch (m_id_number) { @@ -142,13 +143,14 @@ double MuonHoughPattern::getEAngle()const eangle=m_etheta; break; default: - std::cout << "MuonHoughPattern::no valid id_number" << std::endl; + if(log.level()<=MSG::VERBOSE)log << MSG::VERBOSE << "MuonHoughPattern::no valid id_number" << endmsg; } return eangle; } double MuonHoughPattern::getER()const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughPattern::getER"); double er=0; switch (m_id_number) { @@ -159,13 +161,14 @@ double MuonHoughPattern::getER()const er=m_ertheta; break; default: - std::cout << "MuonHoughPattern::no valid id_number" << std::endl; + if(log.level()<=MSG::VERBOSE)log << MSG::VERBOSE << "MuonHoughPattern::no valid id_number" << endmsg; } return er; } void MuonHoughPattern::setEAngle(double eangle) { + MsgStream log(Athena::getMessageSvc(),"MuonHoughPattern::setEAngle"); switch (m_id_number) { case MuonHough::hough_xy: @@ -175,12 +178,13 @@ void MuonHoughPattern::setEAngle(double eangle) m_etheta=eangle; break; default: - std::cout << "MuonHoughPattern::no valid id_number" << std::endl; + if(log.level()<=MSG::VERBOSE)log << MSG::VERBOSE << "MuonHoughPattern::no valid id_number" << endmsg; } } void MuonHoughPattern::setER(double er) { + MsgStream log(Athena::getMessageSvc(),"MuonHoughPattern::setER"); switch (m_id_number) { case MuonHough::hough_xy: @@ -190,7 +194,7 @@ void MuonHoughPattern::setER(double er) m_ertheta=er; break; default: - std::cout << "MuonHoughPattern::no valid id_number" << std::endl; + if(log.level()<=MSG::VERBOSE)log << MSG::VERBOSE << "MuonHoughPattern::no valid id_number" << endmsg; } } @@ -277,7 +281,6 @@ void MuonHoughPattern::updateParametersRPhi(bool cosmics) } if (std::abs(sumx) < 0.000001 || std::abs(sumy) < 0.000001) { - // {std::cout << " sum too small to update" << std::endl;} return; } @@ -286,10 +289,9 @@ void MuonHoughPattern::updateParametersRPhi(bool cosmics) if (phi > 0) phi -= M_PI; // phi between 0,-Pi for cosmics! } - // std::cout << "phi: << : " << phi << std::endl; CxxUtils::sincos scphi(phi); - const double r0 = scphi.apply(av_x,-av_y); //av_x * sincosphi[0] - av_y * sincosphi[1]; + const double r0 = scphi.apply(av_x,-av_y); setEPhi(phi); setERPhi(r0); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformSteering.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformSteering.cxx index 1f12a2627f8f..e2be92125435 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformSteering.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformSteering.cxx @@ -1,10 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternEvent/MuonHoughPattern.h" #include "MuonHoughPatternEvent/MuonHoughTransformer.h" #include "MuonHoughPatternEvent/MuonHoughTransformSteering.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" MuonHoughTransformSteering::MuonHoughTransformSteering(MuonHoughTransformer* houghtransformer) { @@ -20,6 +22,7 @@ MuonHoughTransformSteering::~MuonHoughTransformSteering() MuonHoughPatternCollection MuonHoughTransformSteering::constructHoughPatterns(const MuonHoughHitContainer* event, double residu_mm, double residu_grad, int max_patterns, bool which_segment, int printlevel)const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughTransformSteering::constructHoughPatterns"); MuonHoughPatternCollection houghpatterns; houghpatterns.reserve(max_patterns); std::vector <std::pair <int, int> > maxima = m_houghtransformer->getMaxima(max_patterns); // sector,binnumber , sorted vector @@ -37,9 +40,9 @@ MuonHoughPatternCollection MuonHoughTransformSteering::constructHoughPatterns(co } else { - if (printlevel>=4) + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { - std::cout << "binnumber == -1 (no max found), max patterns = " << maximum_number << std::endl; + log << MSG::VERBOSE << "binnumber == -1 (no max found), max patterns = " << maximum_number << endmsg; } break; } @@ -53,14 +56,15 @@ MuonHoughPatternCollection MuonHoughTransformSteering::constructHoughPatterns(co MuonHoughPattern* MuonHoughTransformSteering::constructHoughPattern(const MuonHoughHitContainer* event, double residu_mm, double residu_grad, int maximum_number, bool which_segment, int printlevel)const { - if (printlevel>=3) - {std::cout << "MuonHoughTransformSteering::constructHoughPattern (start) " << std::endl;} - + MsgStream log(Athena::getMessageSvc(),"MuonHoughTransformSteering::constructHoughPattern"); + if (printlevel>=3 || log.level()<=MSG::DEBUG) + {log << MSG::DEBUG << "MuonHoughTransformSteering::constructHoughPattern (start) " << endmsg;} + MuonHoughPattern* houghpattern = m_houghtransformer->associateHitsToMaximum(event,residu_mm,residu_grad,maximum_number,which_segment,printlevel); - - if (printlevel>=3) - {std::cout << "MuonHoughTransformSteering::constructHoughPattern (end) " << std::endl;} - + + if (printlevel>=3 || log.level()<=MSG::DEBUG) + {log << MSG::DEBUG << "MuonHoughTransformSteering::constructHoughPattern (end) " << endmsg;} + return houghpattern; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer.cxx index c718555ce10b..a610115cf94b 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer.cxx @@ -1,9 +1,11 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternEvent/MuonHoughTransformer.h" #include "MuonHoughPatternEvent/MuonHoughHitContainer.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" MuonHoughTransformer::MuonHoughTransformer(int nbins, int nbins_angle, double detectorsize, double detectorsize_angle, double threshold_histo, int number_of_sectors): m_threshold_histo(threshold_histo), m_eventsize(0), m_eventsize_weightfactor(20.), m_nbins(nbins), m_nbins_plus3(m_nbins + 3), m_nbins_angle(nbins_angle), @@ -15,12 +17,10 @@ m_detectorsize(detectorsize), m_detectorsize_angle(detectorsize_angle), m_number m_use_negative_weights = false; m_ip_setting = true; - // std::cout << "Constructor MuonHoughTransformer" << std::endl; m_stepsize = 2*detectorsize / (nbins+0.); m_stepsize_per_angle = detectorsize_angle / (nbins_angle+0.); - // initTables(); m_add_weight_radius = 1.; m_histos.reserve(m_number_of_sectors); for (int i=0; i<m_number_of_sectors; i++) @@ -36,11 +36,9 @@ m_detectorsize(detectorsize), m_detectorsize_angle(detectorsize_angle), m_number MuonHoughTransformer::~MuonHoughTransformer() { - //std::cout << "Destructor MuonHoughTransformer" << std::endl; for (int i=0; i<m_number_of_sectors; i++) { delete m_histos.getHisto(i); - //m_histos.getHisto(i)=0; } } @@ -68,6 +66,7 @@ void MuonHoughTransformer::fill(const MuonHoughHitContainer* event, bool subtrac MuonHoughPattern* MuonHoughTransformer::associateHitsToMaximum(const MuonHoughHitContainer* event, double maximum_residu_mm, double maximum_residu_grad, int maximum_number, bool which_segment, int printlevel)const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughTransformer::associateHitsToMaximum"); MuonHoughPattern* houghpattern; std::pair <double,double> coordsmaximum; std::pair <int,int> maximumbin; @@ -79,19 +78,19 @@ MuonHoughPattern* MuonHoughTransformer::associateHitsToMaximum(const MuonHoughHi { coordsmaximum = m_histos.getHisto(sector)->getCoordsMaximum(maximum_number,which_segment,printlevel); - if (printlevel>=4) + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { - std::cout << "maximum binnumber of histogram: " << maximumbin.second << " value: " << m_histos.getHisto(sector)->getBinContent(maximumbin.second) << std::endl; - std::cout << " coordinates: " << coordsmaximum.first << " second " << coordsmaximum.second << std::endl; + log << MSG::VERBOSE << "maximum binnumber of histogram: " << maximumbin.second << " value: " << m_histos.getHisto(sector)->getBinContent(maximumbin.second) << endmsg; + log << MSG::VERBOSE << " coordinates: " << coordsmaximum.first << " second " << coordsmaximum.second << endmsg; if (m_number_of_sectors!=1) - {std::cout << "sector: " << sector << std::endl;} + {log << MSG::VERBOSE << "sector: " << sector << endmsg;} } if (maximumbin.second == -1) // no maximum, no bin above threshold { - if (printlevel>=4) - {std::cout << "MuonHoughTransformer::No Maximum Found" << std::endl;} + if (printlevel>=4 || log.level()<=MSG::VERBOSE) + {log << MSG::VERBOSE << "MuonHoughTransformer::No Maximum Found" << endmsg;} return 0; } else @@ -103,8 +102,8 @@ MuonHoughPattern* MuonHoughTransformer::associateHitsToMaximum(const MuonHoughHi } else { - if (printlevel>=4) - {std::cout << "MuonHoughTransformer::No Maximum Found" << std::endl;} + if (printlevel>=4 || log.level()<=MSG::VERBOSE) + {log << MSG::VERBOSE << "MuonHoughTransformer::No Maximum Found" << endmsg;} return 0; } @@ -114,16 +113,15 @@ MuonHoughPattern* MuonHoughTransformer::associateHitsToMaximum(const MuonHoughHi MuonHoughPattern* MuonHoughTransformer::associateHitsToCoords(const MuonHoughHitContainer* event,std::pair <double,double> coordsmaximum,double maximum_residu_mm, double maximum_residu_angle, int sector, bool which_segment, int printlevel)const { MuonHoughPattern* houghpattern = hookAssociateHitsToMaximum(event,coordsmaximum,maximum_residu_mm,maximum_residu_angle,sector,which_segment,printlevel); - // houghpattern->setMaximumHistogram() TODO return houghpattern; } MuonHoughPattern* MuonHoughTransformer::associateHitsToBinnumber(const MuonHoughHitContainer* event,int binnumber,double maximum_residu_mm, double maximum_residu_angle, int sector, bool which_segment, int printlevel)const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughTransformer::associateHitsToBinnumber"); // this one is currently in use - - if (printlevel>=4) { - std::cout << "maximum of histogram: " << m_histos.getHisto(sector)->getBinContent(binnumber) << std::endl; + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { + log << MSG::VERBOSE << "maximum of histogram: " << m_histos.getHisto(sector)->getBinContent(binnumber) << endmsg; } @@ -139,8 +137,6 @@ std::pair <double,double> MuonHoughTransformer::getEndPointsFillLoop(double radi if (-radius < m_histos.getHisto(sector)->getXmin()) // randomizer to avoid binning effects { - //int floor = (int) std::floor(radius); - //endpoints.first=m_histos.getHisto(sector)->getXmin() + floor%stepsize; //randomizer, is there a faster way? endpoints.first=m_histos.getHisto(sector)->getXmin() + 0.5*stepsize; // no randomizer! no radius constraint } @@ -153,6 +149,7 @@ std::pair <double,double> MuonHoughTransformer::getEndPointsFillLoop(double radi double MuonHoughTransformer::sinus(double angle)const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughTransformer::sinus"); std::map <double,double>::const_iterator find; find = m_sin.find(angle); @@ -163,13 +160,15 @@ double MuonHoughTransformer::sinus(double angle)const } else { - std::cout << "MuonHoughTransformer::WARNING: angle: " << angle << " not in map!" << std::endl; + if (log.level()<=MSG::WARNING) + log << MSG::WARNING << "MuonHoughTransformer::WARNING: angle: " << angle << " not in map!" << endmsg; return std::sin(angle); } } double MuonHoughTransformer::cosinus(double angle)const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughTransformer::cosinus"); std::map <double,double>::const_iterator find; find = m_cos.find(angle); @@ -180,7 +179,8 @@ double MuonHoughTransformer::cosinus(double angle)const } else { - std::cout << "MuonHoughTransformer::WARNING: angle: " << angle << " not in map!" << std::endl; + if (log.level()<=MSG::WARNING) + log << MSG::WARNING << "MuonHoughTransformer::WARNING: angle: " << angle << " not in map!" << endmsg; return std::cos(angle); } } @@ -204,15 +204,6 @@ void MuonHoughTransformer::resetHisto() m_histos.reset(); } -// double MuonHoughTransformer::getHeigthMaximum(int maximum_number, bool which_segment, int printlevel) -// { -// std::pair <int,int> maximumbin; -// maximumbin = m_histos.getMaximumBinnumber(maximum_number,which_segment,printlevel); // sector, binnumber - -// // should be easier, function in MuonHoughhisto2dcontainer -// return m_histos.getHisto(maximumbin.first)->getBinContent(maximumbin.second); -// } - std::vector <std::pair <int,int> > MuonHoughTransformer::getMaxima(int max_patterns)const { std::vector <std::pair <int,int> > maximumbins; // sorted @@ -221,8 +212,6 @@ std::vector <std::pair <int,int> > MuonHoughTransformer::getMaxima(int max_patte for (int sector=0; sector<m_number_of_sectors; sector++) // to be made more general when m_number_of_sectors ==1 e.g. { - // pair (binnumber, content of that bin) - // std::pair <int, double> maximumbin = m_histos.getHisto(sector)->getMaximumBin(); std::pair <int,double> maximumbin = m_histos.getHisto(sector)->getMax(); std::pair < std::pair <int,int> , double > maximum; maximum.first.first = sector; @@ -240,7 +229,6 @@ std::vector <std::pair <int,int> > MuonHoughTransformer::getMaxima(int max_patte while (count_maxima!=size && number_of_patterns!=max_patterns) { std::pair <int,int> maximumbin = maxima[count_maxima].first; - // if (sectorNotInMaximumBinsYet(maximumbins,maximumbin.first)) bool check = true; // check if sector is not nearby a sector already chosen int sector = maximumbin.first; @@ -264,8 +252,6 @@ std::vector <std::pair <int,int> > MuonHoughTransformer::getMaxima(int max_patte { int sectorminmin = sectormin - 1; int sectorplusplus = sectorplus + 1; -// if (sectorminmin < 0) {sectorminmin = m_number_of_sectors;} // not necessary since those should be odd -// if (sectorplusplus > m_number_of_sectors) {sectorplusplus=0;} sectors.insert(sectorminmin); sectors.insert(sectorplusplus); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_CurvedAtACylinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_CurvedAtACylinder.cxx index 835b2bab363f..bdf59c25c05c 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_CurvedAtACylinder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_CurvedAtACylinder.cxx @@ -1,9 +1,11 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternEvent/MuonHoughTransformer_CurvedAtACylinder.h" #include "CxxUtils/sincos.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" MuonHoughTransformer_CurvedAtACylinder::MuonHoughTransformer_CurvedAtACylinder(int nbins, int nbins_angle, double detectorsize, double detectorsize_angle, double threshold_histo, int number_of_sectors):MuonHoughTransformer(nbins, nbins_angle, detectorsize, detectorsize_angle, threshold_histo, number_of_sectors) { @@ -49,12 +51,6 @@ void MuonHoughTransformer_CurvedAtACylinder::fillHit(MuonHoughHit* hit, double w int sectorhit = sector(hit); - // int printlevel = 0; -// if (printlevel>=4) { - // double hittheta = hit->getTheta(); - //std::cout << "Hit Info: " << hit->getId() << " sectorhit: " << sectorhit << std::endl; -// } - bool isbarrel = hit->isBarrel(); for (int i=0 ; i<m_nbins/2; i++) @@ -97,18 +93,7 @@ int MuonHoughTransformer_CurvedAtACylinder::fillHisto(double xbin, double theta_ const int filled_binnumber = histo->fill(xbin,theta_in_grad,weight); // overlap filling: - -// if (m_number_of_sectors>=2) { -// if (sector != m_number_of_sectors - 1) { -// m_histos.getHisto(sector+1)->fill(filled_binnumber,weight); -// } -// else { // sector == m_number_of_sectors -1 -// m_histos.getHisto(0)->fill(filled_binnumber,weight); -// } -// } - -// overlap and single sector filling: - //std::cout << " filling sector " << sector << " nearby " << m_number_of_sectors << std::endl; + // overlap and single sector filling: // nearby sectors: if (m_number_of_sectors>=3) { @@ -117,19 +102,16 @@ int MuonHoughTransformer_CurvedAtACylinder::fillHisto(double xbin, double theta_ { m_histos.getHisto(sector+1)->fill(filled_binnumber,reduced_weight); m_histos.getHisto(sector-1)->fill(filled_binnumber,reduced_weight); - //std::cout << " filling extra sector " << sector+1 << " " << sector-1 << std::endl; } else if (sector == 0) { m_histos.getHisto(sector+1)->fill(filled_binnumber,reduced_weight); m_histos.getHisto(m_number_of_sectors-1)->fill(filled_binnumber,reduced_weight); - //std::cout << " filling extra sector " << m_number_of_sectors-1 << " " << sector+1 << std::endl; } - else // sector == m_number_of_sectors - 1 + else { m_histos.getHisto(sector-1)->fill(filled_binnumber,reduced_weight); m_histos.getHisto(0)->fill(filled_binnumber,reduced_weight); - //std::cout << " filling extra sector 0 " << sector-1 << std::endl; } } @@ -142,7 +124,6 @@ int MuonHoughTransformer_CurvedAtACylinder::fillHisto(double xbin, double theta_ if (theta_in_grad - m_binwidthy < 0) { histo->fill(upperright,fifth_weight); - //histo->fill(xbin-m_binwidthx,theta_in_grad-m_binwidthy + 180.,fifth_weight); // no cyclic angle here if (m_use_negative_weights) { @@ -151,7 +132,6 @@ int MuonHoughTransformer_CurvedAtACylinder::fillHisto(double xbin, double theta_ } else if (theta_in_grad + m_binwidthy > 180.) { - //histo->fill(xbin+m_binwidthx,theta_in_grad+m_binwidthy - 180.,fifth_weight); histo->fill(lowerleft,fifth_weight); if (m_use_negative_weights) { @@ -173,6 +153,7 @@ int MuonHoughTransformer_CurvedAtACylinder::fillHisto(double xbin, double theta_ MuonHoughPattern* MuonHoughTransformer_CurvedAtACylinder::hookAssociateHitsToMaximum(const MuonHoughHitContainer* event,std::pair <double,double> coordsmaximum, double max_residu_mm,double /*max_residu_grad */, int maxsector, bool /*which_segment */, int printlevel)const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughTransformer_CurvedAtACylinder::hookAssociateHitsToMaximum"); MuonHoughPattern* houghpattern = new MuonHoughPattern(MuonHough::hough_curved_at_a_cylinder); // double ecurvature=0. // todo: recalculate estimated curvature for hits associated to maximum @@ -190,7 +171,7 @@ MuonHoughPattern* MuonHoughTransformer_CurvedAtACylinder::hookAssociateHitsToMax int index = static_cast<int> (std::floor(std::abs(coordsmaximum.first))); if (index >= m_nbins/2) { index = m_nbins/2-1; - if (printlevel >= 4) std::cout << "warning overflow maximum found" << std::endl; + if (printlevel >= 4 || log.level()<=MSG::VERBOSE) log << MSG::VERBOSE << "warning overflow maximum found" << endmsg; } invcurvature = m_muonhoughmathutils.sgn(coordsmaximum.first)*m_invcurvature[index]; curvature = 1./invcurvature; @@ -206,12 +187,12 @@ MuonHoughPattern* MuonHoughTransformer_CurvedAtACylinder::hookAssociateHitsToMax } else if (sector_3 < 0) {sector_3 = m_number_of_sectors/2 - 1;} // if sector_3 smaller than 0 -> 15 - if (printlevel>=4) { - std::cout << "sector: " << maxsector << std::endl; - std::cout << "coordsmaximumfirst: " << coordsmaximum.first << " curvature: " << curvature << std::endl; - std::cout << "coordsmaximumsecond: " << coordsmaximum.second << " coordsmaximumsecondinrad: " << theta << std::endl; - std::cout << "MuonHoughTransformer_CurvedAtACylinder::size of event: " << event->size() << std::endl; - std::cout << "allowed sectors: " << sector_1 << " , " << sector_2 << " & " << sector_3 << std::endl; + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { + log << MSG::VERBOSE << "sector: " << maxsector << endmsg; + log << MSG::VERBOSE << "coordsmaximumfirst: " << coordsmaximum.first << " curvature: " << curvature << endmsg; + log << MSG::VERBOSE << "coordsmaximumsecond: " << coordsmaximum.second << " coordsmaximumsecondinrad: " << theta << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_CurvedAtACylinder::size of event: " << event->size() << endmsg; + log << MSG::VERBOSE << "allowed sectors: " << sector_1 << " , " << sector_2 << " & " << sector_3 << endmsg; } for (unsigned int i=0; i<event->size(); i++) @@ -232,9 +213,9 @@ MuonHoughPattern* MuonHoughTransformer_CurvedAtACylinder::hookAssociateHitsToMax double residu_distance_mm = std::abs(sdis); - if (printlevel>=4) { - std::cout << "MuonHoughTransformer_CurvedAtACylinder::hitx: " << hitx << " hity: " << hity << " hitz: " << hitz << std::endl; - std::cout << "MuonHoughTransformer_CurvedAtACylinder::residu_distance: " << sdis << " max_residu_mm*scale: " << max_residu_mm*scale << std::endl; + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { + log << MSG::VERBOSE << "MuonHoughTransformer_CurvedAtACylinder::hitx: " << hitx << " hity: " << hity << " hitz: " << hitz << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_CurvedAtACylinder::residu_distance: " << sdis << " max_residu_mm*scale: " << max_residu_mm*scale << endmsg; } if(std::abs(residu_distance_mm)<max_residu_mm*scale) // here no circular effect @@ -246,10 +227,10 @@ MuonHoughPattern* MuonHoughTransformer_CurvedAtACylinder::hookAssociateHitsToMax const double theta = m_muonhoughmathutils.thetaForCurvedHit(invcurvature,event->getHit(i)); if ( theta > 0 && theta < M_PI) { - if (printlevel>=4) + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { - std::cout << "MuonHoughTransformer_CurvedAtACylinder::hit added to houghpattern! Sector number: " << sectorhit << std::endl; - if (event->getHit(i)->getAssociated()==true) std::cout << " hit already earlier associated to pattern!" << std::endl; + log << MSG::VERBOSE << "MuonHoughTransformer_CurvedAtACylinder::hit added to houghpattern! Sector number: " << sectorhit << endmsg; + if (event->getHit(i)->getAssociated()==true) log << MSG::VERBOSE << " hit already earlier associated to pattern!" << endmsg; } houghpattern->addHit(event->getHit(i)); event->getHit(i)->setAssociated(true); @@ -269,14 +250,13 @@ MuonHoughPattern* MuonHoughTransformer_CurvedAtACylinder::hookAssociateHitsToMax houghpattern->setEPhi(ephi); houghpattern->setECurvature(curvature); - if (printlevel>=4) { - std::cout << " number of hits added to pattern: " << houghpattern->size() << std::endl; - if (houghpattern->size()==0) - { - std::cout << "MuonHoughTransformer_CurvedAtACylinder::WARNING : no hits found on pattern" << std::endl; - } - } - + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { + log << MSG::VERBOSE << " number of hits added to pattern: " << houghpattern->size() << endmsg;} + if (houghpattern->size()==0 && (printlevel>=1 || log.level()<=MSG::WARNING)) + { + log << MSG::WARNING << "MuonHoughTransformer_CurvedAtACylinder::WARNING : no hits found on pattern" << endmsg; + } + return houghpattern; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_rz.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_rz.cxx index 9a15b2eea167..da1b1b5398a2 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_rz.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_rz.cxx @@ -1,8 +1,10 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternEvent/MuonHoughTransformer_rz.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" MuonHoughTransformer_rz::MuonHoughTransformer_rz(int nbins, int nbins_angle, double detectorsize, double detectorsize_angle, double threshold_histo, int number_of_sectors):MuonHoughTransformer(nbins, nbins_angle, detectorsize, detectorsize_angle, threshold_histo, number_of_sectors), m_use_residu_grad(false) { @@ -11,14 +13,8 @@ MuonHoughTransformer_rz::MuonHoughTransformer_rz(int nbins, int nbins_angle, dou m_add_weight_angle=false; } -MuonHoughTransformer_rz::~MuonHoughTransformer_rz() -{ -} - void MuonHoughTransformer_rz::fillHit(MuonHoughHit* hit, double weight) { - // std::cout << "MuonHoughTransformer_rz::WEIGHT " << weight << "ip_settting: " << m_ip_setting << std::endl; - const double hitz = hit->getHitz(); if (m_ip_setting == true) // niels and peter alg, butterfly to be added, and to be looked into the method @@ -38,8 +34,6 @@ void MuonHoughTransformer_rz::fillHit(MuonHoughHit* hit, double weight) double theta_in_grad = (theta/M_PI)*180.; dotprod = perp * std::sin(theta) + hitz * std::cos(theta); - // std::cout << " rz0 " << rz0 << " theta " << theta_in_grad << " dotprod " << dotprod - // << " hitz: " << hitz << std::endl; if( theta_in_grad > 180. ) continue; // to keep the angle physical if( theta_in_grad < 0. ) continue; // idem @@ -50,16 +44,15 @@ void MuonHoughTransformer_rz::fillHit(MuonHoughHit* hit, double weight) } } } - else // (m_ip_setting == false) + else { - int sectorhit = 0; // for ip == false always sector ==0 + int sectorhit = 0; const double radius = hit->getRadius(); for (double theta=m_stepsize_per_angle/2.; theta<m_detectorsize_angle; theta+=m_stepsize_per_angle) { double theta_in_rad = M_PI*theta/180.; double rz0 = hitz*std::sin(theta_in_rad) - radius*std::cos(theta_in_rad); - // double rz0 = hitz*sinus(theta_in_rad) - radius*cosinus(theta_in_rad); double dotprod = 0; dotprod = radius * std::sin(theta_in_rad) + hitz * std::cos(theta_in_rad); @@ -95,7 +88,7 @@ int MuonHoughTransformer_rz::fillHisto(double rz0, double theta_in_grad, double m_histos.getHisto(sector+1)->fill(rz0,theta_in_grad,third_weight); m_histos.getHisto(m_number_of_sectors-1)->fill(rz0,theta_in_grad,third_weight); } - else // sector == m_number_of_sectors - 1 + else { m_histos.getHisto(sector-1)->fill(rz0,theta_in_grad,third_weight); m_histos.getHisto(0)->fill(rz0,theta_in_grad,third_weight); @@ -107,7 +100,6 @@ int MuonHoughTransformer_rz::fillHisto(double rz0, double theta_in_grad, double if (theta_in_grad - binwidthy < 0) { histo->fill(rz0+binwidthx,theta_in_grad+binwidthy,half_weight); - //histo->fill(rz0-binwidthx,theta_in_grad-binwidthy + 180.,half_weight); // no cyclic angle here if (m_use_negative_weights) { histo->fill(rz0-binwidthx,theta_in_grad+binwidthy,-half_weight); @@ -116,7 +108,6 @@ int MuonHoughTransformer_rz::fillHisto(double rz0, double theta_in_grad, double } else if (theta_in_grad + binwidthy > 180.) { - //histo->fill(rz0+binwidthx,theta_in_grad+binwidthy - 180.,half_weight); histo->fill(rz0-binwidthx,theta_in_grad-binwidthy,half_weight); if (m_use_negative_weights) { @@ -152,6 +143,7 @@ double MuonHoughTransformer_rz::calculateAngle(double hitx, double hity, double MuonHoughPattern* MuonHoughTransformer_rz::hookAssociateHitsToMaximum(const MuonHoughHitContainer* event, std::pair <double,double> coordsmaximum,double maximum_residu_mm, double maximum_residu_angle, int maxsector, bool /*which_segment*/, int printlevel)const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughTransformer_rz::hookAssociateHitsToMaximum"); MuonHoughPattern* houghpattern = new MuonHoughPattern(MuonHough::hough_rz); double theta=0.,residu_distance=0.,maximum_residu=0.; @@ -159,12 +151,12 @@ MuonHoughPattern* MuonHoughTransformer_rz::hookAssociateHitsToMaximum(const Muon double coordsmaximumsecondinrad = m_muonhoughmathutils.angleFromGradToRadial(coordsmaximum.second); double rz0 = coordsmaximum.first; - if (printlevel>=4) + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { - std::cout << "sector: " << maxsector << std::endl; - std::cout << "coordsmaximumfirst: " << rz0 << std::endl; - std::cout << "coordsmaximumsecond: " << coordsmaximum.second << " coordsmaximumsecondinrad: " << coordsmaximumsecondinrad << std::endl; - std::cout << "MuonHoughTransformer_rz::size of event: " << event->size() << std::endl; + log << MSG::VERBOSE << "sector: " << maxsector << endmsg; + log << MSG::VERBOSE << "coordsmaximumfirst: " << rz0 << endmsg; + log << MSG::VERBOSE << "coordsmaximumsecond: " << coordsmaximum.second << " coordsmaximumsecondinrad: " << coordsmaximumsecondinrad << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_rz::size of event: " << event->size() << endmsg; } for (unsigned int i=0; i<event->size(); i++) @@ -189,7 +181,6 @@ MuonHoughPattern* MuonHoughTransformer_rz::hookAssociateHitsToMaximum(const Muon { double residu_distance_mm = m_muonhoughmathutils.signedDistanceToLine(hitz,radius,rz0,coordsmaximumsecondinrad); -// theta = calculateAngle(hitx,hity,hitz,coordsmaximum.first/std::sin(coordsmaximumsecondinrad)); // used for estimating the angle // Use this code for rz scan and theta // double radius3 = sqrt(hitx*hitx+hity*hity+hitz*hitz); @@ -199,9 +190,8 @@ MuonHoughPattern* MuonHoughTransformer_rz::hookAssociateHitsToMaximum(const Muon theta = std::atan2(radius,hitz)+std::atan2(rz0,heigth); - if (printlevel>=4) { std::cout << "theta: " << theta << " heigth: " << heigth << " radius3: " << radius3 << " std::atan2(radius,hitz): " << std::atan2(radius,hitz) << " +std::atan2(rz0,heigth): " << std::atan2(rz0,heigth) << " rz0: " << rz0 << std::endl; } -// std::cout << " check rz0 estimate " << hitz*sin(theta) - radius*cos(theta) << " rz0 " << rz0 <<std::endl; - if (printlevel>=4 && std::abs(rz0) > radius3) {std::cout << "rz0 > radius3" << std::endl;} + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { log << MSG::VERBOSE << "theta: " << theta << " heigth: " << heigth << " radius3: " << radius3 << " std::atan2(radius,hitz): " << std::atan2(radius,hitz) << " +std::atan2(rz0,heigth): " << std::atan2(rz0,heigth) << " rz0: " << rz0 << endmsg; } + if ((printlevel>=4 || log.level()<=MSG::VERBOSE) && std::abs(rz0) > radius3) {log << MSG::VERBOSE << "rz0 > radius3" << endmsg;} if (m_use_residu_grad==1) { double residu_distance_grad = std::abs(std::sin(theta-coordsmaximumsecondinrad)); residu_distance=residu_distance_grad; @@ -212,21 +202,21 @@ MuonHoughPattern* MuonHoughTransformer_rz::hookAssociateHitsToMaximum(const Muon maximum_residu=maximum_residu_mm; } - if (printlevel>=4) { - std::cout << "MuonHoughTransformer_rz::hitx: " << hitx << " hity: " << hity << " hitz: " << hitz << std::endl; - std::cout << "MuonHoughTransformer_rz::residu_distance: " << residu_distance << std::endl; + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { + log << MSG::VERBOSE << "MuonHoughTransformer_rz::hitx: " << hitx << " hity: " << hity << " hitz: " << hitz << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_rz::residu_distance: " << residu_distance << endmsg; } bool inmax = false ; if ( std::abs( theta*180./M_PI - coordsmaximum.second) < 1.1 ) inmax = true ; if(std::abs(residu_distance)<maximum_residu) // here no circular effect { - if (printlevel>=4) + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { - std::cout << "MuonHoughTransformer_rz::hit added to houghpattern!" << std::endl; - std::cout << " Sector number hit " << sectorhit << " max " << maxsector << " detector: " << event->getHit(i)->getWhichDetector() << std::endl; - if (inmax) std::cout << " MuonHoughTransformer_rz:: in maximum " << std::endl; - if (!inmax) std::cout << " OUTSIDE maximum theta hit " << theta*180./M_PI << " max Hough theta " << coordsmaximum.second << std::endl; + log << MSG::VERBOSE << "MuonHoughTransformer_rz::hit added to houghpattern!" << endmsg; + log << MSG::VERBOSE << " Sector number hit " << sectorhit << " max " << maxsector << " detector: " << event->getHit(i)->getWhichDetector() << endmsg; + if (inmax) log << MSG::VERBOSE << " MuonHoughTransformer_rz:: in maximum " << endmsg; + if (!inmax) log << MSG::VERBOSE << " OUTSIDE maximum theta hit " << theta*180./M_PI << " max Hough theta " << coordsmaximum.second << endmsg; } houghpattern->addHit(event->getHit(i)); @@ -235,24 +225,22 @@ MuonHoughPattern* MuonHoughTransformer_rz::hookAssociateHitsToMaximum(const Muon double rz0hit = residu_distance_mm + rz0; eradius += rz0hit; - if (printlevel>=4){std::cout << "MuonHoughTransformer_rz::calculateAngle: " << theta << " calculateradius: " << rz0hit << std::endl; + if (printlevel>=4 || log.level()<=MSG::VERBOSE){ + log << MSG::VERBOSE << "MuonHoughTransformer_rz::calculateAngle: " << theta << " calculateradius: " << rz0hit << endmsg; double radiush = sqrt(event->getHitx(i)*event->getHitx(i)+event->getHity(i)*event->getHity(i)); - - std::cout << " R Z hit added to hough pattern theta hit " << atan2(radiush,event->getHitz(i) ) << " theta all " << coordsmaximumsecondinrad << std::endl; + log << MSG::VERBOSE << " R Z hit added to hough pattern theta hit " << atan2(radiush,event->getHitz(i) ) << " theta all " << coordsmaximumsecondinrad << endmsg; } sin_theta += std::sin(theta); cos_theta += std::cos(theta); - //if (m_ip_setting == true) - //{ phi = std::atan2(hity,hitx); sin_phi += std::sin(phi); cos_phi += std::cos(phi); //} } else { - if (inmax) std::cout << "LOST hit in maximum distance" << residu_distance << std::endl; + if (inmax) if (log.level()<=MSG::WARNING)log << MSG::WARNING << "LOST hit in maximum distance" << residu_distance << endmsg; } }// dotprod @@ -265,9 +253,9 @@ MuonHoughPattern* MuonHoughTransformer_rz::hookAssociateHitsToMaximum(const Muon eradius=eradius/(houghpattern->size()+0.0001); - if (printlevel>=4) + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { - std::cout << "MuonHoughTransformer_rz::Etheta : " << etheta << " Size houghpattern " << houghpattern->size() << " ephi " << ephi << std::endl; + log << MSG::VERBOSE << "MuonHoughTransformer_rz::Etheta : " << etheta << " Size houghpattern " << houghpattern->size() << " ephi " << ephi << endmsg; } houghpattern->setETheta(etheta); @@ -276,15 +264,15 @@ MuonHoughPattern* MuonHoughTransformer_rz::hookAssociateHitsToMaximum(const Muon if (houghpattern->size()==0) { - if (printlevel>=4){std::cout << "MuonHoughTransformer_rz::WARNING : no hits found on pattern" << std::endl;} + if (printlevel>=4 || log.level()<=MSG::VERBOSE){log << MSG::VERBOSE << "MuonHoughTransformer_rz::WARNING : no hits found on pattern" << endmsg;} } else if (std::abs(eradius-rz0) > 500. || std::sin(etheta-coordsmaximumsecondinrad) > 0.05) { - if (printlevel>=4){ - std::cout << "MuonHoughTransformer_rz::WARNING Eradius or Etheta calc. WRONG" << std::endl; - std::cout << "MuonHoughTransformer_rz::eradius: " << rz0 << " etheta: " << coordsmaximumsecondinrad << std::endl; - std::cout << "MuonHoughTransformer_rz::eradius: " << eradius << " etheta: " << etheta << std::endl; + if (printlevel>=4 || log.level()<=MSG::VERBOSE){ + log << MSG::VERBOSE << "MuonHoughTransformer_rz::WARNING Eradius or Etheta calc. WRONG" << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_rz::eradius: " << rz0 << " etheta: " << coordsmaximumsecondinrad << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_rz::eradius: " << eradius << " etheta: " << etheta << endmsg; } houghpattern->setETheta(coordsmaximumsecondinrad); //coordsmaximumsecondinrad houghpattern->setERTheta(rz0); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_rzcosmics.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_rzcosmics.cxx index 272a8fe27745..fdbc20650193 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_rzcosmics.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_rzcosmics.cxx @@ -1,9 +1,11 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternEvent/MuonHoughTransformer_rzcosmics.h" #include "CxxUtils/sincos.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" MuonHoughTransformer_rzcosmics::MuonHoughTransformer_rzcosmics(int nbins, int nbins_angle, double detectorsize, double detectorsize_angle, double threshold_histo, int number_of_sectors):MuonHoughTransformer(nbins, nbins_angle, detectorsize, detectorsize_angle, threshold_histo, number_of_sectors) { @@ -102,6 +104,7 @@ int MuonHoughTransformer_rzcosmics::fillHisto(double rz0, double theta_in_grad, MuonHoughPattern* MuonHoughTransformer_rzcosmics::hookAssociateHitsToMaximum(const MuonHoughHitContainer* event, std::pair <double,double> coordsmaximum,double maximum_residu_mm, double /*maximum_residu_angle*/, int maxsector, bool /*which_segment*/, int printlevel)const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughTransformer_rzcosmics::hookAssociateHitsToMaximum"); MuonHoughPattern* houghpattern = new MuonHoughPattern(MuonHough::hough_rzcosmics); double eradius=0.,er0=0.; @@ -110,12 +113,12 @@ MuonHoughPattern* MuonHoughTransformer_rzcosmics::hookAssociateHitsToMaximum(con const double phimax = m_phisec[maxsector]; - if (printlevel>=4) + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { - std::cout << "sector: " << maxsector << " phimax: " << phimax << std::endl; - std::cout << "coordsmaximumfirst: " << rz0 << std::endl; - std::cout << "coordsmaximumsecond: " << coordsmaximum.second << " coordsmaximumsecondinrad: " << theta << std::endl; - std::cout << "MuonHoughTransformer_rzcosmics::size of event: " << event->size() << std::endl; + log << MSG::VERBOSE << "sector: " << maxsector << " phimax: " << phimax << endmsg; + log << MSG::VERBOSE << "coordsmaximumfirst: " << rz0 << endmsg; + log << MSG::VERBOSE << "coordsmaximumsecond: " << coordsmaximum.second << " coordsmaximumsecondinrad: " << theta << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_rzcosmics::size of event: " << event->size() << endmsg; } for (unsigned int i=0; i<event->size(); i++) @@ -129,18 +132,18 @@ MuonHoughPattern* MuonHoughTransformer_rzcosmics::hookAssociateHitsToMaximum(con double residu_distance = m_muonhoughmathutils.signedDistanceToLine(hitz,perp,rz0,theta); - if (printlevel>=4) + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { - std::cout << "MuonHoughTransformer_rzcosmics::hitx: " << hitx << " hity: " << hity << " hitz: " << hitz << " perp: " << perp << std::endl; - std::cout << "MuonHoughTransformer_rzcosmics::residu_distance: " << residu_distance << std::endl; + log << MSG::VERBOSE << "MuonHoughTransformer_rzcosmics::hitx: " << hitx << " hity: " << hity << " hitz: " << hitz << " perp: " << perp << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_rzcosmics::residu_distance: " << residu_distance << endmsg; } if(std::abs(residu_distance)<maximum_residu_mm) // here no circular effect { - if (printlevel>=4) + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { - std::cout << "MuonHoughTransformer_rzcosmics::hit added to houghpattern! detector: " << event->getHit(i)->getWhichDetector() << std::endl; - if (event->getHit(i)->getAssociated()==true) std::cout << " hit already earlier associated to pattern!" << std::endl; + log << MSG::VERBOSE<< "MuonHoughTransformer_rzcosmics::hit added to houghpattern! detector: " << event->getHit(i)->getWhichDetector() << endmsg; + if (event->getHit(i)->getAssociated()==true)log << MSG::VERBOSE << " hit already earlier associated to pattern!" << endmsg; } houghpattern->addHit(event->getHit(i)); event->getHit(i)->setAssociated(true); @@ -165,28 +168,27 @@ MuonHoughPattern* MuonHoughTransformer_rzcosmics::hookAssociateHitsToMaximum(con if (houghpattern->size()==0) { - if (printlevel>=4){std::cout << "MuonHoughTransformer_rzcosmics::WARNING : no hits found on pattern" << std::endl;} + if (printlevel>=4 || log.level()<=MSG::VERBOSE){log << MSG::VERBOSE << "MuonHoughTransformer_rzcosmics::WARNING : no hits found on pattern" << endmsg;} } else if (std::abs(eradius-rz0) > 500.) { - if (printlevel>=4){ - std::cout << "MuonHoughTransformer_rzcosmics::WARNING Eradius or Etheta calc. WRONG" << std::endl; - std::cout << "MuonHoughTransformer_rzcosmics::eradius: " << rz0 << " etheta: " << theta << std::endl; - std::cout << "MuonHoughTransformer_rzcosmics::eradius: " << eradius << " etheta: " << theta << std::endl; + if (printlevel>=4 || log.level()<=MSG::VERBOSE){ + log << MSG::VERBOSE << "MuonHoughTransformer_rzcosmics::WARNING Eradius or Etheta calc. WRONG" << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_rzcosmics::eradius: " << rz0 << " etheta: " << theta << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_rzcosmics::eradius: " << eradius << " etheta: " << theta << endmsg; } houghpattern->setERTheta(rz0); } updateParameters(houghpattern); // not possible when phi direction not known! - if (printlevel>=4) + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { - std::cout << "MuonHoughTransformer_rzcosmics::updateParameterstheta new phi: " << houghpattern->getEPhi() << " old phi: " << phimax << std::endl; - std::cout << "MuonHoughTransformer_rzcosmics::updateParameterstheta new r0: " << houghpattern->getERPhi() << " old r0: " << er0 << std::endl; - - std::cout << "MuonHoughTransformer_rzcosmics::updateParameterstheta new theta: " << houghpattern->getETheta() << " old theta: " << theta << std::endl; - std::cout << "MuonHoughTransformer_rzcosmics::updateParameterstheta new z0: " << houghpattern->getERTheta() << " old z0: " << eradius << std::endl; + log << MSG::VERBOSE << "MuonHoughTransformer_rzcosmics::updateParameterstheta new phi: " << houghpattern->getEPhi() << " old phi: " << phimax << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_rzcosmics::updateParameterstheta new r0: " << houghpattern->getERPhi() << " old r0: " << er0 << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_rzcosmics::updateParameterstheta new theta: " << houghpattern->getETheta() << " old theta: " << theta << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_rzcosmics::updateParameterstheta new z0: " << houghpattern->getERTheta() << " old z0: " << eradius << endmsg; } return houghpattern; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_xy.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_xy.cxx index ed50db0cf129..4112c637fcfe 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_xy.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_xy.cxx @@ -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 */ #include "MuonHoughPatternEvent/MuonHoughTransformer_xy.h" @@ -8,10 +8,6 @@ MuonHoughTransformer_xy::MuonHoughTransformer_xy(int nbins, int nbins_angle, dou { } -MuonHoughTransformer_xy::~MuonHoughTransformer_xy() -{ -} - std::pair <double,double> MuonHoughTransformer_xy::getHitPos(const MuonHoughHitContainer * event, int hitid)const //returns the relevant position of the hit (xy-RPC in case of id_number==id_xy_rpc etc.) { std::pair <double,double> hitpos; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_xyz.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_xyz.cxx index 9ac4fad1990d..8907326770b2 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_xyz.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_xyz.cxx @@ -1,9 +1,12 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHoughPatternEvent/MuonHoughTransformer_xyz.h" #include "CxxUtils/sincos.h" +#include "GaudiKernel/MsgStream.h" +#include "AthenaKernel/getMessageSvc.h" + MuonHoughTransformer_xyz::MuonHoughTransformer_xyz(int nbins, int nbins_angle, double detectorsize, double detectorsize_angle, double threshold_histo, int number_of_sectors):MuonHoughTransformer(nbins, nbins_angle, detectorsize, detectorsize_angle, threshold_histo, number_of_sectors) { @@ -11,35 +14,25 @@ MuonHoughTransformer_xyz::MuonHoughTransformer_xyz(int nbins, int nbins_angle, d m_weight_constant_radius = 3000; } -MuonHoughTransformer_xyz::~MuonHoughTransformer_xyz() -{ -} - void MuonHoughTransformer_xyz::fillHit(MuonHoughHit* hit, double weight) { - // std::cout << "MuonHoughTransformer_xyz::WEIGHT " << weight << std::endl; double radius = hit->getRadius(); double hitx = hit->getHitx(); double hity = hit->getHity(); int sectorhit = sector(hit); double dotprod = 0.; - // std::cout << " MuonHoughTransformer_xyz::IP_setting is: " << m_ip_setting << std::endl; if (m_ip_setting == true) { std::pair <double,double> endpoints = getEndPointsFillLoop(radius,m_stepsize,sectorhit); - // std::cout << " endpoints: " << endpoints.first << " " << endpoints.second << std::endl; for (double r0 = endpoints.first; r0<endpoints.second; r0+=m_stepsize) - // for (double r0=-radius+0.000001; r0<radius; r0+=m_stepsize) { double phi = calculateAngle(hitx, hity, r0); - // std::cout << " hitx: " << hitx << " hity: " << hity << " r0: " << r0 << " phi: " << phi << std::endl; CxxUtils::sincos scphi(phi); dotprod = scphi.apply(hity,hitx); // hity * sincosphi[0] + hitx * sincosphi[1]; if (dotprod >=0) { double phi_in_grad = phi*MuonHough::rad_degree_conversion_factor; - // double ip_weight = weight*weightHoughTransform(r0); // give mildly more importance to patterns closer to IP fillHisto(r0,phi_in_grad,weight,sectorhit); } } @@ -51,14 +44,8 @@ void MuonHoughTransformer_xyz::fillHit(MuonHoughHit* hit, double weight) { double phi_in_rad = MuonHough::degree_rad_conversion_factor*phi; CxxUtils::sincos scphi(phi_in_rad); - - double r0 = scphi.apply(hitx,-hity); //hitx*sincosphi[0] - hity*sincosphi[1]; - - // dotprod = hity * sincosphi[0] + hitx * sincosphi[1]; - // if (dotprod >=0) - // { + double r0 = scphi.apply(hitx,-hity); fillHisto(r0,phi,weight,sectorhit); - // } } } } @@ -85,12 +72,10 @@ int MuonHoughTransformer_xyz::fillHisto(double r0, double phi, double weight, in else if (sector == 0) { m_histos.getHisto(sector+1)->fill(filled_binnumber,third_weight); -// m_histos.getHisto(m_number_of_sectors-1)->fill(filled_binnumber,weight/6.); } else // sector == m_number_of_sectors - 1 { m_histos.getHisto(sector-1)->fill(filled_binnumber,third_weight); -// m_histos.getHisto(0)->fill(filled_binnumber,weight/6.); } } @@ -161,9 +146,10 @@ double MuonHoughTransformer_xyz::calculateAngle(double hitx, double hity, double MuonHoughPattern* MuonHoughTransformer_xyz::hookAssociateHitsToMaximum(const MuonHoughHitContainer* event,std::pair <double,double> coordsmaximum, double max_residu_mm,double /*max_residu_angle*/, int max_sector, bool /*which_segment*/, int printlevel)const { + MsgStream log(Athena::getMessageSvc(),"MuonHoughTransformer_xyz::hookAssociateHitsToMaximum"); MuonHoughPattern* houghpattern = initialiseHoughPattern(); - if (printlevel>=3){ - std::cout << "MuonHoughTransformer_xyz::hookAssociateHitsToMaximum (start)" << std::endl;} + if (printlevel>=3 || log.level()<=MSG::DEBUG){ + log << MSG::DEBUG << "MuonHoughTransformer_xyz::hookAssociateHitsToMaximum (start)" << endmsg;} double ephi=0., eradius=0., sin_phi=0., cos_phi=0.; double dotprod=0.; @@ -172,10 +158,10 @@ MuonHoughPattern* MuonHoughTransformer_xyz::hookAssociateHitsToMaximum(const Muo double residu_distance=0.; - if (printlevel >= 3) + if (printlevel >= 3 || log.level()<=MSG::DEBUG) { - std::cout << "MuonHoughTransformer_xyz::size_event: " << event->size() << std::endl; - std::cout << "MuonHoughTransformer_xyz::found_maximum: r: " << coordsmaximum.first << " phi: " << coordsmaximum.second << " sector: " << max_sector << std::endl; + log << MSG::DEBUG << "MuonHoughTransformer_xyz::size_event: " << event->size() << endmsg; + log << MSG::DEBUG << "MuonHoughTransformer_xyz::found_maximum: r: " << coordsmaximum.first << " phi: " << coordsmaximum.second << " sector: " << max_sector << endmsg; } double phimax = m_muonhoughmathutils.angleFromGradToRadial(coordsmaximum.second); @@ -202,25 +188,21 @@ MuonHoughPattern* MuonHoughTransformer_xyz::hookAssociateHitsToMaximum(const Muo dotprod = scphimax.apply(getHitPos(event,i).second, getHitPos(event,i).first); //getHitPos(event,i).first * sincosphimax[1] + getHitPos(event,i).second * sincosphimax[0]; } if (dotprod>=0) - { - // residu_distance = m_muonhoughmathutils.distanceToLine(getHitPos(event,i).first,getHitPos(event,i).second,coordsmaximum_inglobalcoords.first,coordsmaximum_inglobalcoords.second); - - // residu_distance = - coordsmaximum.first + std::sin(phimax) * event->getHitx(i) - std::cos(phimax) * event->getHity(i); // phimax shoudl be in map, but there are rounding errors.. - + { residu_distance = - coordsmaximum.first + scphimax.apply(getHitPos(event,i).first,-getHitPos(event,i).second); //- coordsmaximum.first + sincosphimax[0] * getHitPos(event,i).first - sincosphimax[1] * getHitPos(event,i).second; // phimax shoudl be in map, but there are rounding errors.. - if (printlevel>=3) { - std::cout << "MuonHoughTransformer_xyz::hitx: " << getHitPos(event,i).first << " hity: " << getHitPos(event,i).second << " dotprod: " << dotprod << " sector: " << sectorhit << std::endl; + if (printlevel>=3 || log.level()<=MSG::DEBUG) { + log << MSG::DEBUG << "MuonHoughTransformer_xyz::hitx: " << getHitPos(event,i).first << " hity: " << getHitPos(event,i).second << " dotprod: " << dotprod << " sector: " << sectorhit << endmsg; - std::cout << "MuonHoughTransformer_xyz::residu_distance: " << residu_distance << std::endl;} + log << MSG::DEBUG << "MuonHoughTransformer_xyz::residu_distance: " << residu_distance << endmsg;} if(std::abs(residu_distance)<max_residu_mm) { houghpattern->addHit(event->getHit(i)); - if (printlevel>=3) { - std::cout << "MuonHoughTransformer_xyz::hit added to houghpattern!" << std::endl; - if (event->getHit(i)->getAssociated()==true) std::cout << " hit already earlier associated to pattern!" << std::endl; + if (printlevel>=3 || log.level()<=MSG::DEBUG) { + log << MSG::DEBUG << "MuonHoughTransformer_xyz::hit added to houghpattern!" << endmsg; + if (event->getHit(i)->getAssociated()==true)log << MSG::DEBUG << " hit already earlier associated to pattern!" << endmsg; } event->getHit(i)->setAssociated(true); @@ -228,9 +210,8 @@ MuonHoughPattern* MuonHoughTransformer_xyz::hookAssociateHitsToMaximum(const Muo double phi = calculateAngle(hitx,hity,coordsmaximum.first); double thetah = atan2(radiushit,hitz); - if (printlevel>=3) { - - std::cout << " X Y hit added to hough pattern phi hit " << atan2(event->getHity(i), event->getHitx(i) ) << " phi_calc: " << phi << " phi all " << phimax << " theta hit " << thetah << std::endl; + if (printlevel>=3 || log.level()<=MSG::DEBUG) { + log << MSG::DEBUG << " X Y hit added to hough pattern phi hit " << atan2(event->getHity(i), event->getHitx(i) ) << " phi_calc: " << phi << " phi all " << phimax << " theta hit " << thetah << endmsg; } etheta +=thetah; @@ -242,7 +223,7 @@ MuonHoughPattern* MuonHoughTransformer_xyz::hookAssociateHitsToMaximum(const Muo double radius = m_muonhoughmathutils.signedDistanceOfLineToOrigin2D(event->getHitx(i),event->getHity(i),phimax); eradius +=radius; - if (printlevel>=3){std::cout << "MuonHoughTransformer_xyz::calculateAngle: " << phi << " calculateradius: " << radius << std::endl;} + if (printlevel>=3 || log.level()<=MSG::DEBUG){log << MSG::DEBUG << "MuonHoughTransformer_xyz::calculateAngle: " << phi << " calculateradius: " << radius << endmsg;} } } //dotprod >=0 @@ -253,9 +234,8 @@ MuonHoughPattern* MuonHoughTransformer_xyz::hookAssociateHitsToMaximum(const Muo etheta=etheta/(houghpattern->size()+0.0001); ephi = std::atan2(sin_phi,cos_phi); - if (printlevel>=3){std::cout << "MuonHoughTransformer_xyz::ephi: " << ephi << " eradius: " << eradius << " etheta " << etheta << std::endl;} + if (printlevel>=3 || log.level()<=MSG::DEBUG){log << MSG::DEBUG << "MuonHoughTransformer_xyz::ephi: " << ephi << " eradius: " << eradius << " etheta " << etheta << endmsg;} - //houghpattern->setEPhi(ephi); if (m_ip_setting == true) houghpattern->setEPhi(ephi); else {houghpattern->setEPhi(phimax);} @@ -264,10 +244,10 @@ MuonHoughPattern* MuonHoughTransformer_xyz::hookAssociateHitsToMaximum(const Muo if (houghpattern->size() > 0 && std::abs(std::sin(houghpattern->getEPhi()-phimax)) > 0.05 ) { - if (printlevel>=1){ - std::cout << "MuonHoughTransformer_xyz::ERROR Ephi calc. WRONG" << std::endl; - std::cout << "MuonHoughTransformer_xyz:: histo: radius: " << coordsmaximum.first << " phi: " << phimax << std::endl; - std::cout << "MuonHoughTransformer_xyz:: phi: " << ephi << std::endl; + if (printlevel>=1 || log.level()<=MSG::WARNING){ + log << MSG::WARNING << "MuonHoughTransformer_xyz::ERROR Ephi calc. WRONG" << endmsg; + log << MSG::WARNING << "MuonHoughTransformer_xyz:: histo: radius: " << coordsmaximum.first << " phi: " << phimax << endmsg; + log << MSG::WARNING << "MuonHoughTransformer_xyz:: phi: " << ephi << endmsg; } houghpattern->setEPhi(m_muonhoughmathutils.angleFromMinusPiToPi(phimax)); @@ -277,14 +257,13 @@ MuonHoughPattern* MuonHoughTransformer_xyz::hookAssociateHitsToMaximum(const Muo if (m_ip_setting == false) { houghpattern->updateParametersRPhi(true); // switch off ip constraint! (cosmics==true), on by default (cosmics== false) - if (printlevel>=4) + if (printlevel>=4 || log.level()<=MSG::VERBOSE) { - std::cout << "MuonHoughTransformer_xyz::updateParameterstheta new phi (phi flipped Pi for cosmics): " << houghpattern->getEPhi() << " old phi: " << phimax << std::endl; - std::cout << "MuonHoughTransformer_xyz::updateParameterstheta new r0: " << houghpattern->getERPhi() << " old r0: " << coordsmaximum.first << std::endl; + log << MSG::VERBOSE << "MuonHoughTransformer_xyz::updateParameterstheta new phi (phi flipped Pi for cosmics): " << houghpattern->getEPhi() << " old phi: " << phimax << endmsg; + log << MSG::VERBOSE << "MuonHoughTransformer_xyz::updateParameterstheta new r0: " << houghpattern->getERPhi() << " old r0: " << coordsmaximum.first << endmsg; } } - // std::cout << "MuonHoughTransformer_xyz::hookAssociateHitsToMaximum (end)" << std::endl; return houghpattern; } @@ -292,9 +271,6 @@ float MuonHoughTransformer_xyz::weightHoughTransform (double r0) const { if (m_add_weight_radius==true) { - // return 1./(((r0/m_weight_constant_radius)*r0/m_weight_constant_radius) + 1.); - - return ( 1./(std::abs(r0/m_weight_constant_radius)+1.)); } else {return 1;} // weight function, to give more importance to patterns close to origin diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_yz.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_yz.cxx index ced8f897b972..8c2ca1d8b8a3 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_yz.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent/src/MuonHoughTransformer_yz.cxx @@ -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 */ #include "MuonHoughPatternEvent/MuonHoughTransformer_yz.h" @@ -8,10 +8,6 @@ MuonHoughTransformer_yz::MuonHoughTransformer_yz(int nbins, int nbins_angle, dou { } -MuonHoughTransformer_yz::~MuonHoughTransformer_yz() -{ -} - std::pair <double,double> MuonHoughTransformer_yz::getHitPos(const MuonHoughHitContainer * event, int hitid)const //returns the relevant position of the hit (xy-RPC in case of id_number==id_xy_rpc etc.) { std::pair <double,double> hitpos; -- GitLab From 33cdb8fd7c4bf297278723d0348e2e1c520258a6 Mon Sep 17 00:00:00 2001 From: Apostolos Tsirigotis <apostolos.tsirigotis@cern.ch> Date: Wed, 29 Jan 2020 12:06:42 +0100 Subject: [PATCH 2/2] Some more code cleaning, discarding mutable variables not used, and migrating tools to be private --- .../MuonHoughPatternFinderTool.h | 40 ++++++------- .../MuonHoughPatternTool.h | 48 +++++++-------- .../MuonLayerHoughTool.h | 5 +- .../src/MuonHoughPatternFinderTool.cxx | 48 +-------------- .../src/MuonHoughPatternTool.cxx | 58 +------------------ 5 files changed, 45 insertions(+), 154 deletions(-) diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h index f9ffd433a3fa..f8459c0a4568 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternFinderTool.h @@ -115,52 +115,52 @@ namespace Muon { void addToStationMap(std::map<int,std::vector<std::pair<int, int> > > &stationmap, std::map<int,std::vector<std::pair<int, int> > >::iterator &it, int &stationcode, const int &hit_begin, const int &hit_end) const; - ToolHandle <IMuonHoughPatternTool> m_muonHoughPatternTool; //!< Pointer to concrete tool - mutable ToolHandle <Muon::IMuonCombinePatternTool> m_muonCombinePatternTool; //!< Pointer to concrete tool + ToolHandle <IMuonHoughPatternTool> m_muonHoughPatternTool{this,"muonHoughPatternTool","MuonHoughPatternTool"}; //!< Pointer to concrete tool + mutable ToolHandle <Muon::IMuonCombinePatternTool> m_muonCombinePatternTool{this,"muonCombinePatternTool","MuonCombinePatternTool"}; //!< Pointer to concrete tool ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; //!< Pointer to concrete tool /** ToolHandle for EDM printing of segments */ - ToolHandle<Muon::MuonEDMPrinterTool> m_printer; + ToolHandle<Muon::MuonEDMPrinterTool> m_printer{this,"printerTool","Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}; /** reweight hits (true) */ - bool m_hit_reweights; + Gaudi::Property<bool> m_hit_reweights{this,"HitReweights",true}; /** use adc cut (true) */ - bool m_mdt_adc_cut; + Gaudi::Property<bool> m_mdt_adc_cut{this,"MDT_ADC_cut",true}; /** value of adc cut (50) */ - int m_mdt_adc_min; + Gaudi::Property<int> m_mdt_adc_min{this,"MDT_ADC_value",50}; /** use tdc cut (false) */ - bool m_mdt_tdc_cut; + Gaudi::Property<bool> m_mdt_tdc_cut{this,"MDT_TDC_cut",true}; /** use rpc preprawdata (true) */ - bool m_use_rpc; + Gaudi::Property<bool> m_use_rpc{this,"RPC",true}; /** use tgc preprawdata (true) */ - bool m_use_tgc; + Gaudi::Property<bool> m_use_tgc{this,"TGC",true}; /** use csc preprawdata (true) */ - bool m_use_csc; + Gaudi::Property<bool> m_use_csc{this,"CSC",true}; /** use mdt preprawdata (true) */ - bool m_use_mdt; + Gaudi::Property<bool> m_use_mdt{this,"MDT",true}; /** use weight for csc segments */ double m_weight_csc_on_segment; /** reduce cpu for showers (true) */ - bool m_showerskip; + Gaudi::Property<bool> m_showerskip{this,"ShowerSkipping",true}; /** percentage of occupancy to skip MDT chamber (0.3) */ - double m_showerskipperc; + Gaudi::Property<double> m_showerskipperc{this,"ShowerSkipPercentage",0.3}; /** flag to output a root file to study the weights of hits */ - bool m_use_histos; + Gaudi::Property<bool> m_use_histos{this,"UseHistos",false}; /** flag to print out a summary of what comes in and what comes out */ - bool m_summary; + Gaudi::Property<bool> m_summary{this,"DoSummary",false}; /** flag to write out intermediate patterns */ - bool m_recordAllOutput; + Gaudi::Property<bool> m_recordAllOutput{this,"RecordAll",false}; /** map for association between (csc) hits and their segments (only used when m_use_csc_segments is true), used for writing out a MuonSegPatAssMap */ mutable std::map <const Trk::PrepRawData*, const Muon::MuonSegmentCombination*> m_cschitsegassociation; /** storegate location for csc association map */ - std::string m_cscAssoOutputLocation; + Gaudi::Property<std::string> m_cscAssoOutputLocation{this,"PatCscSegAssMapOutputLocation","MuonPatCscSegAssMap"}; //Not used /** pointer to the CSC segment combination collection */ // const MuonSegmentCombinationCollection* m_csc_segments; @@ -181,9 +181,9 @@ namespace Muon { /** csc histogram */ TH1F* m_weighthistogramcsc; - SG::WriteHandleKey<MuonPrdPatternCollection> m_CosmicPhiPatternsKey; - SG::WriteHandleKey<MuonPrdPatternCollection> m_CosmicEtaPatternsKey; - SG::WriteHandleKey<MuonPrdPatternCollection> m_COMBINED_PATTERNSKey; + SG::WriteHandleKey<MuonPrdPatternCollection> m_CosmicPhiPatternsKey{this,"CosmicPhiKey","CosmicPhiPatterns"}; + SG::WriteHandleKey<MuonPrdPatternCollection> m_CosmicEtaPatternsKey{this,"CosmicEtaPatterns","CosmicEtaPatterns"}; + SG::WriteHandleKey<MuonPrdPatternCollection> m_COMBINED_PATTERNSKey{this,"PATTERNS","COMBINED_PATTERNS"}; }; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternTool.h index 67f1258f1cf8..17038c7b734b 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonHoughPatternTool.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 */ #ifndef MUONHOUGHPATTERNTOOLS_MUONHOUGHPATTERNTOOL_H @@ -49,8 +49,6 @@ class MuonHoughPatternTool : virtual public IMuonHoughPatternTool, public AthAlg /** resets members, called once per event */ void reset() const; - /** initiates members, called once per event */ - void init() const; /** reset association flag of hits in m_event */ void resetAssociation() const; @@ -161,33 +159,27 @@ class MuonHoughPatternTool : virtual public IMuonHoughPatternTool, public AthAlg /** the original hit container */ mutable const MuonHoughHitContainer* m_event; - /** number of patterns build per id*/ - mutable std::vector <int> m_npatterns; // number_of_ids - /** reconstructed patterns stored per [number_of_ids][level][which_segment] */ mutable MuonHoughPatternContainerShip m_houghpattern; - /** hough histograms for visualisation in root stored per id */ - mutable std::vector <TH2F*> m_h_histogram; - /** output histograms (false) */ - bool m_use_histos; + Gaudi::Property<bool> m_use_histos{this,"UseHistos",false}; /** use cosmic settings (false) */ - bool m_use_cosmics; + Gaudi::Property<bool> m_use_cosmics{this,"UseCosmics",false}; /** use csc hits in association / pattern (true) */ - bool m_use_csc_in_pattern; + Gaudi::Property<bool> m_use_csc_in_pattern{this,"UseCscInPattern",true}; /** use csc hits in histogram (false) */ - bool m_use_csc_in_hough; + Gaudi::Property<bool> m_use_csc_in_hough{this,"UseCscInHough",true}; /** use negative weights (false) */ - bool m_use_negative_weights; + Gaudi::Property<bool> m_use_negative_weights{this,"UseNegativeWeights",false}; /** use curved hough transformation for eta patterns (true) */ - bool m_use_curvedhough; + Gaudi::Property<bool> m_use_curvedhough{this,"UseCurvedHough",true}; /** number of hough transforms currently supported (7) */ int m_number_of_ids; /** number of iterations (5) */ - int m_number_of_maxima; + Gaudi::Property<int> m_number_of_maxima{this,"NumberOfMaximaPerIterations",5}; /** use rpc phi strips in phi-patterns (true) */ //const bool m_use_rpc_measures_phi; @@ -197,9 +189,9 @@ class MuonHoughPatternTool : virtual public IMuonHoughPatternTool, public AthAlg bool m_use_ip; /** minimal size for a phi pattern (1) */ - unsigned int m_thresholdpattern_xyz; + Gaudi::Property<unsigned int> m_thresholdpattern_xyz{this,"SetThresholdPatternRPhi",1}; /** minimal size for a eta pattern (3) */ - unsigned int m_thresholdpattern_rz; + Gaudi::Property<unsigned int> m_thresholdpattern_rz{this,"SetThresholdPatternREta",3}; // hittosegment association: @@ -285,36 +277,36 @@ class MuonHoughPatternTool : virtual public IMuonHoughPatternTool, public AthAlg const int m_nbins_curved; /** weight_cut for hits in hough */ - bool m_weightcut; + Gaudi::Property<bool> m_weightcut{this,"ApplyWeightCut",true}; /** value of weight cut */ - double m_weight; + Gaudi::Property<double> m_weight{this,"WeightCut",0.25}; // cut all hits under 0.25 /** weight_cut for mdt hits in hough */ - bool m_weightcutmdt; + Gaudi::Property<bool> m_weightcutmdt{this,"ApplyWeightCutMdt",true}; // cut all mdt hits under a certain weight (dependent on number of mdt hits in event /** value of mdt weight cut, dependent on # hits in event */ mutable double m_weightmdt; /** threshold histogram in xyz */ - double m_thresholdhisto_xyz; + Gaudi::Property<double> m_thresholdhisto_xyz{this,"SetThresholdHistoRPhi",0.9}; /** threshold histogram in rz */ - double m_thresholdhisto_rz; + Gaudi::Property<double> m_thresholdhisto_rz{this,"SetThresholdHistoREta",2.1}; /** number of sectors (different regions in which patterns can be found in the same iteration) in xyz */ - int m_number_of_sectors_xyz; + Gaudi::Property<int> m_number_of_sectors_xyz{this,"SetNumberOfSectorsRPhi",12}; /** number of sectors (different regions in which patterns can be found in the same iteration) in rz */ - int m_number_of_sectors_rz; + Gaudi::Property<int> m_number_of_sectors_rz{this,"SetNumberOfSectorsREta",16}; /** number of sectors (different regions in which patterns can be found in the same iteration) in rzcosmics */ int m_number_of_sectors_rz_cosmics; /** output level (range 0-10) (default 0) */ - int m_printlevel; + Gaudi::Property<int> m_printlevel{this,"Printlevel",0}; - mutable int m_ncalls; + mutable std::atomic_uint m_ncalls{0}; /** maximum number of phi hits to do pattern recognition, if small zero no cut is applied */ - int m_maxNumberOfPhiHits; + Gaudi::Property<int> m_maxNumberOfPhiHits{this,"MaximumNumberOfPhiHits",-1}; /** print out pattern hits */ void printPattern(Muon::MuonPrdPattern* muonpattern)const; diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h index b25af5434d45..d997a7c7a9db 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/MuonHoughPatternTools/MuonLayerHoughTool.h @@ -135,8 +135,11 @@ namespace Muon { const std::vector<const TgcPrepDataCollection*>& tgcCols, const std::vector<const RpcPrepDataCollection*>& rpcCols, const MuonSegmentCombinationCollection* ) const override; + void reset() const; + private: + void getSectors( const Amg::Vector3D& pos, std::vector<int>& sectors ) const; void getSectors( const TgcClusterObj3D& tgc, std::vector<int>& sectors ) const; @@ -147,8 +150,6 @@ namespace Muon { int sublay( const Identifier& id, float z = 0 ) const; // the z value is only used for the tgcs - private: - struct State { MaximumVec seedMaxima; // Does not own the contained objects, they're just references to objects stored in houghDataPerSectorVec. std::unique_ptr<HoughDataPerSectorVec> houghDataPerSectorVec { std::make_unique<HoughDataPerSectorVec>() }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx index 904fcb072f2f..dd804188c4b5 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx @@ -47,56 +47,10 @@ namespace Muon { MuonHoughPatternFinderTool::MuonHoughPatternFinderTool(const std::string& t,const std::string& n,const IInterface* p) : AthAlgTool(t,n,p), - m_muonHoughPatternTool("MuonHoughPatternTool"), - m_muonCombinePatternTool("MuonCombinePatternTool", this), - m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_hit_reweights(true), - m_mdt_adc_cut(true), - m_mdt_adc_min(50), - m_mdt_tdc_cut(true), - m_use_rpc(true), - m_use_tgc(true), - m_use_csc(true), - m_use_mdt(true), m_weight_csc_on_segment(2.), - m_showerskip(true), - m_showerskipperc(0.3), - m_use_histos(false), - m_summary(false), - m_recordAllOutput(false), - m_cscAssoOutputLocation("MuonPatCscSegAssMap"), - m_phietahitassociation(0), - m_CosmicPhiPatternsKey("CosmicPhiPatterns"), - m_CosmicEtaPatternsKey("CosmicEtaPatterns"), - m_COMBINED_PATTERNSKey("COMBINED_PATTERNS") + m_phietahitassociation(0) { declareInterface<IMuonHoughPatternFinderTool>(this); - - declareProperty("muonHoughPatternTool",m_muonHoughPatternTool); - declareProperty("muonCombinePatternTool",m_muonCombinePatternTool); - - declareProperty("HitReweights",m_hit_reweights); - declareProperty("MDT_ADC_cut",m_mdt_adc_cut); - declareProperty("MDT_TDC_cut",m_mdt_tdc_cut); - - declareProperty("MDT_ADC_value",m_mdt_adc_min); - - declareProperty("RPC",m_use_rpc); - declareProperty("TGC",m_use_tgc); - declareProperty("CSC",m_use_csc); - declareProperty("MDT",m_use_mdt); - - declareProperty("ShowerSkipping",m_showerskip); - declareProperty("ShowerSkipPercentage",m_showerskipperc); - - declareProperty("PatCscSegAssMapOutputLocation",m_cscAssoOutputLocation);//Not used - declareProperty("UseHistos",m_use_histos); - declareProperty("DoSummary",m_summary); - declareProperty("RecordAll",m_recordAllOutput); - - declareProperty("CosmicPhiKey", m_CosmicPhiPatternsKey); - declareProperty("CosmicEtaPatterns", m_CosmicEtaPatternsKey); - declareProperty("COMBINED_PATTERNS", m_COMBINED_PATTERNSKey); } StatusCode MuonHoughPatternFinderTool::initialize() diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternTool.cxx index a59be0446400..ad0e3a8a33bd 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternTool.cxx @@ -28,12 +28,9 @@ MuonHoughPatternTool::MuonHoughPatternTool(const std::string& type, const std::string& name, const IInterface* parent): AthAlgTool(type,name,parent), m_number_of_ids(7), - m_number_of_maxima(5), //m_use_rpc_measures_phi(true), m_use_rpc_measures_eta(true), m_use_ip(false), - m_thresholdpattern_xyz(1), - m_thresholdpattern_rz(3), m_maximum_residu_mm(500.), m_maximum_residu_mm_cosmics(2000.), m_maximum_residu_angle(3.), @@ -64,13 +61,7 @@ MuonHoughPatternTool::MuonHoughPatternTool(const std::string& type, const std::s //m_stepsize_per_inv_sqrt_curvature(0.001), m_nbins_curved(160), m_weightmdt(0.), - m_thresholdhisto_xyz(0.9), - m_thresholdhisto_rz(2.1), - m_number_of_sectors_xyz(12), - m_number_of_sectors_rz(16), - m_number_of_sectors_rz_cosmics(12), - m_printlevel(0), - m_ncalls(0) + m_number_of_sectors_rz_cosmics(12) { declareInterface<IMuonHoughPatternTool>(this); @@ -79,38 +70,7 @@ MuonHoughPatternTool::MuonHoughPatternTool(const std::string& type, const std::s m_detectorsize_xy = m_detectorsize_xy_full; m_detectorsize_yz = m_detectorsize_yz_full; m_detectorsize_rz = m_detectorsize_rz_full; - - m_use_csc_in_hough = true; - m_use_csc_in_pattern = true; - m_use_curvedhough = true; - m_use_negative_weights = false; - m_use_cosmics = false; - m_use_histos = false; - - declareProperty("UseCosmics",m_use_cosmics); - declareProperty("SetThresholdHistoRPhi",m_thresholdhisto_xyz); - declareProperty("SetThresholdHistoREta",m_thresholdhisto_rz); - - declareProperty("SetThresholdPatternRPhi",m_thresholdpattern_xyz); - declareProperty("SetThresholdPatternREta",m_thresholdpattern_rz); - - declareProperty("SetNumberOfSectorsRPhi",m_number_of_sectors_xyz); - declareProperty("SetNumberOfSectorsREta",m_number_of_sectors_rz); - - declareProperty("UseCscInPattern", m_use_csc_in_pattern); - declareProperty("UseCscInHough", m_use_csc_in_hough); - declareProperty("UseNegativeWeights",m_use_negative_weights); - declareProperty("UseCurvedHough",m_use_curvedhough); - declareProperty("NumberOfMaximaPerIterations",m_number_of_maxima); - - declareProperty("ApplyWeightCut",m_weightcut = true); - declareProperty("WeightCut",m_weight = 0.25); // cut all hits under 0.25 - declareProperty("ApplyWeightCutMdt",m_weightcutmdt = true); // cut all mdt hits under a certain weight (dependent on number of mdt hits in event - - declareProperty("UseHistos",m_use_histos); - declareProperty("Printlevel",m_printlevel); - declareProperty("MaximumNumberOfPhiHits",m_maxNumberOfPhiHits = -1 ); } MuonHoughPatternTool::~MuonHoughPatternTool() @@ -135,7 +95,6 @@ void MuonHoughPatternTool::makePatterns(const MuonHoughHitContainer* hitcontaine m_event = hitcontainer; /** empty and reinitialize the houghpattern vectors */ reset(); - init(); /** skip cosmic events that have more than 1000 phi hits */ if (m_use_cosmics == true && m_maxNumberOfPhiHits >= 0 ) { @@ -279,7 +238,6 @@ void MuonHoughPatternTool::makePatterns(int id_number) const StatusCode MuonHoughPatternTool::initialize() { - init(); m_houghpattern=emptyHoughPattern(); if (m_use_histos == true) // debug histos @@ -317,15 +275,6 @@ StatusCode MuonHoughPatternTool::initialize() return sc; } -void MuonHoughPatternTool::init() const -{ - ATH_MSG_VERBOSE("init()"); - - // m_houghpattern=emptyHoughPattern(); - m_npatterns= std::vector<int> (m_number_of_ids); - -} - void MuonHoughPatternTool::resetAssociation() const { for (unsigned int i=0; i<m_event->size(); i++) @@ -461,11 +410,6 @@ bool MuonHoughPatternTool::analyseHisto(int id_number,int level,const MuonHoughH if (houghpattern->empty()) {ATH_MSG_DEBUG("houghpattern==0");} - else - { - m_npatterns[id_number]++; - } // houghpattern.size() !=0 - // some print statements if (houghpattern->size()<numberofmaxima){ -- GitLab