From e0462627b9eaaa8833189d420f33c658a713c0b2 Mon Sep 17 00:00:00 2001
From: Bernard Brickwedde <bernard.brickwedde@cern.ch>
Date: Thu, 30 Apr 2020 10:53:18 +0200
Subject: [PATCH] following styleguides, declare properties in h file, removed
 empty constructor, use nullptr where appropriate

---
 .../MuonTrackMonitorAlgorithm.h               | 90 +++++++++----------
 .../src/MuonTrackMonitorAlgorithm.cxx         | 72 ++++++---------
 2 files changed, 68 insertions(+), 94 deletions(-)

diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h
index 3a4c99732e9..490d556f16f 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h
@@ -7,11 +7,11 @@
 #define MUON_TRACKALGORITHM_H
 
 #include "AthenaMonitoring/AthMonitorAlgorithm.h"
-#include "AthenaMonitoringKernel/Monitored.h"
 
 #include "xAODMuon/MuonContainer.h"
-#include "xAODMuon/MuonAuxContainer.h"
-#include <memory>
+#include <vector>
+#include <string>
+#include "StoreGate/ReadHandleKey.h"
 
 // AthMonitorAlgorithm
 class MuonTrackMonitorAlgorithm : public AthMonitorAlgorithm
@@ -19,57 +19,51 @@ class MuonTrackMonitorAlgorithm : public AthMonitorAlgorithm
 
   public:
 
-    MuonTrackMonitorAlgorithm(const std::string& name, ISvcLocator* svcLocator);
+    MuonTrackMonitorAlgorithm(const std::string& name, ISvcLocator* pSvcLocator);
 
-    virtual ~MuonTrackMonitorAlgorithm();
+    virtual ~MuonTrackMonitorAlgorithm() {};
     virtual StatusCode initialize() override;
     virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
 
   private:
 
-    SG::ReadHandleKey<xAOD::MuonContainer> m_MuonContainerKey
-      { this, "MuonContainerKey", "Muons", "Key for Muon Containers" };
-
-	// Toolds
-	/// Fills data-quality information (e.g. pt, eta, phi..) to histograms for given selection of muons
-	/// std::string sIdentifier = "CB","ZBoson","JPsi": String which is used to match the histogramming
-	///    variables that are defined by the Python script
-	/// std::vector<const xAOD::Muon*>	&vecMuons: Vector of muons for which performance plots should be created
-	StatusCode	FillMuonInformation(std::string sIdentifier, std::vector<const xAOD::Muon*>	&vecMuons) const;
-
-	/// Function to create performance plots for muon standalone tracks with some detailed informatiom
-	StatusCode	analyseLowLevelMuonFeatures(const xAOD::MuonContainer* Muons, int lumiBlockID) const;
-
-	/// Function to create performance plots for all combined muons
-	StatusCode	analyseCombinedTracks(const xAOD::MuonContainer* Muons, int lumiBlockID) const;
-
-	/// Function to create performance plots for all combined muons that lead to a Z Boson Candidate event
-	StatusCode	analyseZBosonCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const;
-
-	/// Function to create performance plots for all combined muons that lead to a JPsi Meson Candidate event
-	StatusCode	analyseJPsiCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const;
-
-    // Define configurable cuts to Select Z Bosons
-    float 						m_ZBosonSelection_minPt;
-    float 						m_ZBosonSelection_maxEta;
-    float 						m_ZBosonSelection_trkIsolation;
-    float 						m_ZBosonSelection_D0Cut;
-    float 						m_ZBosonSelection_Z0Cut;
-    float 						m_ZBosonSelection_minMass;
-    float 						m_ZBosonSelection_maxMass;
-
-    // Define configurable cuts to Select JPsi Mesons
-    float 						m_JPsiSelection_minPt;
-    float 						m_JPsiSelection_maxEta;
-    float 						m_JPsiSelection_trkIsolation;
-    float 						m_JPsiSelection_D0Cut;
-    float 						m_JPsiSelection_Z0Cut;
-    float 						m_JPsiSelection_minMass;
-    float 						m_JPsiSelection_maxMass;
-
-	// Define which Triggers should be checked
-    std::vector<std::string> 	m_hltchainList;
-    
+    SG::ReadHandleKey<xAOD::MuonContainer> m_MuonContainerKey { this, "MuonContainerKey", "Muons", "Key for Muon Containers" };
+
+    // Toolds
+    /// Fills data-quality information (e.g. pt, eta, phi..) to histograms for given selection of muons
+    /// std::string sIdentifier = "CB","ZBoson","JPsi": String which is used to match the histogramming
+    ///    variables that are defined by the Python script
+    /// std::vector<const xAOD::Muon*>	&vecMuons: Vector of muons for which performance plots should be created
+    StatusCode	FillMuonInformation(std::string sIdentifier, std::vector<const xAOD::Muon*>	&vecMuons) const;
+
+    /// Function to create performance plots for muon standalone tracks with some detailed informatiom
+    StatusCode analyseLowLevelMuonFeatures(const xAOD::MuonContainer* Muons, int lumiBlockID) const;
+
+    /// Function to create performance plots for all combined muons
+    StatusCode analyseCombinedTracks(const xAOD::MuonContainer* Muons, int lumiBlockID) const;
+
+    /// Function to create performance plots for all combined muons that lead to a Z Boson Candidate event
+    StatusCode analyseZBosonCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const;
+
+    /// Function to create performance plots for all combined muons that lead to a JPsi Meson Candidate event
+    StatusCode analyseJPsiCandidates(const xAOD::MuonContainer* Muons, int lumiBlockID) const;
+
+    Gaudi::Property< std::vector<std::string> > m_hltchainList{ this, "HLTTriggerList", {"HLT_2mu14", "HLT_mu26_ivarmedium"}, "High-level triggers used" };
+    Gaudi::Property< float > m_ZBosonSelection_minPt{ this, "ZBosonSelection_minPt", 20000., "Minimal muon pt used for Z analysis" };
+    Gaudi::Property< float > m_ZBosonSelection_maxEta{ this, "ZBosonSelection_maxEta", 2.5, "Maximal muon eta used for Z analysis" };
+    Gaudi::Property< float > m_ZBosonSelection_trkIsolation{ this, "ZBosonSelection_trkIsolation", 0.2, "Track DeltaR isolation criteria" };
+    Gaudi::Property< float > m_ZBosonSelection_D0Cut{ this, "ZBosonSelection_D0Cut", 100., "D0 cut applied for Z boson analysis" };
+    Gaudi::Property< float > m_ZBosonSelection_Z0Cut{ this, "ZBosonSelection_Z0Cut", 100., "Z0 cut applied for Z boson analysis" };
+    Gaudi::Property< float > m_ZBosonSelection_minMass{ this, "ZBosonSelection_minMass", 76000., "Minimal accepted Z  boson mass" };
+    Gaudi::Property< float > m_ZBosonSelection_maxMass{ this, "ZBosonSelection_maxMass", 106000., "Maximal accepted Z  boson mass" };
+
+    Gaudi::Property< float > m_JPsiSelection_minPt{ this, "JPsiSelection_minPt", 4000., "Minimal muon pt used for JPsi analysis" };
+    Gaudi::Property< float > m_JPsiSelection_maxEta{ this, "JPsiSelection_maxEta", 2.5, "Maximal muon eta used for JPsi analysis" };
+    Gaudi::Property< float > m_JPsiSelection_trkIsolation{ this, "JPsiSelection_trkIsolation", 1.0, "JPsi track DeltaR isolation criteria" };
+    Gaudi::Property< float > m_JPsiSelection_D0Cut{ this, "JPsiSelection_D0Cut", 100., "D0 cut applied for JPsi analysis" };
+    Gaudi::Property< float > m_JPsiSelection_Z0Cut{ this, "JPsiSelection_Z0Cut", 100., "Z0 cut applied for JPsi analysis" };
+    Gaudi::Property< float > m_JPsiSelection_minMass{ this, "JPsiSelection_minMass", 2600., "Minimal accepted JPsi mass" };
+    Gaudi::Property< float > m_JPsiSelection_maxMass{ this, "JPsiSelection_maxMass", 3600., "Maximal accepted JPsi mass" };
 };
 
 
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.cxx
index 606087cae67..fa9f34efa6a 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonTrackMonitorAlgorithm.cxx
@@ -5,29 +5,9 @@
 
 #include "MuonTrackMonitoring/MuonTrackMonitorAlgorithm.h"
 
-using namespace std;
 //========================================================================================================
 MuonTrackMonitorAlgorithm::MuonTrackMonitorAlgorithm (const std::string& name, ISvcLocator* pSvcLocator)
-	:AthMonitorAlgorithm(name,pSvcLocator)
-{
-	//	Declare the properties
-	declareProperty( "HLTTriggerList", m_hltchainList= {"HLT_2mu14", "HLT_mu26_ivarmedium"});
-	declareProperty("ZBosonSelection_minPt", 		m_ZBosonSelection_minPt = 20000.);
-	declareProperty("ZBosonSelection_maxEta", 		m_ZBosonSelection_maxEta = 2.5);
-	declareProperty("ZBosonSelection_trkIsolation", m_ZBosonSelection_trkIsolation = 0.2);
-	declareProperty("ZBosonSelection_D0Cut", 		m_ZBosonSelection_D0Cut = 100.);
-	declareProperty("ZBosonSelection_Z0Cut", 		m_ZBosonSelection_Z0Cut = 100.);
-	declareProperty("ZBosonSelection_minMass", 		m_ZBosonSelection_minMass = 76000.);
-	declareProperty("ZBosonSelection_maxMass", 		m_ZBosonSelection_maxMass = 106000.);
-
-	declareProperty("JPsiSelection_minPt", 			m_JPsiSelection_minPt = 4000.);
-	declareProperty("JPsiSelection_maxEta", 		m_JPsiSelection_maxEta = 2.5);
-	declareProperty("JPsiSelection_trkIsolation", 	m_JPsiSelection_trkIsolation = 1.0);
-	declareProperty("JPsiSelection_D0Cut", 			m_JPsiSelection_D0Cut = 100.);
-	declareProperty("JPsiSelection_Z0Cut", 			m_JPsiSelection_Z0Cut = 100.);
-	declareProperty("JPsiSelection_minMass", 		m_JPsiSelection_minMass = 2600.);
-	declareProperty("JPsiSelection_maxMass", 		m_JPsiSelection_maxMass = 3600.);
-}
+    :AthMonitorAlgorithm(name,pSvcLocator){}
 
 
 //========================================================================================================
@@ -38,7 +18,7 @@ StatusCode MuonTrackMonitorAlgorithm::initialize()
 }
 
 //========================================================================================================
-StatusCode	MuonTrackMonitorAlgorithm::FillMuonInformation(std::string sIdentifier, std::vector<const xAOD::Muon*>	&vecMuons) const 
+StatusCode MuonTrackMonitorAlgorithm::FillMuonInformation(std::string sIdentifier, std::vector<const xAOD::Muon*>	&vecMuons) const 
 {
 	/// Declaring all variables that are initialized via Python will be plotted
 	using namespace Monitored;
@@ -62,18 +42,18 @@ StatusCode	MuonTrackMonitorAlgorithm::FillMuonInformation(std::string sIdentifie
 
 	/// Loop over all Muons
 	for(unsigned int n=0; n<vecMuons.size(); n++) {
-		const xAOD::Muon*	muon = vecMuons[n];
-		xAOD::Muon::MuonType	muonType	=	muon->muonType();
-		xAOD::Muon::Quality		muonQuality	=	muon->quality();
+		const xAOD::Muon* muon = vecMuons[n];
+		xAOD::Muon::MuonType muonType = muon->muonType();
+		xAOD::Muon::Quality muonQuality	= muon->quality();
 
 		if (muonType==xAOD::Muon::Combined) {
-			const xAOD::TrackParticle *cbtp=0;
-			const xAOD::TrackParticle *idtp=0;
-			const xAOD::TrackParticle *mstp=0;
+			const xAOD::TrackParticle *cbtp = nullptr;
+			const xAOD::TrackParticle *idtp = nullptr;
+			const xAOD::TrackParticle *mstp = nullptr;
 
 			ElementLink<xAOD::TrackParticleContainer> cbtpLink = muon->combinedTrackParticleLink();
 			if (cbtpLink.isValid()) cbtp = *cbtpLink;
-			if (cbtp != NULL) {
+			if (cbtp) {
 				uint8_t hitval_numberOfBLayerHits, hitval_numberOfPixelHits, hitval_numberOfSCTHits, hitval_numberOfTRTHits;
 				//	uint8_t hitval_innerSmallHits, hitval_innerLargeHits, hitval_middleSmallHits, hitval_middleLargeHits, hitval_outerSmallHits, hitval_outerLargeHits;
 				cbtp->summaryValue(hitval_numberOfBLayerHits,	xAOD::SummaryType::numberOfInnermostPixelLayerHits);
@@ -113,7 +93,7 @@ StatusCode	MuonTrackMonitorAlgorithm::FillMuonInformation(std::string sIdentifie
 				ElementLink<xAOD::TrackParticleContainer> mstpLink = muon->muonSpectrometerTrackParticleLink();
 				if (idtpLink.isValid()) idtp = *idtpLink;
 				if (mstpLink.isValid()) mstp = *mstpLink;
-				if ((idtp != NULL) && (mstp != NULL)) {
+				if (idtp && mstp) {
 					MuonDPTIDME 	= (idtp->pt() - mstp->pt()) / idtp->pt();
 					MuonsIDChi2NDF 	= idtp->chiSquared()/idtp->numberDoF();
 					MuonsMEChi2NDF 	= mstp->chiSquared()/mstp->numberDoF();	
@@ -218,7 +198,7 @@ StatusCode	MuonTrackMonitorAlgorithm::analyseCombinedTracks(const xAOD::MuonCont
 			fill(tool, CBMuonLumiBlock);
 
 			vecCombinedMuons.push_back(muon);
-			if (muon->pt()>20000.) vecCombinedMuonsHighPT.push_back(muon);
+			if (muon->pt() > m_ZBosonSelection_minPt) vecCombinedMuonsHighPT.push_back(muon);
 
 			/// Provide Segment and Sector Plots
 			for (size_t nSeg=0; nSeg<muon->nMuonSegments();nSeg++) {
@@ -281,22 +261,22 @@ StatusCode	MuonTrackMonitorAlgorithm::analyseZBosonCandidates(const xAOD::MuonCo
 	
 	/// Select Muons Relevant for Z
 	for(const auto& muon : *Muons) {
-		xAOD::Muon::MuonType	muonType	=	muon->muonType();
+		xAOD::Muon::MuonType muonType = muon->muonType();
 		if (muonType==xAOD::Muon::Combined) {
-			const xAOD::TrackParticle *cbtp=0;
+			const xAOD::TrackParticle *cbtp = nullptr;
 			ElementLink<xAOD::TrackParticleContainer> cbtpLink = muon->combinedTrackParticleLink();
 			if (cbtpLink.isValid()) cbtp = *cbtpLink;
 
 			/// Select Z Boson
-			if (cbtp != NULL) {
+			if (cbtp) {
 				float trkiso  = muon->isolation(xAOD::Iso::ptcone30)/muon->pt();
 				if (muonType==xAOD::Muon::Combined &&
-					cbtp!=NULL &&
+					cbtp &&
 					muon->pt()>m_ZBosonSelection_minPt &&
-					fabs(muon->eta())<m_ZBosonSelection_maxEta &&
+					std::abs(muon->eta())<m_ZBosonSelection_maxEta &&
 					trkiso<m_ZBosonSelection_trkIsolation &&
-					fabs(cbtp->z0())<m_ZBosonSelection_Z0Cut &&
-					fabs(cbtp->d0())<m_ZBosonSelection_D0Cut )
+					std::abs(cbtp->z0())<m_ZBosonSelection_Z0Cut &&
+					std::abs(cbtp->d0())<m_ZBosonSelection_D0Cut )
 						vecMuons_ZBoson_Candidates.push_back(muon);
 			}
 		}
@@ -362,20 +342,20 @@ StatusCode	MuonTrackMonitorAlgorithm::analyseJPsiCandidates(const xAOD::MuonCont
 	for(const auto& muon : *Muons) {
 		xAOD::Muon::MuonType	muonType	=	muon->muonType();
 		if (muonType==xAOD::Muon::Combined) {
-			const xAOD::TrackParticle *cbtp=0;
+			const xAOD::TrackParticle *cbtp = nullptr;
 			ElementLink<xAOD::TrackParticleContainer> cbtpLink = muon->combinedTrackParticleLink();
 			if (cbtpLink.isValid()) cbtp = *cbtpLink;
 
 			/// Do Combined Muon Plots
-			if (cbtp != NULL) {
+			if (cbtp) {
 				float trkiso  = muon->isolation(xAOD::Iso::ptcone30)/muon->pt();
 				if (muonType==xAOD::Muon::Combined &&
-					cbtp!=NULL &&
+					cbtp &&
 					muon->pt()>m_JPsiSelection_minPt &&
-					fabs(muon->eta())<m_JPsiSelection_maxEta &&
+					std::abs(muon->eta())<m_JPsiSelection_maxEta &&
 					trkiso<m_JPsiSelection_trkIsolation &&
-					fabs(cbtp->z0())<m_JPsiSelection_Z0Cut &&
-					fabs(cbtp->d0())<m_JPsiSelection_D0Cut )
+					std::abs(cbtp->z0())<m_JPsiSelection_Z0Cut &&
+					std::abs(cbtp->d0())<m_JPsiSelection_D0Cut )
 						vecMuons_JPsi_Candidates.push_back(muon);
 			}
 		}
@@ -427,11 +407,11 @@ StatusCode MuonTrackMonitorAlgorithm::fillHistograms(const EventContext& ctx) co
 	auto run = Monitored::Scalar<int>("run", 0);
 	run = GetEventInfo(ctx)->runNumber();
 	
-	const xAOD::EventInfo* eventInfo=nullptr;
+	const xAOD::EventInfo* eventInfo = nullptr;
 	ATH_CHECK(evtStore()->retrieve(eventInfo));
 	int lumiBlockID = (int)eventInfo->lumiBlock();
 
-	const xAOD::MuonContainer* Muons=nullptr;
+	const xAOD::MuonContainer* Muons = nullptr;
 	ATH_CHECK(evtStore()->retrieve(Muons, "Muons"));
 
 	ATH_CHECK( analyseLowLevelMuonFeatures(Muons, lumiBlockID) );
-- 
GitLab