diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx index e706b0081e1192924dda4912611b6273ea4c970d..b94293e21703dc3684b9dfed072b58aa251c2a66 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx @@ -61,7 +61,10 @@ MuonPhysValMonitoringTool::MuonPhysValMonitoringTool( const std::string& type, const IInterface* parent ): ManagedMonitorToolBase( type, name, parent ), m_MSTracks(nullptr), - m_isData(false), + m_counterBits(), + m_muonItems(), + m_L1Seed(), + m_SelectedAuthor(0), m_muonSelectionTool("CP::MuonSelectionTool/MuonSelectionTool"), m_muonPrinter("Rec::MuonPrintingTool/MuonPrintingTool"), m_trigDec("Trig::TrigDecisionTool/TrigDecisionTool"), @@ -75,18 +78,7 @@ MuonPhysValMonitoringTool::MuonPhysValMonitoringTool( const std::string& type, m_h_overview_Z_mass_ME(nullptr), m_h_overview_Z_mass_ID(nullptr) { - // default for muon chains declareProperty( "TrackSelector", m_trackSelector); - declareProperty( "IsoTool", m_isoTool ); - - declareProperty( "SelectMuonWorkingPoints", m_selectMuonWPs); - declareProperty( "SelectMuonAuthors", m_selectMuonAuthors); - declareProperty( "SelectHLTMuonItems", m_selectHLTMuonItems); - declareProperty( "SelectL1MuonItems", m_L1MuonItems); - declareProperty( "SelectMuonCategories", m_selectMuonCategories ); - declareProperty( "DoBinnedResolutionPlots", m_doBinnedResolutionPlots = true); - - m_SelectedAuthor = 0; } // Athena algtool's Hooks @@ -112,12 +104,6 @@ StatusCode MuonPhysValMonitoringTool::initialize() m_doTrigMuonL2Validation = false; m_doTrigMuonEFValidation = false; } - if (m_isData) { - m_selectMuonCategories.clear(); - m_selectMuonCategories.push_back(ALL); - m_selectMuonCategories.push_back(PROMPT); - m_selectMuonCategories.push_back(REST); - } ATH_CHECK(m_eventInfo.initialize()); ATH_CHECK(m_muonSelectionTool.retrieve()); @@ -174,22 +160,9 @@ StatusCode MuonPhysValMonitoringTool::bookHistograms() { ATH_MSG_INFO ("Booking hists " << name() << "..."); - if (m_selectMuonWPs.size()==0) { - int defaultWPList[]={xAOD::Muon::Loose,xAOD::Muon::Medium}; - for (const auto wp : defaultWPList) m_selectMuonWPs.push_back(wp); - } - else if (m_selectMuonWPs.size()==1 && m_selectMuonWPs[0]<0 ) m_selectMuonWPs.clear(); + if (m_selectMuonWPs.size()==1 && m_selectMuonWPs[0]<0 ) m_selectMuonWPs.clear(); - if (m_selectMuonAuthors.size()==0) { - unsigned int defaultAuthorList[]={xAOD::Muon::MuidCo,xAOD::Muon::MuTagIMO,xAOD::Muon::MuidSA,xAOD::Muon::MuGirl,xAOD::Muon::CaloTag,xAOD::Muon::CaloLikelihood}; - for (const auto author : defaultAuthorList) m_selectMuonAuthors.push_back(author); - } - else if (m_selectMuonAuthors.size()==1 && m_selectMuonAuthors[0]==0) m_selectMuonAuthors.clear(); - - if (m_selectMuonCategories.size()==0) { - unsigned int defaultMuonCategories[]={ ALL, PROMPT, INFLIGHT, NONISO, REST }; - for (const auto category: defaultMuonCategories) m_selectMuonCategories.push_back(category); - } + if (m_selectMuonAuthors.size()==1 && m_selectMuonAuthors[0]==0) m_selectMuonAuthors.clear(); std::string theMuonCategories[5]; theMuonCategories[ALL]="All"; @@ -208,7 +181,7 @@ StatusCode MuonPhysValMonitoringTool::bookHistograms() std::string categoryPath = m_muonsName+"/"+category+"/"; m_muonValidationPlots.push_back( new MuonValidationPlots(0, categoryPath, m_selectMuonWPs, m_selectMuonAuthors, m_isData, - (category==theMuonCategories[ALL]? false : m_doBinnedResolutionPlots), + (category==theMuonCategories[ALL]? false : m_doBinnedResolutionPlots.value()), separateSAFMuons, m_doMuonTree)); m_slowMuonValidationPlots.push_back( new SlowMuonValidationPlots( 0, categoryPath, m_isData ) ); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h index fa897be1a74edc61c80379c6c67a6181447f52c0..9c2fd6dc143474ae6808dd239767e710d5cf85c9 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h @@ -79,6 +79,8 @@ class MuonPhysValMonitoringTool /// Default constructor: MuonPhysValMonitoringTool(); + enum MUCATEGORY{ALL=0, PROMPT, INFLIGHT, NONISO, REST}; + void handleMuon(const xAOD::Muon* mu,const xAOD::SlowMuon *smu=0); void handleSlowMuon(const xAOD::SlowMuon *smu); void handleTruthMuon(const xAOD::TruthParticle* truthMu); @@ -106,57 +108,53 @@ class MuonPhysValMonitoringTool xAOD::Muon* getCorrectedMuon(const xAOD::Muon &mu); const xAOD::TrackParticleContainer* m_MSTracks; - + std::map<std::string,int> m_counterBits; + std::vector<std::string> m_muonItems; + std::vector<std::string> m_L1Seed; + int m_SelectedAuthor; + TH1F* findHistogram(std::vector<HistData> hists,std::string hnameTag,std::string hdirTag,std::string hNewName); void modifyHistogram(TH1* hist); - Gaudi::Property<bool> m_isData{this,"IsData",false}; - - // Containers - Gaudi::Property<std::string> m_tracksName{this,"TrackContainerName",""}; + Gaudi::Property<std::string> m_tracksName{this,"TrackContainerName","InDetTrackParticles"}; Gaudi::Property<std::string> m_fwdtracksName{this,"FwdTrackContainerName",""}; Gaudi::Property<std::string> m_muonsName{this,"MuonContainerName","Muons"}; Gaudi::Property<std::string> m_slowMuonsName{this,"SlowMuonContainerName","SlowMuons"}; Gaudi::Property<std::string> m_muonsTruthName{this,"MuonTruthParticleContainerName","MuonTruthParticles"}; - Gaudi::Property<std::string> m_muonTracksName{this,"MuonTrackContainerName",""}; - Gaudi::Property<std::string> m_muonExtrapolatedTracksName{this,"MuonExtrapolatedTrackContainerName",""}; - Gaudi::Property<std::string> m_muonMSOnlyExtrapolatedTracksName{this,"MuonOnlyExtrapolatedTrackContainerName",""}; - Gaudi::Property<std::string> m_muonSegmentsName{this,"MuonSegmentContainerName",""}; + Gaudi::Property<std::string> m_muonTracksName{this,"MuonTrackContainerName","MuonSpectrometerTrackParticles"}; + Gaudi::Property<std::string> m_muonExtrapolatedTracksName{this,"MuonExtrapolatedTrackContainerName","ExtrapolatedMuonTrackParticles"}; + Gaudi::Property<std::string> m_muonMSOnlyExtrapolatedTracksName{this,"MuonOnlyExtrapolatedTrackContainerName","MSOnlyExtrapolatedMuonTrackParticles"}; + Gaudi::Property<std::string> m_muonSegmentsName{this,"MuonSegmentContainerName","MuonSegments"}; Gaudi::Property<std::string> m_muonSegmentsTruthName{this,"MuonTruthSegmentContainerName","MuonTruthSegments"}; Gaudi::Property<std::string> m_muonL1TrigName{this,"L1TrigMuonContainerName","LVL1MuonRoIs"}; Gaudi::Property<std::string> m_muonL2SAName{this,"L2SAMuonContainerName","HLT_xAOD__L2StandAloneMuonContainer_MuonL2SAInfo"}; Gaudi::Property<std::string> m_muonL2CBName{this,"L2CBMuonContainerName","HLT_xAOD__L2CombinedMuonContainer_MuonL2CBInfo"}; Gaudi::Property<std::string> m_muonEFCombTrigName{this,"EFCombTrigMuonContainerName","HLT_xAOD__MuonContainer_MuonEFInfo"}; - SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this,"EventInfo","EventInfo","event info"}; + Gaudi::Property<std::vector<int>> m_selectMuonWPs{this,"SelectMuonWorkingPoints",{xAOD::Muon::Loose,xAOD::Muon::Medium}}; + Gaudi::Property<std::vector<unsigned int>> m_selectMuonAuthors{this,"SelectMuonAuthors",{xAOD::Muon::MuidCo,xAOD::Muon::MuTagIMO,xAOD::Muon::MuidSA,xAOD::Muon::MuGirl,xAOD::Muon::CaloTag,xAOD::Muon::CaloLikelihood}}; + Gaudi::Property<std::vector<std::vector<std::string>>> m_selectHLTMuonItems{this,"SelectHLTMuonItems",{}}; + Gaudi::Property<std::vector<std::string>> m_L1MuonItems{this,"SelectL1MuonItems",{}}; + Gaudi::Property<std::vector<unsigned int>> m_selectMuonCategories{this,"SelectMuonCategories",{MUCATEGORY::ALL,MUCATEGORY::PROMPT,MUCATEGORY::INFLIGHT,MUCATEGORY::NONISO,MUCATEGORY::REST}}; - // Configurable properties - std::map<std::string,int> m_counterBits; - std::vector<int> m_selectMuonWPs; - std::vector<unsigned int> m_selectMuonAuthors; - std::vector<std::vector<std::string>> m_selectHLTMuonItems; - std::vector<std::string> m_muonItems; - std::vector<std::string> m_L1Seed; - std::vector<std::string> m_L1MuonItems; - int m_SelectedAuthor; - std::vector<unsigned int> m_selectMuonCategories; - bool m_doBinnedResolutionPlots; + Gaudi::Property<bool> m_doBinnedResolutionPlots{this,"DoBinnedResolutionPlots",true}; Gaudi::Property<bool> m_doTrigMuonValidation{this,"DoTrigMuonValidation",false}; Gaudi::Property<bool> m_doTrigMuonL1Validation{this,"DoTrigMuonL1Validation",false}; Gaudi::Property<bool> m_doTrigMuonL2Validation{this,"DoTrigMuonL2Validation",false}; Gaudi::Property<bool> m_doTrigMuonEFValidation{this,"DoTrigMuonEFValidation",false}; Gaudi::Property<bool> m_doMuonTree{this,"DoMuonTree",false}; + Gaudi::Property<bool> m_isData{this,"IsData",false}; + + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this,"EventInfo","EventInfo","event info"}; // Tools ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool; ToolHandle<Rec::IMuonPrintingTool> m_muonPrinter; ToolHandle<Trig::TrigDecisionTool> m_trigDec; ToolHandle<Trk::ITrackSelectorTool> m_trackSelector; - ToolHandle<CP::IIsolationSelectionTool> m_isoTool; - - + ToolHandle<CP::IIsolationSelectionTool> m_isoTool{this,"IsoTool",""}; - enum MUCATEGORY{ALL=0, PROMPT, INFLIGHT, NONISO, REST}; + std::vector<std::string> m_selectMuonCategoriesStr; MuonPhysValMonitoringTool::MUCATEGORY getMuonSegmentTruthCategory(const xAOD::MuonSegment* truthMuSeg, const xAOD::TruthParticleContainer* muonTruthContainer); MuonPhysValMonitoringTool::MUCATEGORY getMuonTruthCategory(const xAOD::IParticle* prt); diff --git a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMuon_jobOptions.py b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMuon_jobOptions.py index e67aa8c518ce4fc90c245b771ba439776ffbbf3f..beeb35a7053b5fe461165741d042af4a8596fc7b 100644 --- a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMuon_jobOptions.py +++ b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMuon_jobOptions.py @@ -7,26 +7,10 @@ from RecExConfig.RecFlags import rec as recFlags tool1 = MuonPhysValMonitoring__MuonPhysValMonitoringTool( name = 'muphysval' ) tool1.IsData = not recFlags.doTruth() -# -tool1.MuonContainerName = 'Muons' +#add if you need any of the following containers +#tool1.FwdTrackContainerName='InDetForwardTrackParticles' tool1.SlowMuonContainerName = '' -tool1.MuonTruthParticleContainerName = 'MuonTruthParticles' -tool1.DoBinnedResolutionPlots = True -#comment out if you don't need any of the following containers -tool1.TrackContainerName = 'InDetTrackParticles' -# #tool1.FwdTrackContainerName='InDetForwardTrackParticles' -tool1.MuonTrackContainerName = 'MuonSpectrometerTrackParticles' -tool1.MuonExtrapolatedTrackContainerName = 'ExtrapolatedMuonTrackParticles' -tool1.MuonOnlyExtrapolatedTrackContainerName = 'MSOnlyExtrapolatedMuonTrackParticles' -tool1.MuonSegmentContainerName = 'MuonSegments' - - -#tool1.MuonTruthParticleContainerName = 'MuonTruthParticle' # uncomment for release 19 -# tool1.DoTrigMuonValidation =True -# tool1.DoTrigMuonEFValidation = True -# tool1.DoTrigMuonL2Validation = True -# tool1.DoTrigMuonL1Validation = True tool1.SelectHLTMuonItems = [ ["HLT_mu20","L1_MU20"], ["HLT_mu20_iloose_L1MU15","L1_MU15"], @@ -54,9 +38,11 @@ tool1.SelectMuonWorkingPoints = [ 1 ] tool1.SelectMuonAuthors = [ 1, 2, 4 ,5, 6, 8, 9 ] #Select Muon Categories... (origin of muons, empty: all categories, 0: ALL, 1: PROMPT, 2: IN-FLIGHT, 3: NON-ISOLATED, 4: REST) -#tool1.SelectMuonCategories = [ 0, 1, 2, 3, 4 ] # all possible categories tool1.SelectMuonCategories = [ 0, 1 ] # lighter version, good for official validation tasks overriden when in data mode +if not recFlags.doTruth(): + tool1.SelectMuonCategories = [0, 1, 4] + from IsolationSelection.IsolationSelectionConf import CP__IsolationSelectionTool IsolationTool = CP__IsolationSelectionTool( "IsolationSelectionTool", CalibFileName = "IsolationSelection/v1/MC15_Z_Jpsi_cutMap.root",