CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PrimaryVertexResolution Class Reference
Inheritance diagram for PrimaryVertexResolution:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Classes

struct  BinningX
 
struct  BinningY
 
class  DiffPlots
 
class  Plots
 
class  Resolution
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 PrimaryVertexResolution (const edm::ParameterSet &iConfig)
 
 ~PrimaryVertexResolution () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 

Private Member Functions

std::vector< reco::TransientTracksortTracksByPt (const reco::Vertex &thePV, const TransientTrackBuilder &ttBuilder, const reco::BeamSpot &beamspot)
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamspotSrc_
 
BinningX binningX_
 
BinningY binningY_
 
std::mt19937 engine_
 
AdaptiveVertexFitter fitter_
 
const bool forceSCAL_
 
Plots hOtherV_
 
Plots hPV_
 
edm::EDGetTokenT< LumiScalersCollectionlumiScalersSrc_
 
edm::EDGetTokenT< OnlineLuminosityRecordmetaDataSrc_
 
std::string rootFolder_
 
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecordttbToken_
 
edm::EDGetTokenT< reco::VertexCollectionvertexSrc_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 47 of file PrimaryVertexResolution.cc.

Constructor & Destructor Documentation

◆ PrimaryVertexResolution()

PrimaryVertexResolution::PrimaryVertexResolution ( const edm::ParameterSet iConfig)

Definition at line 328 of file PrimaryVertexResolution.cc.

329  : ttbToken_(esConsumes(edm::ESInputTag("", iConfig.getUntrackedParameter<std::string>("transientTrackBuilder")))),
330  vertexSrc_(consumes<reco::VertexCollection>(iConfig.getUntrackedParameter<edm::InputTag>("vertexSrc"))),
331  beamspotSrc_(consumes<reco::BeamSpot>(iConfig.getUntrackedParameter<edm::InputTag>("beamspotSrc"))),
332  lumiScalersSrc_(consumes<LumiScalersCollection>(iConfig.getUntrackedParameter<edm::InputTag>("lumiScalersSrc"))),
333  metaDataSrc_(consumes<OnlineLuminosityRecord>(iConfig.getUntrackedParameter<edm::InputTag>("metaDataSrc"))),
334  forceSCAL_(iConfig.getUntrackedParameter<bool>("forceSCAL")),
335  rootFolder_(iConfig.getUntrackedParameter<std::string>("rootFolder")),
336  binningX_(iConfig),
337  binningY_(iConfig),
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< LumiScalersCollection > lumiScalersSrc_
edm::EDGetTokenT< reco::VertexCollection > vertexSrc_
edm::EDGetTokenT< reco::BeamSpot > beamspotSrc_
edm::EDGetTokenT< OnlineLuminosityRecord > metaDataSrc_

◆ ~PrimaryVertexResolution()

PrimaryVertexResolution::~PrimaryVertexResolution ( )
override

Definition at line 341 of file PrimaryVertexResolution.cc.

341 {}

Member Function Documentation

◆ analyze()

void PrimaryVertexResolution::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 392 of file PrimaryVertexResolution.cc.

References beamspotSrc_, PrimaryVertexResolution::Plots::calculateAndFillResolution(), engine_, fitter_, forceSCAL_, edm::EventSetup::getData(), hOtherV_, hPV_, iEvent, OnlineLuminosityRecord::instLumi(), edm::HandleBase::isValid(), V0Monitor_cfi::lumiScalers, lumiScalersSrc_, metaDataSrc_, sortTracksByPt(), reco::Vertex::tracksSize(), ttbToken_, vertexSrc_, and AlignmentTracksFromVertexSelector_cfi::vertices.

392  {
394  const reco::VertexCollection& vertices = *hvertices;
395  if (vertices.empty())
396  return;
397 
398  edm::Handle<reco::BeamSpot> hbeamspot = iEvent.getHandle(beamspotSrc_);
399  const reco::BeamSpot& beamspot = *hbeamspot;
400 
401  float lumi = -1.;
402  if (forceSCAL_) {
404  if (lumiScalers.isValid() && !lumiScalers->empty()) {
405  LumiScalersCollection::const_iterator scalit = lumiScalers->begin();
406  lumi = scalit->instantLumi();
407  }
408  } else {
410  if (metaData.isValid())
411  lumi = metaData->instLumi();
412  }
413 
414  const TransientTrackBuilder& ttBuilder = iSetup.getData(ttbToken_);
415 
416  // deterministic seed from the event number
417  // should not bias the result as the event number is already
418  // assigned randomly-enough
419  engine_.seed(iEvent.id().event() + (iEvent.id().luminosityBlock() << 10) + (iEvent.id().run() << 20));
420 
421  // The PV
422  auto iPV = cbegin(vertices);
423  const reco::Vertex& thePV = *iPV;
424  const auto nvertices = vertices.size();
425  if (thePV.tracksSize() >= 4) {
426  auto sortedTracks = sortTracksByPt(thePV, ttBuilder, beamspot);
427  hPV_.calculateAndFillResolution(sortedTracks, nvertices, lumi, engine_, fitter_);
428  }
429  ++iPV;
430 
431  // Other vertices
432  for (auto endPV = cend(vertices); iPV != endPV; ++iPV) {
433  if (iPV->tracksSize() >= 4) {
434  auto sortedTracks = sortTracksByPt(*iPV, ttBuilder, beamspot);
435  hOtherV_.calculateAndFillResolution(sortedTracks, nvertices, lumi, engine_, fitter_);
436  }
437  }
438 }
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void calculateAndFillResolution(const std::vector< reco::TransientTrack > &tracks, size_t nvertices, float lumi, std::mt19937 &engine, AdaptiveVertexFitter &fitter)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
float instLumi() const
Return the luminosity for the current nibble.
size_t tracksSize() const
number of tracks
Definition: Vertex.h:112
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< LumiScalersCollection > lumiScalersSrc_
edm::EDGetTokenT< reco::VertexCollection > vertexSrc_
edm::EDGetTokenT< reco::BeamSpot > beamspotSrc_
std::vector< reco::TransientTrack > sortTracksByPt(const reco::Vertex &thePV, const TransientTrackBuilder &ttBuilder, const reco::BeamSpot &beamspot)
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< OnlineLuminosityRecord > metaDataSrc_

◆ bookHistograms()

void PrimaryVertexResolution::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 384 of file PrimaryVertexResolution.cc.

References PrimaryVertexResolution::Plots::book(), hOtherV_, hPV_, rootFolder_, and dqm::implementation::NavigatorBase::setCurrentFolder().

384  {
385  iBooker.setCurrentFolder(rootFolder_ + "/PV");
386  hPV_.book(iBooker);
387 
388  iBooker.setCurrentFolder(rootFolder_ + "/OtherV");
389  hOtherV_.book(iBooker);
390 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
void book(DQMStore::IBooker &iBooker)

◆ fillDescriptions()

void PrimaryVertexResolution::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 343 of file PrimaryVertexResolution.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, SiPixelPhase1Clusters_cfi::e3, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

343  {
345  desc.addUntracked<edm::InputTag>("vertexSrc", edm::InputTag("trackingDQMgoodOfflinePrimaryVertices"));
346  desc.addUntracked<edm::InputTag>("beamspotSrc", edm::InputTag("offlineBeamSpot"));
347  desc.addUntracked<edm::InputTag>("lumiScalersSrc", edm::InputTag("scalersRawToDigi"));
348  desc.addUntracked<edm::InputTag>("metaDataSrc", edm::InputTag("onlineMetaDataDigis"));
349  desc.addUntracked<bool>("forceSCAL", true);
350  desc.addUntracked<std::string>("rootFolder", "OfflinePV/Resolution");
351  desc.addUntracked<std::string>("transientTrackBuilder", "TransientTrackBuilder");
352 
353  // Y axes
354  desc.addUntracked<double>("maxResol", 0.02);
355  desc.addUntracked<int>("binsResol", 100);
356 
357  desc.addUntracked<double>("maxPull", 5);
358  desc.addUntracked<int>("binsPull", 100);
359 
360  // X axes
361  desc.addUntracked<double>("minNtracks", -0.5);
362  desc.addUntracked<double>("maxNtracks", 119.5);
363  desc.addUntracked<int>("binsNtracks", 60);
364 
365  desc.addUntracked<double>("minNvertices", -0.5);
366  desc.addUntracked<double>("maxNvertices", 199.5);
367  desc.addUntracked<int>("binsNvertices", 100);
368 
369  desc.addUntracked<double>("maxXY", 0.15);
370  desc.addUntracked<int>("binsXY", 100);
371 
372  desc.addUntracked<double>("maxZ", 30.);
373  desc.addUntracked<int>("binsZ", 100);
374 
375  desc.addUntracked<double>("minPt", 1);
376  desc.addUntracked<double>("maxPt", 1e3);
377 
378  desc.addUntracked<double>("minLumi", 200.);
379  desc.addUntracked<double>("maxLumi", 20000.);
380 
381  descriptions.add("primaryVertexResolution", desc);
382 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ sortTracksByPt()

std::vector< reco::TransientTrack > PrimaryVertexResolution::sortTracksByPt ( const reco::Vertex thePV,
const TransientTrackBuilder ttBuilder,
const reco::BeamSpot beamspot 
)
private

Definition at line 440 of file PrimaryVertexResolution.cc.

References a, b, TransientTrackBuilder::build(), jetUpdater_cfi::sort, HLT_2023v12_cff::track, reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), reco::Vertex::tracksSize(), HcalDetIdTransform::transform(), and groupFilesInBlocks::tt.

Referenced by analyze().

442  {
443  std::vector<const reco::Track*> sortedTracks;
444  sortedTracks.reserve(thePV.tracksSize());
446  thePV.tracks_begin(), thePV.tracks_end(), std::back_inserter(sortedTracks), [](const reco::TrackBaseRef& ref) {
447  return &(*ref);
448  });
449  std::sort(sortedTracks.begin(), sortedTracks.end(), [](const reco::Track* a, const reco::Track* b) {
450  return a->pt() > b->pt();
451  });
452 
453  std::vector<reco::TransientTrack> ttracks;
454  ttracks.reserve(sortedTracks.size());
455  std::transform(sortedTracks.begin(), sortedTracks.end(), std::back_inserter(ttracks), [&](const reco::Track* track) {
456  auto tt = ttBuilder.build(track);
457  tt.setBeamSpot(beamspot);
458  return tt;
459  });
460  return ttracks;
461 }
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:110
size_t tracksSize() const
number of tracks
Definition: Vertex.h:112
reco::TransientTrack build(const reco::Track *p) const
Definition: TTTypes.h:54
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:108
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
unsigned transform(const HcalDetId &id, unsigned transformCode)

Member Data Documentation

◆ beamspotSrc_

edm::EDGetTokenT<reco::BeamSpot> PrimaryVertexResolution::beamspotSrc_
private

Definition at line 64 of file PrimaryVertexResolution.cc.

Referenced by analyze().

◆ binningX_

BinningX PrimaryVertexResolution::binningX_
private

Definition at line 318 of file PrimaryVertexResolution.cc.

◆ binningY_

BinningY PrimaryVertexResolution::binningY_
private

Definition at line 319 of file PrimaryVertexResolution.cc.

◆ engine_

std::mt19937 PrimaryVertexResolution::engine_
private

Definition at line 325 of file PrimaryVertexResolution.cc.

Referenced by analyze().

◆ fitter_

AdaptiveVertexFitter PrimaryVertexResolution::fitter_
private

Definition at line 70 of file PrimaryVertexResolution.cc.

Referenced by analyze().

◆ forceSCAL_

const bool PrimaryVertexResolution::forceSCAL_
private

Definition at line 67 of file PrimaryVertexResolution.cc.

Referenced by analyze().

◆ hOtherV_

Plots PrimaryVertexResolution::hOtherV_
private

Definition at line 323 of file PrimaryVertexResolution.cc.

Referenced by analyze(), and bookHistograms().

◆ hPV_

Plots PrimaryVertexResolution::hPV_
private

Definition at line 322 of file PrimaryVertexResolution.cc.

Referenced by analyze(), and bookHistograms().

◆ lumiScalersSrc_

edm::EDGetTokenT<LumiScalersCollection> PrimaryVertexResolution::lumiScalersSrc_
private

Definition at line 65 of file PrimaryVertexResolution.cc.

Referenced by analyze().

◆ metaDataSrc_

edm::EDGetTokenT<OnlineLuminosityRecord> PrimaryVertexResolution::metaDataSrc_
private

Definition at line 66 of file PrimaryVertexResolution.cc.

Referenced by analyze().

◆ rootFolder_

std::string PrimaryVertexResolution::rootFolder_
private

Definition at line 68 of file PrimaryVertexResolution.cc.

Referenced by bookHistograms().

◆ ttbToken_

const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> PrimaryVertexResolution::ttbToken_
private

Definition at line 62 of file PrimaryVertexResolution.cc.

Referenced by analyze().

◆ vertexSrc_

edm::EDGetTokenT<reco::VertexCollection> PrimaryVertexResolution::vertexSrc_
private

Definition at line 63 of file PrimaryVertexResolution.cc.

Referenced by analyze().