CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< DQMEDAnalyzerGlobalCache
initializeGlobalCache (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
< LumiScalersCollection
lumiScalersSrc_
 
edm::EDGetTokenT
< OnlineLuminosityRecord
metaDataSrc_
 
std::string rootFolder_
 
const edm::ESGetToken
< TransientTrackBuilder,
TransientTrackRecord
ttbToken_
 
edm::EDGetTokenT
< reco::VertexCollection
vertexSrc_
 

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 ( 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),
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbToken_
edm::EDGetTokenT< LumiScalersCollection > lumiScalersSrc_
edm::EDGetTokenT< reco::VertexCollection > vertexSrc_
edm::EDGetTokenT< reco::BeamSpot > beamspotSrc_
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::EDGetTokenT< OnlineLuminosityRecord > metaDataSrc_
PrimaryVertexResolution::~PrimaryVertexResolution ( )
override

Definition at line 341 of file PrimaryVertexResolution.cc.

341 {}

Member Function Documentation

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

Reimplemented from DQMEDAnalyzer.

Definition at line 392 of file PrimaryVertexResolution.cc.

References relval_steps::beamspot, beamspotSrc_, PrimaryVertexResolution::Plots::calculateAndFillResolution(), engine_, edm::EventID::event(), fitter_, forceSCAL_, edm::EventSetup::getData(), edm::Event::getHandle(), hOtherV_, hPV_, edm::EventBase::id(), edm::HandleBase::isValid(), dqmdumpme::lumi, edm::EventID::luminosityBlock(), lumiScalersSrc_, metaDataSrc_, edm::EventID::run(), reco::Vertex::size, sortTracksByPt(), reco::Vertex::tracksSize(), ttbToken_, vertexSrc_, and beam_dqm_sourceclient-live_cfg::vertices.

392  {
394  const reco::VertexCollection& vertices = *hvertices;
395  if (vertices.empty())
396  return;
397 
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 }
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbToken_
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
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
edm::EDGetTokenT< LumiScalersCollection > lumiScalersSrc_
bool isValid() const
Definition: HandleBase.h:70
list lumi
Definition: dqmdumpme.py:53
size_t tracksSize() const
number of tracks
Definition: Vertex.h:112
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)
edm::EventID id() const
Definition: EventBase.h:59
edm::EDGetTokenT< OnlineLuminosityRecord > metaDataSrc_
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:32
void book(DQMStore::IBooker &iBooker)
void PrimaryVertexResolution::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 343 of file PrimaryVertexResolution.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), submitPVResolutionJobs::desc, HLT_FULL_cff::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 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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(), reco::TrackBase::pt(), HLT_FULL_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 }
reco::TransientTrack build(const reco::Track *p) const
double pt() const
track transverse momentum
Definition: TrackBase.h:637
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:110
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:108
size_t tracksSize() const
number of tracks
Definition: Vertex.h:112
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
unsigned transform(const HcalDetId &id, unsigned transformCode)

Member Data Documentation

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

Definition at line 64 of file PrimaryVertexResolution.cc.

Referenced by analyze().

BinningX PrimaryVertexResolution::binningX_
private

Definition at line 318 of file PrimaryVertexResolution.cc.

BinningY PrimaryVertexResolution::binningY_
private

Definition at line 319 of file PrimaryVertexResolution.cc.

std::mt19937 PrimaryVertexResolution::engine_
private

Definition at line 325 of file PrimaryVertexResolution.cc.

Referenced by analyze().

AdaptiveVertexFitter PrimaryVertexResolution::fitter_
private

Definition at line 70 of file PrimaryVertexResolution.cc.

Referenced by analyze().

const bool PrimaryVertexResolution::forceSCAL_
private

Definition at line 67 of file PrimaryVertexResolution.cc.

Referenced by analyze().

Plots PrimaryVertexResolution::hOtherV_
private

Definition at line 323 of file PrimaryVertexResolution.cc.

Referenced by analyze(), and bookHistograms().

Plots PrimaryVertexResolution::hPV_
private

Definition at line 322 of file PrimaryVertexResolution.cc.

Referenced by analyze(), and bookHistograms().

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

Definition at line 65 of file PrimaryVertexResolution.cc.

Referenced by analyze().

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

Definition at line 66 of file PrimaryVertexResolution.cc.

Referenced by analyze().

std::string PrimaryVertexResolution::rootFolder_
private

Definition at line 68 of file PrimaryVertexResolution.cc.

Referenced by bookHistograms().

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

Definition at line 62 of file PrimaryVertexResolution.cc.

Referenced by analyze().

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

Definition at line 63 of file PrimaryVertexResolution.cc.

Referenced by analyze().