Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce DiMuonMassBiasClient and use in ALCARECOTkAlDiMuonAndVertexDQM #39148

Merged
merged 3 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DQMOffline/Alignment/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
<use name="TrackingTools/TrackFitters"/>
<use name="TrackingTools/TrajectoryState"/>
<use name="TrackingTools/TransientTrack"/>
<use name="roofit"/>
<flags EDM_PLUGIN="1"/>
98 changes: 98 additions & 0 deletions DQMOffline/Alignment/interface/DiMuonMassBiasClient.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#ifndef DQMOffline_Alignment_DiMuonMassBiasClient_h
#define DQMOffline_Alignment_DiMuonMassBiasClient_h
// -*- C++ -*-
//
// Package: DQMOffline/Alignment
// Class : DiMuonMassBiasClient
//
// DQM class to plot di-muon mass bias in different kinematics bins

// system includes
#include <string>

// user includes
#include "DQMServices/Core/interface/DQMEDHarvester.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1D.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/Run.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

namespace diMuonMassBias {

struct fitOutputs {
public:
fitOutputs(const Measurement1D& bias, const Measurement1D& width) : m_bias(bias), m_width(width) {}

// getters
const Measurement1D getBias() { return m_bias; }
const Measurement1D getWidth() { return m_width; }

private:
Measurement1D m_bias;
Measurement1D m_width;
};

// helper functions to fill arrays from vectors
inline void fillArrayF(float* x, const edm::ParameterSet& cfg, const char* name) {
auto v = cfg.getParameter<std::vector<double>>(name);
assert(v.size() == 3);
std::copy(std::begin(v), std::end(v), x);
}

inline void fillArrayI(int* x, const edm::ParameterSet& cfg, const char* name) {
auto v = cfg.getParameter<std::vector<int>>(name);
assert(v.size() == 3);
std::copy(std::begin(v), std::end(v), x);
}
} // namespace diMuonMassBias

class DiMuonMassBiasClient : public DQMEDHarvester {
public:
/// Constructor
DiMuonMassBiasClient(const edm::ParameterSet& ps);

/// Destructor
~DiMuonMassBiasClient() override;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

protected:
/// BeginJob
void beginJob(void) override;

/// BeginRun
void beginRun(edm::Run const& run, edm::EventSetup const& eSetup) override;

/// EndJob
void dqmEndJob(DQMStore::IBooker& ibooker_, DQMStore::IGetter& igetter_) override;

private:
/// book MEs
void bookMEs(DQMStore::IBooker& ibooker);
void getMEsToHarvest(DQMStore::IGetter& igetter);
diMuonMassBias::fitOutputs fitVoigt(TH1* hist, const bool& fitBackground = false) const;

// data members
const std::string TopFolder_;
const bool fitBackground_;
const bool debugMode_;

float meanConfig_[3]; /* parmaeters for the fit: mean */
float widthConfig_[3]; /* parameters for the fit: width */
float sigmaConfig_[3]; /* parmaeters for the fit: sigma */

// list of histograms to harvest
std::vector<std::string> MEtoHarvest_;

// the histograms to be filled
std::map<std::string, MonitorElement*> meanProfiles_;
std::map<std::string, MonitorElement*> widthProfiles_;

// the histograms than need to be fit and displays
std::map<std::string, MonitorElement*> harvestTargets_;
};
#endif
7 changes: 6 additions & 1 deletion DQMOffline/Alignment/python/ALCARECOTkAlDQM_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import DQMOffline.Alignment.TkAlCaRecoMonitor_cfi
import DQMOffline.Alignment.DiMuonVertexMonitor_cfi
import DQMOffline.Alignment.DiMuonMassBiasMonitor_cfi
import DQMOffline.Alignment.DiMuonMassBiasClient_cfi

#Below all DQM modules for TrackerAlignment AlCaRecos are instantiated.
######################################################
Expand Down Expand Up @@ -86,7 +87,11 @@
FolderName = "AlCaReco/"+__selectionName
)

ALCARECOTkAlDiMuonAndVertexDQM = cms.Sequence(ALCARECOTkAlDiMuonAndVertexTkAlDQM + ALCARECOTkAlDiMuonAndVertexVtxDQM + ALCARECOTkAlDiMuonMassBiasDQM )
ALCARECOTkAlDiMuonMassBiasClient = DQMOffline.Alignment.DiMuonMassBiasClient_cfi.DiMuonMassBiasClient.clone(
FolderName = "AlCaReco/"+__selectionName
)

ALCARECOTkAlDiMuonAndVertexDQM = cms.Sequence(ALCARECOTkAlDiMuonAndVertexTkAlDQM + ALCARECOTkAlDiMuonAndVertexVtxDQM + ALCARECOTkAlDiMuonMassBiasDQM + ALCARECOTkAlDiMuonMassBiasClient)

#########################################################
#############--- TkAlZMuMuHI ---########################
Expand Down
36 changes: 36 additions & 0 deletions DQMOffline/Alignment/python/DiMuonMassBiasClient_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import FWCore.ParameterSet.Config as cms

from DQMServices.Core.DQMEDHarvester import DQMEDHarvester

DiMuonMassBiasClient = DQMEDHarvester("DiMuonMassBiasClient",
FolderName = cms.string('DiMuonMassBiasMonitor'),
fitBackground = cms.bool(False),
debugMode = cms.bool(False),
fit_par = cms.PSet(
mean_par = cms.vdouble(
90.,
60.,
120.
),
width_par = cms.vdouble(
5.0,
0.0,
120.0
),
sigma_par = cms.vdouble(
5.0,
0.0,
120.0
)
),
MEtoHarvest = cms.vstring(
'DiMuMassVsMuMuPhi',
'DiMuMassVsMuMuEta',
'DiMuMassVsMuPlusPhi',
'DiMuMassVsMuPlusEta',
'DiMuMassVsMuMinusPhi',
'DiMuMassVsMuMinusEta',
'DiMuMassVsMuMuDeltaEta',
'DiMuMassVsCosThetaCS'
)
)
Loading