35 Plot1D() : name(
""), title(
""), dir(
""), nxbins(0), xlow(0), xhigh(0), plot(
nullptr) {}
37 : name(n), title(t), dir(d), nxbins(nx), xlow(x0), xhigh(x1), plot(
nullptr) {}
41 plot = booker.
book1D(name, title, nxbins, xlow, xhigh);
45 assert(plot !=
nullptr);
63 const std::vector<double>& vx,
67 :
Plot1D(n, t, d, nx, x0, x1), xbins(vx), nybins(ny), ylow(y0), yhigh(y1) {}
76 assert(
plot !=
nullptr);
111 const auto& offset_psets = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"offsetPlots");
112 for (
auto&
pset : offset_psets) {
116 std::vector<double> vx =
pset.getParameter<std::vector<double>>(
"vx");
117 int ny =
pset.getParameter<uint32_t>(
"ny");
118 double y0 =
pset.getParameter<
double>(
"y0");
119 double y1 =
pset.getParameter<
double>(
"y1");
125 const auto& th1d_psets = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"th1dPlots");
126 for (
auto&
pset : th1d_psets) {
130 int nx =
pset.getParameter<uint32_t>(
"nx");
131 double x0 =
pset.getParameter<
double>(
"x0");
132 double x1 =
pset.getParameter<
double>(
"x1");
139 std::vector<std::string>
pdgStrs = iConfig.
getParameter<std::vector<std::string>>(
"pdgStrs");
140 for (
int i = 0,
n = pdgKeys.size();
i <
n;
i++)
147 pair.second.book(booker);
150 pair.second.book(booker);
159 unsigned int nPVall = vertexHandle->size();
160 bool isGoodPV[nPVall];
161 for (
size_t i = 0;
i < nPVall; ++
i)
165 for (
unsigned int i = 0;
i < nPVall;
i++) {
166 const auto&
pv = vertexHandle->at(
i);
168 if (!
pv.isFake() &&
pv.ndof() >= 4 && fabs(
pv.z()) <= 24.0 && fabs(
pv.position().rho()) <= 2.0) {
174 int npv_in_range = npv;
175 if (npv_in_range < 0)
177 else if (npv_in_range >=
npvHigh)
184 const auto&
summary = *muHandle;
185 auto it = std::find_if(
summary.begin(),
summary.end(), [](
const auto&
s) {
return s.getBunchCrossing() == 0; });
187 if (it->getBunchCrossing() != 0) {
188 edm::LogError(
"OffsetAnalyzerDQM") <<
"Cannot find the in-time pileup info " << it->getBunchCrossing();
190 float mu = it->getTrueNumInteractions();
199 std::map<std::string, std::vector<double>> m_pftype_etaE;
201 for (
const auto& pftype :
pftypes)
202 m_pftype_etaE[pftype].assign(nEta, 0.0);
208 for (
unsigned int i = 0,
n = pfHandle->size();
i <
n;
i++) {
209 const auto&
cand = pfHandle->at(
i);
213 if (etaIndex == -1 || pftype.empty())
216 if (pftype ==
"chm") {
217 bool attached =
false;
219 for (
unsigned int ipv = 0; ipv < nPVall && !attached; ipv++) {
220 if (isGoodPV[ipv] &&
cand.fromPV(ipv) == 3)
245 m_pftype_etaE[pftype][etaIndex] +=
cand.et();
248 for (
const auto& pair : m_pftype_etaE) {
250 std::vector<double> etaE = pair.second;
256 for (
int i = 0;
i <
nEta;
i++) {
266 for (
int i = 0;
i <
nEta;
i++) {
277 for (
int i = 0;
i <
nEta;
i++) {
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void book(DQMStore::IBooker &booker) override
virtual void fill(float value)
edm::EDGetTokenT< edm::View< PileupSummaryInfo > > muToken
std::map< int, std::string > pdgMap
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCurrentFolder(std::string const &fullpath)
std::map< std::string, Plot1D > th1dPlots
OffsetAnalyzerDQM(const edm::ParameterSet &)
std::vector< double > etabins
edm::EDGetTokenT< edm::View< pat::PackedCandidate > > pfToken
#define DEFINE_FWK_MODULE(type)
int getEtaIndex(float eta)
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
void analyze(const edm::Event &, const edm::EventSetup &) override
Abs< T >::type abs(const T &t)
std::string offsetPlotBaseName
std::map< std::string, PlotProfile > offsetPlots
Plot1D(const std::string &n, const std::string &t, const std::string &d, int nx, double x0, double x1)
PlotProfile(const std::string &n, const std::string &t, const std::string &d, int nx, double x0, double x1, const std::vector< double > &vx, int ny, double y0, double y1)
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
void fill2D(double value1, double value2)
edm::EDGetTokenT< edm::View< reco::Vertex > > pvToken
void dqmEndRun(const edm::Run &, const edm::EventSetup &) override
virtual void book(DQMStore::IBooker &booker)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< double > xbins
std::vector< std::string > pftypes