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

Adding Timing vs BX plots, and modifying thresholds for laser quality #18067

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions DQM/EcalMonitorClient/python/LaserClient_cfi.py
Expand Up @@ -13,8 +13,8 @@
expectedPNAmplitude = [800.0, 800.0, 800.0, 800.0]
tolerancePNAmp = 0.1
tolerancePNRMSRatio = 1.
expectedTiming = [4.2, 4.2, 4.2, 4.2]
toleranceTiming = 0.5
expectedTiming = [4.2, 3.7, 4.2, 4.2]
toleranceTiming = 1.0
toleranceTimRMS = 0.4

ecalLaserClient = cms.untracked.PSet(
Expand Down Expand Up @@ -63,9 +63,9 @@
),
otype = cms.untracked.string('SM'),
xaxis = cms.untracked.PSet(
high = cms.untracked.double(5.5),
high = cms.untracked.double(5.0),
nbins = cms.untracked.int32(100),
low = cms.untracked.double(3.5),
low = cms.untracked.double(3.0),
title = cms.untracked.string('time (clock)')
),
btype = cms.untracked.string('User'),
Expand Down
8 changes: 8 additions & 0 deletions DQM/EcalMonitorTasks/interface/TimingTask.h
Expand Up @@ -19,10 +19,18 @@ namespace ecaldqm {
void runOnRecHits(EcalRecHitCollection const&, Collections);
void runOnUncalibRecHits(EcalUncalibratedRecHitCollection const&);

enum Constants {
nBXBins = 15
};

private:
void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
void beginEvent(edm::Event const&, edm::EventSetup const&) override;
void setParams(edm::ParameterSet const&) override;

int bxBinEdges_[nBXBins + 1];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use std::array<int,nBXBins+1>
@tanmaymudholkar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @davidlange6 , thanks for the suggestion, but using std::array is inconsistent with the syntax used here: https://github.com/tanmaymudholkar/cmssw/blob/TimingVsBX_and_LaserTiming_91X/DQM/EcalMonitorTasks/src/TimingTask.cc#L65

I used this construction to remain consistent with another very similar plot that we've had for some time: https://github.com/tanmaymudholkar/cmssw/blob/TimingVsBX_and_LaserTiming_91X/DQM/EcalMonitorTasks/src/TrigPrimTask.cc#L79-L80

Perhaps I could try to replace both of them by std::vectors that read in the bin values from the config file? According to documentation, this should still work with std::upper_bound(), but the changes might take me some time (~1 day) to test etc. Please advise.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did this not work?

int* pBin(std::upper_bound(bxBinEdges_.begin(), bxBinEdges_.end(), _evt.bunchCrossing()));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @davidlange6 , thanks very much for that suggestion. It does indeed improve code readability. I've tested the changes and added a commit to this PR and to the 900 PR: #18069

Please let me know if you have other suggestions. Thanks!

double bxBin_;

float chi2ThresholdEB_;
float chi2ThresholdEE_;
float energyThresholdEB_;
Expand Down
36 changes: 36 additions & 0 deletions DQM/EcalMonitorTasks/python/TimingTask_cfi.py
@@ -1,5 +1,24 @@
import FWCore.ParameterSet.Config as cms

bxBins = [
"1",
"271",
"541",
"892",
"1162",
"1432",
"1783",
"2053",
"2323",
"2674",
"2944",
"3214",
"3446",
"3490",
"3491",
"3565"
]

EaxisEdges = []
for i in range(50) :
EaxisEdges.append(pow(10., -0.5 + 2.5 / 50. * i))
Expand Down Expand Up @@ -102,6 +121,23 @@
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT timing vs amplitude %(sm)s'),
description = cms.untracked.string('Correlation between hit timing and energy. Only hits with GOOD or OUT_OF_TIME reconstruction flags are used.')
),
TimingVsBX = cms.untracked.PSet(
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT Timing vs BX%(suffix)s'),
kind = cms.untracked.string('TProfile'),
otype = cms.untracked.string('Ecal3P'),
xaxis = cms.untracked.PSet(
high = cms.untracked.double(16.0),
nbins = cms.untracked.int32(16),
low = cms.untracked.double(0.0),
title = cms.untracked.string('bunch crossing'),
labels = cms.untracked.vstring(bxBins)
),
yaxis = cms.untracked.PSet(
title = cms.untracked.string('Timing (ns)')
),
btype = cms.untracked.string('User'),
description = cms.untracked.string('Average hit timing in the partition as a function of BX number.')
),
TimeAmpBXm = cms.untracked.PSet(
kind = cms.untracked.string('TH2F'),
yaxis = cms.untracked.PSet(
Expand Down
16 changes: 16 additions & 0 deletions DQM/EcalMonitorTasks/src/TimingTask.cc
@@ -1,6 +1,9 @@
#include "../interface/TimingTask.h"

#include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
#include "FWCore/Framework/interface/EventSetup.h"

#include "FWCore/Framework/interface/Event.h"

#include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"

Expand All @@ -10,6 +13,8 @@ namespace ecaldqm
{
TimingTask::TimingTask() :
DQWorkerTask(),
bxBinEdges_{1, 271, 541, 892, 1162, 1432, 1783, 2053, 2323, 2674, 2944, 3214, 3446, 3490, 3491, 3565},
bxBin_(0.),
chi2ThresholdEB_(0.),
chi2ThresholdEE_(0.),
energyThresholdEB_(0.),
Expand Down Expand Up @@ -53,11 +58,20 @@ namespace ecaldqm
meTimeMapByLS->reset();
}

void
TimingTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es)
{
using namespace std;
int* pBin(std::upper_bound(bxBinEdges_, bxBinEdges_ + nBXBins + 1, _evt.bunchCrossing()));
bxBin_ = static_cast<int>(pBin - bxBinEdges_) - 0.5;
}

void
TimingTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection)
{
MESet& meTimeAmp(MEs_.at("TimeAmp"));
MESet& meTimeAmpAll(MEs_.at("TimeAmpAll"));
MESet& meTimingVsBX(MEs_.at("TimingVsBX"));
MESet& meTimeAll(MEs_.at("TimeAll"));
MESet& meTimeAllMap(MEs_.at("TimeAllMap"));
MESet& meTimeMap(MEs_.at("TimeMap")); // contains cumulative run stats => not suitable for Trend plots
Expand Down Expand Up @@ -94,6 +108,8 @@ namespace ecaldqm
meTimeAmp.fill(id, energy, time);
meTimeAmpAll.fill(id, energy, time);

meTimingVsBX.fill(signedSubdet, bxBin_, time);

if(energy > threshold){
meTimeAll.fill(id, time);
meTimeMap.fill(id, time);
Expand Down