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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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_
 
std::string transientTrackBuilder_
 
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 >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 48 of file PrimaryVertexResolution.cc.

Constructor & Destructor Documentation

◆ PrimaryVertexResolution()

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

Definition at line 329 of file PrimaryVertexResolution.cc.

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  transientTrackBuilder_(iConfig.getUntrackedParameter<std::string>("transientTrackBuilder")),
337  binningX_(iConfig),
338  binningY_(iConfig),

◆ ~PrimaryVertexResolution()

PrimaryVertexResolution::~PrimaryVertexResolution ( )
override

Definition at line 342 of file PrimaryVertexResolution.cc.

342 {}

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 393 of file PrimaryVertexResolution.cc.

393  {
395  iEvent.getByToken(vertexSrc_, hvertices);
396  const reco::VertexCollection& vertices = *hvertices;
397  if (vertices.empty())
398  return;
399 
400  edm::Handle<reco::BeamSpot> hbeamspot;
401  iEvent.getByToken(beamspotSrc_, hbeamspot);
402  const reco::BeamSpot& beamspot = *hbeamspot;
403 
404  float lumi = -1.;
405  if (forceSCAL_) {
407  iEvent.getByToken(lumiScalersSrc_, lumiScalers);
408  if (lumiScalers.isValid() && !lumiScalers->empty()) {
409  LumiScalersCollection::const_iterator scalit = lumiScalers->begin();
410  lumi = scalit->instantLumi();
411  }
412  } else {
414  iEvent.getByToken(metaDataSrc_, metaData);
415  if (metaData.isValid())
416  lumi = metaData->instLumi();
417  }
418 
419  edm::ESHandle<TransientTrackBuilder> ttBuilderHandle;
420  iSetup.get<TransientTrackRecord>().get(transientTrackBuilder_, ttBuilderHandle);
421  const TransientTrackBuilder& ttBuilder = *ttBuilderHandle;
422 
423  // deterministic seed from the event number
424  // should not bias the result as the event number is already
425  // assigned randomly-enough
426  engine_.seed(iEvent.id().event() + (iEvent.id().luminosityBlock() << 10) + (iEvent.id().run() << 20));
427 
428  // The PV
429  auto iPV = cbegin(vertices);
430  const reco::Vertex& thePV = *iPV;
431  const auto nvertices = vertices.size();
432  if (thePV.tracksSize() >= 4) {
433  auto sortedTracks = sortTracksByPt(thePV, ttBuilder, beamspot);
434  hPV_.calculateAndFillResolution(sortedTracks, nvertices, lumi, engine_, fitter_);
435  }
436  ++iPV;
437 
438  // Other vertices
439  for (auto endPV = cend(vertices); iPV != endPV; ++iPV) {
440  if (iPV->tracksSize() >= 4) {
441  auto sortedTracks = sortTracksByPt(*iPV, ttBuilder, beamspot);
442  hOtherV_.calculateAndFillResolution(sortedTracks, nvertices, lumi, engine_, fitter_);
443  }
444  }
445 }

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

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

Definition at line 385 of file PrimaryVertexResolution.cc.

385  {
386  iBooker.setCurrentFolder(rootFolder_ + "/PV");
387  hPV_.book(iBooker);
388 
389  iBooker.setCurrentFolder(rootFolder_ + "/OtherV");
390  hOtherV_.book(iBooker);
391 }

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

◆ fillDescriptions()

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

Definition at line 344 of file PrimaryVertexResolution.cc.

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

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

◆ sortTracksByPt()

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

Definition at line 447 of file PrimaryVertexResolution.cc.

449  {
450  std::vector<const reco::Track*> sortedTracks;
451  sortedTracks.reserve(thePV.tracksSize());
453  thePV.tracks_begin(), thePV.tracks_end(), std::back_inserter(sortedTracks), [](const reco::TrackBaseRef& ref) {
454  return &(*ref);
455  });
456  std::sort(sortedTracks.begin(), sortedTracks.end(), [](const reco::Track* a, const reco::Track* b) {
457  return a->pt() > b->pt();
458  });
459 
460  std::vector<reco::TransientTrack> ttracks;
461  ttracks.reserve(sortedTracks.size());
462  std::transform(sortedTracks.begin(), sortedTracks.end(), std::back_inserter(ttracks), [&](const reco::Track* track) {
463  auto tt = ttBuilder.build(track);
464  tt.setBeamSpot(beamspot);
465  return tt;
466  });
467  return ttracks;
468 }

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

Referenced by analyze().

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 319 of file PrimaryVertexResolution.cc.

◆ binningY_

BinningY PrimaryVertexResolution::binningY_
private

Definition at line 320 of file PrimaryVertexResolution.cc.

◆ engine_

std::mt19937 PrimaryVertexResolution::engine_
private

Definition at line 326 of file PrimaryVertexResolution.cc.

Referenced by analyze().

◆ fitter_

AdaptiveVertexFitter PrimaryVertexResolution::fitter_
private

Definition at line 71 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 324 of file PrimaryVertexResolution.cc.

Referenced by analyze(), and bookHistograms().

◆ hPV_

Plots PrimaryVertexResolution::hPV_
private

Definition at line 323 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().

◆ transientTrackBuilder_

std::string PrimaryVertexResolution::transientTrackBuilder_
private

Definition at line 69 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().

HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
V0Monitor_cfi.lumiScalers
lumiScalers
Definition: V0Monitor_cfi.py:9
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
PrimaryVertexResolution::Plots::calculateAndFillResolution
void calculateAndFillResolution(const std::vector< reco::TransientTrack > &tracks, size_t nvertices, float lumi, std::mt19937 &engine, AdaptiveVertexFitter &fitter)
Definition: PrimaryVertexResolution.cc:470
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
PrimaryVertexResolution::engine_
std::mt19937 engine_
Definition: PrimaryVertexResolution.cc:326
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
PrimaryVertexResolution::Plots::book
void book(DQMStore::IBooker &iBooker)
Definition: PrimaryVertexResolution.cc:266
edm::Handle< reco::VertexCollection >
PrimaryVertexResolution::hPV_
Plots hPV_
Definition: PrimaryVertexResolution.cc:323
PrimaryVertexResolution::transientTrackBuilder_
std::string transientTrackBuilder_
Definition: PrimaryVertexResolution.cc:69
PrimaryVertexResolution::binningX_
BinningX binningX_
Definition: PrimaryVertexResolution.cc:319
PrimaryVertexResolution::lumiScalersSrc_
edm::EDGetTokenT< LumiScalersCollection > lumiScalersSrc_
Definition: PrimaryVertexResolution.cc:65
PrimaryVertexResolution::binningY_
BinningY binningY_
Definition: PrimaryVertexResolution.cc:320
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
reco::Vertex::tracks_end
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:73
reco::BeamSpot
Definition: BeamSpot.h:21
TransientTrackRecord
Definition: TransientTrackRecord.h:11
reco::Track
Definition: Track.h:27
edm::ESHandle< TransientTrackBuilder >
beamspot
Definition: BeamSpotWrite2Txt.h:8
PrimaryVertexResolution::vertexSrc_
edm::EDGetTokenT< reco::VertexCollection > vertexSrc_
Definition: PrimaryVertexResolution.cc:63
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PrimaryVertexResolution::rootFolder_
std::string rootFolder_
Definition: PrimaryVertexResolution.cc:68
a
double a
Definition: hdecay.h:119
reco::Vertex::tracks_begin
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:71
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
reco::Vertex::tracksSize
size_t tracksSize() const
number of tracks
Definition: Vertex.cc:69
iEvent
int iEvent
Definition: GenABIO.cc:224
PrimaryVertexResolution::hOtherV_
Plots hOtherV_
Definition: PrimaryVertexResolution.cc:324
TransientTrackBuilder
Definition: TransientTrackBuilder.h:16
get
#define get
PrimaryVertexResolution::sortTracksByPt
std::vector< reco::TransientTrack > sortTracksByPt(const reco::Vertex &thePV, const TransientTrackBuilder &ttBuilder, const reco::BeamSpot &beamspot)
Definition: PrimaryVertexResolution.cc:447
SiPixelPhase1Clusters_cfi.e3
e3
Definition: SiPixelPhase1Clusters_cfi.py:9
PrimaryVertexResolution::fitter_
AdaptiveVertexFitter fitter_
Definition: PrimaryVertexResolution.cc:71
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
PrimaryVertexResolution::beamspotSrc_
edm::EDGetTokenT< reco::BeamSpot > beamspotSrc_
Definition: PrimaryVertexResolution.cc:64
PrimaryVertexResolution::metaDataSrc_
edm::EDGetTokenT< OnlineLuminosityRecord > metaDataSrc_
Definition: PrimaryVertexResolution.cc:66
OnlineLuminosityRecord::instLumi
float instLumi() const
Return the luminosity for the current nibble.
Definition: OnlineLuminosityRecord.h:33
PrimaryVertexResolution::forceSCAL_
const bool forceSCAL_
Definition: PrimaryVertexResolution.cc:67
edm::RefToBase< reco::Track >
TransientTrackBuilder::build
reco::TransientTrack build(const reco::Track *p) const
Definition: TransientTrackBuilder.cc:20
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
lumi
Definition: LumiSectionData.h:20
edm::InputTag
Definition: InputTag.h:15
reco::Vertex
Definition: Vertex.h:35
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7