CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
V0Validator Class Reference

#include <Validation/RecoVertex/src/V0Validator.cc>

Inheritance diagram for V0Validator:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Classes

struct  V0Couple
 

Public Types

enum  V0Type { KSHORT, LAMBDA }
 
- 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
 

Public Member Functions

 V0Validator (const edm::ParameterSet &)
 
 ~V0Validator () 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
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void doEfficiencies (const TrackingVertexCollection &gen_vertices, V0Type t, int parent_particle_id, int first_daughter_id, int second_daughter_id, const reco::VertexCompositeCandidateCollection &collection, const reco::SimToRecoCollection &simtorecoCollection)
 
void doFakeRates (const reco::VertexCompositeCandidateCollection &collection, const reco::RecoToSimCollection &recotosimCollection, V0Type t, int particle_pdgid, int misreconstructed_particle_pdgid)
 

Private Attributes

std::array< MonitorElement *, 2 > candidateEffVsEta_denom_
 
std::array< MonitorElement *, 2 > candidateEffVsEta_num_
 
std::array< MonitorElement *, 2 > candidateEffVsPt_denom_
 
std::array< MonitorElement *, 2 > candidateEffVsPt_num_
 
std::array< MonitorElement *, 2 > candidateEffVsR_denom_
 
std::array< MonitorElement *, 2 > candidateEffVsR_num_
 
std::array< MonitorElement *, 2 > candidateFakeDauRadDist_
 
std::array< MonitorElement *, 2 > candidateFakeVsEta_denom_
 
std::array< MonitorElement *, 2 > candidateFakeVsEta_num_
 
std::array< MonitorElement *, 2 > candidateFakeVsPt_denom_
 
std::array< MonitorElement *, 2 > candidateFakeVsPt_num_
 
std::array< MonitorElement *, 2 > candidateFakeVsR_denom_
 
std::array< MonitorElement *, 2 > candidateFakeVsR_num_
 
std::array< MonitorElement *, 2 > candidateMassAll
 
std::array< MonitorElement *, 2 > candidateStatus_
 
std::array< MonitorElement *, 2 > candidateTkEffVsEta_num_
 
std::array< MonitorElement *, 2 > candidateTkEffVsPt_num_
 
std::array< MonitorElement *, 2 > candidateTkEffVsR_num_
 
std::array< MonitorElement *, 2 > candidateTkFakeVsEta_num_
 
std::array< MonitorElement *, 2 > candidateTkFakeVsPt_num_
 
std::array< MonitorElement *, 2 > candidateTkFakeVsR_num_
 
std::string dirName
 
std::array< MonitorElement *, 2 > fakeCandidateMass_
 
std::array< MonitorElement *, 2 > goodCandidateMass
 
std::array< MonitorElement *, 2 > nCandidates_
 
edm::EDGetTokenT< reco::RecoToSimCollectionrecoRecoToSimCollectionToken_
 
edm::EDGetTokenT< reco::SimToRecoCollectionrecoSimToRecoCollectionToken_
 
edm::EDGetTokenT< reco::VertexCompositeCandidateCollectionrecoVertexCompositeCandidateCollection_k0s_Token_
 
edm::EDGetTokenT< reco::VertexCompositeCandidateCollectionrecoVertexCompositeCandidateCollection_lambda_Token_
 
std::string theDQMRootFileName
 
edm::EDGetTokenT< TrackingVertexCollectiontrackingVertexCollection_Token_
 
edm::EDGetTokenT< std::vector< reco::Vertex > > vec_recoVertex_Token_
 

Additional Inherited Members

- 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 &)
 
- 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

Validation/RecoVertex/interface/V0Validator.h

Description: Creates validation histograms for RecoVertex/V0Producer

Implementation: <Notes on="" implementation>="">

Description: Creates validation histograms for RecoVertex/V0Producer

Implementation: <Notes on="" implementation>="">

Definition at line 79 of file V0Validator.h.

Member Enumeration Documentation

◆ V0Type

Enumerator
KSHORT 
LAMBDA 

Definition at line 83 of file V0Validator.h.

83 { KSHORT, LAMBDA };

Constructor & Destructor Documentation

◆ V0Validator()

V0Validator::V0Validator ( const edm::ParameterSet iConfig)
explicit

Definition at line 27 of file V0Validator.cc.

28  : theDQMRootFileName(iConfig.getUntrackedParameter<std::string>("DQMRootFileName")),
29  dirName(iConfig.getUntrackedParameter<std::string>("dirName")),
31  consumes<reco::RecoToSimCollection>(iConfig.getUntrackedParameter<edm::InputTag>("trackAssociatorMap"))),
33  consumes<reco::SimToRecoCollection>(iConfig.getUntrackedParameter<edm::InputTag>("trackAssociatorMap"))),
35  consumes<TrackingVertexCollection>(iConfig.getUntrackedParameter<edm::InputTag>("trackingVertexCollection"))),
37  consumes<std::vector<reco::Vertex> >(iConfig.getUntrackedParameter<edm::InputTag>("vertexCollection"))),
38  recoVertexCompositeCandidateCollection_k0s_Token_(consumes<reco::VertexCompositeCandidateCollection>(
39  iConfig.getUntrackedParameter<edm::InputTag>("kShortCollection"))),
40  recoVertexCompositeCandidateCollection_lambda_Token_(consumes<reco::VertexCompositeCandidateCollection>(
41  iConfig.getUntrackedParameter<edm::InputTag>("lambdaCollection"))) {}

◆ ~V0Validator()

V0Validator::~V0Validator ( )
override

Definition at line 43 of file V0Validator.cc.

43 {}

Member Function Documentation

◆ analyze()

void V0Validator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 382 of file V0Validator.cc.

382  {
383  using std::cout;
384  using std::endl;
385  using namespace edm;
386  using namespace std;
387 
388  // Get event setup info, B-field and tracker geometry
389  ESHandle<MagneticField> bFieldHandle;
390  iSetup.get<IdealMagneticFieldRecord>().get(bFieldHandle);
391  ESHandle<GlobalTrackingGeometry> globTkGeomHandle;
392  iSetup.get<GlobalTrackingGeometryRecord>().get(globTkGeomHandle);
393 
394  // Make matching collections
395  Handle<reco::RecoToSimCollection> recotosimCollectionH;
396  iEvent.getByToken(recoRecoToSimCollectionToken_, recotosimCollectionH);
397 
398  Handle<reco::SimToRecoCollection> simtorecoCollectionH;
399  iEvent.getByToken(recoSimToRecoCollectionToken_, simtorecoCollectionH);
400 
401  // Get Monte Carlo information
403  iEvent.getByToken(trackingVertexCollection_Token_, TVCollectionH);
404 
405  // Select the primary vertex, create a new reco::Vertex to hold it
406  edm::Handle<std::vector<reco::Vertex> > primaryVtxCollectionH;
407  iEvent.getByToken(vec_recoVertex_Token_, primaryVtxCollectionH);
408 
409  std::vector<reco::Vertex>::const_iterator iVtxPH = primaryVtxCollectionH->begin();
410  for (std::vector<reco::Vertex>::const_iterator iVtx = primaryVtxCollectionH->begin();
411  iVtx < primaryVtxCollectionH->end();
412  iVtx++) {
413  if (primaryVtxCollectionH->size() > 1) {
414  if (iVtx->tracksSize() > iVtxPH->tracksSize()) {
415  iVtxPH = iVtx;
416  }
417  } else
418  iVtxPH = iVtx;
419  }
420 
421  // get the V0s;
426 
427  // Do fake rate and efficiency calculation
428 
429  // Get gen vertex collection out of the event, as done in the Vertex
430  // validation package!!!
431  if (k0sCollection.isValid()) {
432  doFakeRates(*k0sCollection.product(), *recotosimCollectionH.product(), V0Type::KSHORT, 310, 3122);
433  doEfficiencies(*TVCollectionH.product(),
434  V0Type::KSHORT,
435  310,
436  211,
437  211,
438  *k0sCollection.product(),
439  *simtorecoCollectionH.product());
440  }
441  if (lambdaCollection.isValid()) {
442  doFakeRates(*lambdaCollection.product(), *recotosimCollectionH.product(), V0Type::LAMBDA, 3122, 310);
443  doEfficiencies(*TVCollectionH.product(),
444  V0Type::LAMBDA,
445  3122,
446  211,
447  2212,
448  *lambdaCollection.product(),
449  *simtorecoCollectionH.product());
450  }
451 }

References gather_cfg::cout, doEfficiencies(), doFakeRates(), edm::EventSetup::get(), get, iEvent, edm::HandleBase::isValid(), v0validator_cfi::lambdaCollection, edm::Handle< T >::product(), recoRecoToSimCollectionToken_, recoSimToRecoCollectionToken_, recoVertexCompositeCandidateCollection_k0s_Token_, recoVertexCompositeCandidateCollection_lambda_Token_, trackingVertexCollection_Token_, and vec_recoVertex_Token_.

◆ bookHistograms()

void V0Validator::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 45 of file V0Validator.cc.

45  {
46  double minKsMass = 0.49767 - 0.07;
47  double maxKsMass = 0.49767 + 0.07;
48  double minLamMass = 1.1156 - 0.05;
49  double maxLamMass = 1.1156 + 0.05;
50  int ksMassNbins = 100;
51  double ksMassXmin = minKsMass;
52  double ksMassXmax = maxKsMass;
53  int lamMassNbins = 100;
54  double lamMassXmin = minLamMass;
55  double lamMassXmax = maxLamMass;
56 
57  ibooker.cd();
58  std::string subDirName = V0Validator::dirName + "/K0";
59  ibooker.setCurrentFolder(subDirName);
60 
62  ibooker.book1D("K0sEffVsR_num", "K^{0}_{S} Efficiency vs #rho", 80, 0., 40.);
64  ibooker.book1D("K0sEffVsEta_num", "K^{0}_{S} Efficiency vs #eta", 40, -2.5, 2.5);
66  ibooker.book1D("K0sEffVsPt_num", "K^{0}_{S} Efficiency vs p_{T}", 70, 0., 20.);
67 
69  ibooker.book1D("K0sTkEffVsR_num", "K^{0}_{S} Tracking Efficiency vs #rho", 80, 0., 40.);
71  ibooker.book1D("K0sTkEffVsEta_num", "K^{0}_{S} Tracking Efficiency vs #eta", 40, -2.5, 2.5);
73  ibooker.book1D("K0sTkEffVsPt_num", "K^{0}_{S} Tracking Efficiency vs p_{T}", 70, 0., 20.);
74 
76  ibooker.book1D("K0sEffVsR_denom", "K^{0}_{S} Efficiency vs #rho", 80, 0., 40.);
78  ibooker.book1D("K0sEffVsEta_denom", "K^{0}_{S} Efficiency vs #eta", 40, -2.5, 2.5);
80  ibooker.book1D("K0sEffVsPt_denom", "K^{0}_{S} Efficiency vs p_{T}", 70, 0., 20.);
81 
83  ibooker.book1D("K0sFakeVsR_num", "K^{0}_{S} Fake Rate vs #rho", 80, 0., 40.);
85  ibooker.book1D("K0sFakeVsEta_num", "K^{0}_{S} Fake Rate vs #eta", 40, -2.5, 2.5);
87  ibooker.book1D("K0sFakeVsPt_num", "K^{0}_{S} Fake Rate vs p_{T}", 70, 0., 20.);
89  ibooker.book1D("K0sTkFakeVsR_num", "K^{0}_{S} Tracking Fake Rate vs #rho", 80, 0., 80.);
91  ibooker.book1D("K0sTkFakeVsEta_num", "K^{0}_{S} Tracking Fake Rate vs #eta", 40, -2.5, 2.5);
93  ibooker.book1D("K0sTkFakeVsPt_num", "K^{0}_{S} Tracking Fake Rate vs p_{T}", 70, 0., 20.);
94 
96  ibooker.book1D("K0sFakeVsR_denom", "K^{0}_{S} Fake Rate vs #rho", 80, 0., 40.);
98  ibooker.book1D("K0sFakeVsEta_denom", "K^{0}_{S} Fake Rate vs #eta", 40, -2.5, 2.5);
100  ibooker.book1D("K0sFakeVsPt_denom", "K^{0}_{S} Fake Rate vs p_{T}", 70, 0., 20.);
101  nCandidates_[V0Validator::KSHORT] = ibooker.book1D("nK0s", "Number of K^{0}_{S} found per event", 60, 0., 60.);
103  ibooker.book1D("ksMassFake", "Mass of fake K0S", ksMassNbins, minKsMass, maxKsMass);
105  ibooker.book1D("ksMassGood", "Mass of good reco K0S", ksMassNbins, minKsMass, maxKsMass);
107  ibooker.book1D("ksMassAll", "Invariant mass of all K0S", ksMassNbins, ksMassXmin, ksMassXmax);
109  ibooker.book1D("radDistFakeKs", "Production radius of daughter particle of Ks fake", 100, 0., 15.);
110  candidateStatus_[V0Validator::KSHORT] = ibooker.book1D("ksCandStatus", "Fake type by cand status", 10, 0., 10.);
111 
112  // Lambda Plots follow
113 
114  subDirName = V0Validator::dirName + "/Lambda";
115  ibooker.setCurrentFolder(subDirName);
116 
118  ibooker.book1D("LamEffVsR_num", "#Lambda^{0} Efficiency vs #rho", 80, 0., 40.);
120  ibooker.book1D("LamEffVsEta_num", "#Lambda^{0} Efficiency vs #eta", 40, -2.5, 2.5);
122  ibooker.book1D("LamEffVsPt_num", "#Lambda^{0} Efficiency vs p_{T}", 70, 0., 20.);
123 
125  ibooker.book1D("LamTkEffVsR_num", "#Lambda^{0} TrackingEfficiency vs #rho", 80, 0., 40.);
127  ibooker.book1D("LamTkEffVsEta_num", "#Lambda^{0} Tracking Efficiency vs #eta", 40, -2.5, 2.5);
129  ibooker.book1D("LamTkEffVsPt_num", "#Lambda^{0} Tracking Efficiency vs p_{T}", 70, 0., 20.);
130 
132  ibooker.book1D("LamEffVsR_denom", "#Lambda^{0} Efficiency vs #rho", 80, 0., 40.);
134  ibooker.book1D("LamEffVsEta_denom", "#Lambda^{0} Efficiency vs #eta", 40, -2.5, 2.5);
136  ibooker.book1D("LamEffVsPt_denom", "#Lambda^{0} Efficiency vs p_{T}", 70, 0., 20.);
137 
139  ibooker.book1D("LamFakeVsR_num", "#Lambda^{0} Fake Rate vs #rho", 80, 0., 40.);
141  ibooker.book1D("LamFakeVsEta_num", "#Lambda^{0} Fake Rate vs #eta", 40, -2.5, 2.5);
143  ibooker.book1D("LamFakeVsPt_num", "#Lambda^{0} Fake Rate vs p_{T}", 70, 0., 20.);
145  ibooker.book1D("LamTkFakeVsR_num", "#Lambda^{0} Tracking Fake Rate vs #rho", 80, 0., 40.);
147  ibooker.book1D("LamTkFakeVsEta_num", "#Lambda^{0} Tracking Fake Rate vs #eta", 40, -2.5, 2.5);
149  ibooker.book1D("LamTkFakeVsPt_num", "#Lambda^{0} Tracking Fake Rate vs p_{T}", 70, 0., 20.);
150 
152  ibooker.book1D("LamFakeVsR_denom", "#Lambda^{0} Fake Rate vs #rho", 80, 0., 40.);
154  ibooker.book1D("LamFakeVsEta_denom", "#Lambda^{0} Fake Rate vs #eta", 40, -2.5, 2.5);
156  ibooker.book1D("LamFakeVsPt_denom", "#Lambda^{0} Fake Rate vs p_{T}", 70, 0., 20.);
157 
158  nCandidates_[V0Validator::LAMBDA] = ibooker.book1D("nLam", "Number of #Lambda^{0} found per event", 60, 0., 60.);
160  ibooker.book1D("lamMassFake", "Mass of fake Lambda", lamMassNbins, minLamMass, maxLamMass);
162  ibooker.book1D("lamMassGood", "Mass of good Lambda", lamMassNbins, minLamMass, maxLamMass);
163 
165  ibooker.book1D("lamMassAll", "Invariant mass of all #Lambda^{0}", lamMassNbins, lamMassXmin, lamMassXmax);
167  ibooker.book1D("radDistFakeLam", "Production radius of daughter particle of Lam fake", 100, 0., 15.);
168 
169  candidateStatus_[V0Validator::LAMBDA] = ibooker.book1D("ksCandStatus", "Fake type by cand status", 10, 0., 10.);
170 }

References dqm::implementation::IBooker::book1D(), candidateEffVsEta_denom_, candidateEffVsEta_num_, candidateEffVsPt_denom_, candidateEffVsPt_num_, candidateEffVsR_denom_, candidateEffVsR_num_, candidateFakeDauRadDist_, candidateFakeVsEta_denom_, candidateFakeVsEta_num_, candidateFakeVsPt_denom_, candidateFakeVsPt_num_, candidateFakeVsR_denom_, candidateFakeVsR_num_, candidateMassAll, candidateStatus_, candidateTkEffVsEta_num_, candidateTkEffVsPt_num_, candidateTkEffVsR_num_, candidateTkFakeVsEta_num_, candidateTkFakeVsPt_num_, candidateTkFakeVsR_num_, dqm::implementation::NavigatorBase::cd(), dirName, fakeCandidateMass_, goodCandidateMass, KSHORT, LAMBDA, nCandidates_, dqm::implementation::NavigatorBase::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ doEfficiencies()

void V0Validator::doEfficiencies ( const TrackingVertexCollection gen_vertices,
V0Type  t,
int  parent_particle_id,
int  first_daughter_id,
int  second_daughter_id,
const reco::VertexCompositeCandidateCollection collection,
const reco::SimToRecoCollection simtorecoCollection 
)
private

Definition at line 296 of file V0Validator.cc.

302  {
303  /* We store the TrackRef of the tracks that have been used to
304  * produce the V0 under consideration here. This is used later to
305  * check if a specific V0 has been really reconstructed or not. The
306  * ordering is based on the key_index of the reference, since it
307  * indeed does not matter that much. */
308 
309  std::set<V0Couple> reconstructed_V0_couples;
310  if (!collection.empty()) {
311  for (reco::VertexCompositeCandidateCollection::const_iterator iCandidate = collection.begin();
312  iCandidate != collection.end();
313  iCandidate++) {
314  reconstructed_V0_couples.insert(
315  V0Couple((dynamic_cast<const reco::RecoChargedCandidate*>(iCandidate->daughter(0)))->track(),
316  (dynamic_cast<const reco::RecoChargedCandidate*>(iCandidate->daughter(1)))->track()));
317  }
318  }
319 
320  /* PSEUDO CODE
321  for v in gen_vertices
322  if v.eventId().BX() !=0 continue
323  if v.nDaughterTracks != 2 continue
324  for source in v.sourceTracks_begin
325  if source is parent_particle_id
326  for daughter in v.daughterTracks_begin
327  if daughter in region_and_kine_cuts
328  decay_found
329  */
330  unsigned int candidateEff[2] = {0, 0};
331  for (auto const& gen_vertex : gen_vertices) {
332  if (gen_vertex.eventId().bunchCrossing() != 0)
333  continue; // Consider only in-time events
334  if (gen_vertex.nDaughterTracks() != 2)
335  continue; // Keep only V0 vertices
336  for (TrackingVertex::tp_iterator source = gen_vertex.sourceTracks_begin(); source != gen_vertex.sourceTracks_end();
337  ++source) {
338  if (std::abs((*source)->pdgId()) == parent_particle_id) {
339  if ((std::abs((gen_vertex.daughterTracks().at(0))->pdgId()) == first_daughter_id &&
340  std::abs((gen_vertex.daughterTracks().at(1))->pdgId()) == second_daughter_id) ||
341  (std::abs((gen_vertex.daughterTracks().at(0))->pdgId()) == second_daughter_id &&
342  std::abs((gen_vertex.daughterTracks().at(1))->pdgId()) == first_daughter_id)) {
343  if ((std::abs((gen_vertex.daughterTracks().at(0))->momentum().eta()) < 2.4 &&
344  gen_vertex.daughterTracks().at(0)->pt() > 0.9) &&
345  (std::abs((gen_vertex.daughterTracks().at(1))->momentum().eta()) < 2.4 &&
346  gen_vertex.daughterTracks().at(1)->pt() > 0.9)) {
347  // found desired generated Candidate
348  float candidateGenpT = sqrt((*source)->momentum().perp2());
349  float candidateGenEta = (*source)->momentum().eta();
350  float candidateGenR = sqrt((*source)->vertex().perp2());
351  candidateEffVsPt_denom_[v0_type]->Fill(candidateGenpT);
352  candidateEffVsEta_denom_[v0_type]->Fill(candidateGenEta);
353  candidateEffVsR_denom_[v0_type]->Fill(candidateGenR);
354 
355  std::array<reco::TrackRef, 2> reco_daughter;
356 
357  for (unsigned int daughter = 0; daughter < 2; ++daughter) {
358  if (simtorecoCollection.find(gen_vertex.daughterTracks()[daughter]) != simtorecoCollection.end()) {
359  if (!simtorecoCollection[gen_vertex.daughterTracks()[daughter]].empty()) {
360  candidateEff[daughter] = 1; // Found a daughter track
361  reco_daughter[daughter] =
362  simtorecoCollection[gen_vertex.daughterTracks()[daughter]].begin()->first.castTo<reco::TrackRef>();
363  }
364  } else {
365  candidateEff[daughter] = 2; // First daughter not found
366  }
367  }
368  if ((candidateEff[0] == 1 && candidateEff[1] == 1) && (reco_daughter[0].key() != reco_daughter[1].key()) &&
369  (reconstructed_V0_couples.find(V0Couple(reco_daughter[0], reco_daughter[1])) !=
370  reconstructed_V0_couples.end())) {
371  candidateEffVsPt_num_[v0_type]->Fill(candidateGenpT);
372  candidateEffVsEta_num_[v0_type]->Fill(candidateGenEta);
373  candidateEffVsR_num_[v0_type]->Fill(candidateGenR);
374  }
375  } // Check that daughters are inside the desired kinematic region
376  } // Check decay products of the current generatex vertex
377  } // Check pdgId of the source of the current generated vertex
378  } // Loop over all sources of the current generated vertex
379  } // Loop over all generated vertices
380 }

References funct::abs(), edm::AssociationMap< Tag >::begin(), candidateEffVsEta_denom_, candidateEffVsEta_num_, candidateEffVsPt_denom_, candidateEffVsPt_num_, candidateEffVsR_denom_, candidateEffVsR_num_, universalConfigTemplate::collection, edm::AssociationMap< Tag >::empty(), edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), EgammaValidation_cff::pdgId, source, and mathSSE::sqrt().

Referenced by analyze().

◆ doFakeRates()

void V0Validator::doFakeRates ( const reco::VertexCompositeCandidateCollection collection,
const reco::RecoToSimCollection recotosimCollection,
V0Type  t,
int  particle_pdgid,
int  misreconstructed_particle_pdgid 
)
private

Definition at line 172 of file V0Validator.cc.

176  {
177  using namespace edm;
178 
179  int numCandidateFound = 0;
180  int realCandidateFound = 0;
181  double mass = 0.;
182  float CandidatepT = 0.;
183  float CandidateEta = 0.;
184  float CandidateR = 0.;
185  int CandidateStatus = 0;
186  const unsigned int NUM_DAUGHTERS = 2;
187  if (!collection.empty()) {
188  for (reco::VertexCompositeCandidateCollection::const_iterator iCandidate = collection.begin();
189  iCandidate != collection.end();
190  iCandidate++) {
191  // Fill values to be histogrammed
192  mass = iCandidate->mass();
193  CandidatepT = (sqrt(iCandidate->momentum().perp2()));
194  CandidateEta = iCandidate->momentum().eta();
195  CandidateR = (sqrt(iCandidate->vertex().perp2()));
196  candidateMassAll[v0_type]->Fill(mass);
197  CandidateStatus = 0;
198 
199  std::array<reco::TrackRef, NUM_DAUGHTERS> theDaughterTracks = {
200  {(*(dynamic_cast<const reco::RecoChargedCandidate*>(iCandidate->daughter(0)))).track(),
201  (*(dynamic_cast<const reco::RecoChargedCandidate*>(iCandidate->daughter(1)))).track()}};
202 
203  TrackingParticleRef tpref;
204  TrackingParticleRef firstDauTP;
205  TrackingVertexRef candidateVtx;
206 
207  std::array<double, NUM_DAUGHTERS> radDist;
208  // Loop through candidate's daugher tracks
209  for (View<reco::Track>::size_type i = 0; i < theDaughterTracks.size(); ++i) {
210  radDist = {{-1., -1.}};
211  // Found track from theDaughterTracks
212  RefToBase<reco::Track> track(theDaughterTracks.at(i));
213 
214  if (recotosimCollection.find(track) != recotosimCollection.end()) {
215  const std::vector<std::pair<TrackingParticleRef, double> >& tp = recotosimCollection[track];
216  if (!tp.empty()) {
217  tpref = tp.begin()->first;
218 
219  TrackingVertexRef parentVertex = tpref->parentVertex();
220  if (parentVertex.isNonnull()) {
221  radDist[i] = parentVertex->position().R();
222  if (candidateVtx.isNonnull()) {
223  if (candidateVtx->position() == parentVertex->position()) {
224  if (parentVertex->nDaughterTracks() == 2) {
225  if (parentVertex->nSourceTracks() == 0) {
226  // No source tracks found for candidate's
227  // vertex: it shouldn't happen, but does for
228  // evtGen events
229  CandidateStatus = 6;
230  }
231 
232  for (TrackingVertex::tp_iterator iTP = parentVertex->sourceTracks_begin();
233  iTP != parentVertex->sourceTracks_end();
234  iTP++) {
235  if (abs((*iTP)->pdgId()) == particle_pdgid) {
236  CandidateStatus = 1;
237  realCandidateFound++;
238  numCandidateFound += 1.;
239  goodCandidateMass[v0_type]->Fill(mass);
240  } else {
241  CandidateStatus = 2;
242  if (abs((*iTP)->pdgId()) == misreconstructed_particle_pdgid) {
243  CandidateStatus = 7;
244  }
245  }
246  }
247  } else {
248  // Found a bad match because the mother has too
249  // many daughters
250  CandidateStatus = 3;
251  }
252  } else {
253  // Found a bad match because the parent vertices
254  // from the two tracks are different
255  CandidateStatus = 4;
256  }
257  } else {
258  // if candidateVtx is null, fill it with parentVertex
259  // to compare to the parentVertex from the second
260  // track
261  candidateVtx = parentVertex;
262  firstDauTP = tpref;
263  }
264  } // parent vertex is null
265  } // check on associated tp size zero
266  } else {
267  CandidateStatus = 5;
268  }
269  } // Loop on candidate's daughter tracks
270 
271  // fill the fake rate histograms
272  if (CandidateStatus > 1) {
273  candidateFakeVsR_num_[v0_type]->Fill(CandidateR);
274  candidateFakeVsEta_num_[v0_type]->Fill(CandidateEta);
275  candidateFakeVsPt_num_[v0_type]->Fill(CandidatepT);
276  candidateStatus_[v0_type]->Fill((float)CandidateStatus);
277  fakeCandidateMass_[v0_type]->Fill(mass);
278  for (auto distance : radDist) {
279  if (distance > 0)
280  candidateFakeDauRadDist_[v0_type]->Fill(distance);
281  }
282  }
283  if (CandidateStatus == 5) {
284  candidateTkFakeVsR_num_[v0_type]->Fill(CandidateR);
285  candidateTkFakeVsEta_num_[v0_type]->Fill(CandidateEta);
286  candidateTkFakeVsPt_num_[v0_type]->Fill(CandidatepT);
287  }
288  candidateFakeVsR_denom_[v0_type]->Fill(CandidateR);
289  candidateFakeVsEta_denom_[v0_type]->Fill(CandidateEta);
290  candidateFakeVsPt_denom_[v0_type]->Fill(CandidatepT);
291  } // Loop on candidates
292  } // check on presence of candidate's collection in the event
293  nCandidates_[v0_type]->Fill((float)numCandidateFound);
294 }

References funct::abs(), candidateFakeDauRadDist_, candidateFakeVsEta_denom_, candidateFakeVsEta_num_, candidateFakeVsPt_denom_, candidateFakeVsPt_num_, candidateFakeVsR_denom_, candidateFakeVsR_num_, candidateMassAll, candidateStatus_, candidateTkFakeVsEta_num_, candidateTkFakeVsPt_num_, candidateTkFakeVsR_num_, universalConfigTemplate::collection, HLT_FULL_cff::distance, edm::AssociationMap< Tag >::end(), fakeCandidateMass_, edm::AssociationMap< Tag >::find(), goodCandidateMass, mps_fire::i, edm::Ref< C, T, F >::isNonnull(), EgHLTOffHistBins_cfi::mass, nCandidates_, mathSSE::sqrt(), cmsswSequenceInfo::tp, and HLT_FULL_cff::track.

Referenced by analyze().

Member Data Documentation

◆ candidateEffVsEta_denom_

std::array<MonitorElement *, 2> V0Validator::candidateEffVsEta_denom_
private

Definition at line 132 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

◆ candidateEffVsEta_num_

std::array<MonitorElement *, 2> V0Validator::candidateEffVsEta_num_
private

Definition at line 116 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

◆ candidateEffVsPt_denom_

std::array<MonitorElement *, 2> V0Validator::candidateEffVsPt_denom_
private

Definition at line 133 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

◆ candidateEffVsPt_num_

std::array<MonitorElement *, 2> V0Validator::candidateEffVsPt_num_
private

Definition at line 117 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

◆ candidateEffVsR_denom_

std::array<MonitorElement *, 2> V0Validator::candidateEffVsR_denom_
private

Definition at line 131 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

◆ candidateEffVsR_num_

std::array<MonitorElement *, 2> V0Validator::candidateEffVsR_num_
private

Definition at line 115 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

◆ candidateFakeDauRadDist_

std::array<MonitorElement *, 2> V0Validator::candidateFakeDauRadDist_
private

Definition at line 138 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ candidateFakeVsEta_denom_

std::array<MonitorElement *, 2> V0Validator::candidateFakeVsEta_denom_
private

Definition at line 129 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ candidateFakeVsEta_num_

std::array<MonitorElement *, 2> V0Validator::candidateFakeVsEta_num_
private

Definition at line 122 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ candidateFakeVsPt_denom_

std::array<MonitorElement *, 2> V0Validator::candidateFakeVsPt_denom_
private

Definition at line 130 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ candidateFakeVsPt_num_

std::array<MonitorElement *, 2> V0Validator::candidateFakeVsPt_num_
private

Definition at line 123 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ candidateFakeVsR_denom_

std::array<MonitorElement *, 2> V0Validator::candidateFakeVsR_denom_
private

Definition at line 128 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ candidateFakeVsR_num_

std::array<MonitorElement *, 2> V0Validator::candidateFakeVsR_num_
private

Definition at line 121 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ candidateMassAll

std::array<MonitorElement *, 2> V0Validator::candidateMassAll
private

Definition at line 139 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ candidateStatus_

std::array<MonitorElement *, 2> V0Validator::candidateStatus_
private

Definition at line 136 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ candidateTkEffVsEta_num_

std::array<MonitorElement *, 2> V0Validator::candidateTkEffVsEta_num_
private

Definition at line 119 of file V0Validator.h.

Referenced by bookHistograms().

◆ candidateTkEffVsPt_num_

std::array<MonitorElement *, 2> V0Validator::candidateTkEffVsPt_num_
private

Definition at line 120 of file V0Validator.h.

Referenced by bookHistograms().

◆ candidateTkEffVsR_num_

std::array<MonitorElement *, 2> V0Validator::candidateTkEffVsR_num_
private

Definition at line 118 of file V0Validator.h.

Referenced by bookHistograms().

◆ candidateTkFakeVsEta_num_

std::array<MonitorElement *, 2> V0Validator::candidateTkFakeVsEta_num_
private

Definition at line 125 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ candidateTkFakeVsPt_num_

std::array<MonitorElement *, 2> V0Validator::candidateTkFakeVsPt_num_
private

Definition at line 126 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ candidateTkFakeVsR_num_

std::array<MonitorElement *, 2> V0Validator::candidateTkFakeVsR_num_
private

Definition at line 124 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ dirName

std::string V0Validator::dirName
private

Definition at line 143 of file V0Validator.h.

Referenced by bookHistograms(), and core.JSONAnalyzer.JSONAnalyzer::write().

◆ fakeCandidateMass_

std::array<MonitorElement *, 2> V0Validator::fakeCandidateMass_
private

Definition at line 137 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ goodCandidateMass

std::array<MonitorElement *, 2> V0Validator::goodCandidateMass
private

Definition at line 140 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ nCandidates_

std::array<MonitorElement *, 2> V0Validator::nCandidates_
private

Definition at line 135 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

◆ recoRecoToSimCollectionToken_

edm::EDGetTokenT<reco::RecoToSimCollection> V0Validator::recoRecoToSimCollectionToken_
private

Definition at line 144 of file V0Validator.h.

Referenced by analyze().

◆ recoSimToRecoCollectionToken_

edm::EDGetTokenT<reco::SimToRecoCollection> V0Validator::recoSimToRecoCollectionToken_
private

Definition at line 145 of file V0Validator.h.

Referenced by analyze().

◆ recoVertexCompositeCandidateCollection_k0s_Token_

edm::EDGetTokenT<reco::VertexCompositeCandidateCollection> V0Validator::recoVertexCompositeCandidateCollection_k0s_Token_
private

Definition at line 148 of file V0Validator.h.

Referenced by analyze().

◆ recoVertexCompositeCandidateCollection_lambda_Token_

edm::EDGetTokenT<reco::VertexCompositeCandidateCollection> V0Validator::recoVertexCompositeCandidateCollection_lambda_Token_
private

Definition at line 148 of file V0Validator.h.

Referenced by analyze().

◆ theDQMRootFileName

std::string V0Validator::theDQMRootFileName
private

Definition at line 142 of file V0Validator.h.

◆ trackingVertexCollection_Token_

edm::EDGetTokenT<TrackingVertexCollection> V0Validator::trackingVertexCollection_Token_
private

Definition at line 146 of file V0Validator.h.

Referenced by analyze().

◆ vec_recoVertex_Token_

edm::EDGetTokenT<std::vector<reco::Vertex> > V0Validator::vec_recoVertex_Token_
private

Definition at line 147 of file V0Validator.h.

Referenced by analyze().

V0Validator::recoSimToRecoCollectionToken_
edm::EDGetTokenT< reco::SimToRecoCollection > recoSimToRecoCollectionToken_
Definition: V0Validator.h:145
edm::AssociationMap::find
const_iterator find(const key_type &k) const
find element with specified reference key
Definition: AssociationMap.h:173
mps_fire.i
i
Definition: mps_fire.py:428
V0Validator::LAMBDA
Definition: V0Validator.h:83
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
V0Validator::candidateTkEffVsPt_num_
std::array< MonitorElement *, 2 > candidateTkEffVsPt_num_
Definition: V0Validator.h:120
V0Validator::dirName
std::string dirName
Definition: V0Validator.h:143
edm::Handle::product
T const * product() const
Definition: Handle.h:70
V0Validator::candidateEffVsPt_num_
std::array< MonitorElement *, 2 > candidateEffVsPt_num_
Definition: V0Validator.h:117
V0Validator::candidateFakeVsR_num_
std::array< MonitorElement *, 2 > candidateFakeVsR_num_
Definition: V0Validator.h:121
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
V0Validator::candidateTkEffVsEta_num_
std::array< MonitorElement *, 2 > candidateTkEffVsEta_num_
Definition: V0Validator.h:119
GlobalTrackingGeometryRecord
Definition: GlobalTrackingGeometryRecord.h:17
V0Validator::candidateEffVsR_denom_
std::array< MonitorElement *, 2 > candidateEffVsR_denom_
Definition: V0Validator.h:131
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
V0Validator::recoVertexCompositeCandidateCollection_k0s_Token_
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_k0s_Token_
Definition: V0Validator.h:148
edm::Handle
Definition: AssociativeIterator.h:50
V0Validator::candidateFakeDauRadDist_
std::array< MonitorElement *, 2 > candidateFakeDauRadDist_
Definition: V0Validator.h:138
V0Validator::goodCandidateMass
std::array< MonitorElement *, 2 > goodCandidateMass
Definition: V0Validator.h:140
edm::Ref< TrackCollection >
V0Validator::candidateTkEffVsR_num_
std::array< MonitorElement *, 2 > candidateTkEffVsR_num_
Definition: V0Validator.h:118
V0Validator::candidateEffVsEta_num_
std::array< MonitorElement *, 2 > candidateEffVsEta_num_
Definition: V0Validator.h:116
V0Validator::candidateFakeVsEta_num_
std::array< MonitorElement *, 2 > candidateFakeVsEta_num_
Definition: V0Validator.h:122
V0Validator::KSHORT
Definition: V0Validator.h:83
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
V0Validator::candidateFakeVsR_denom_
std::array< MonitorElement *, 2 > candidateFakeVsR_denom_
Definition: V0Validator.h:128
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
V0Validator::candidateTkFakeVsEta_num_
std::array< MonitorElement *, 2 > candidateTkFakeVsEta_num_
Definition: V0Validator.h:125
V0Validator::fakeCandidateMass_
std::array< MonitorElement *, 2 > fakeCandidateMass_
Definition: V0Validator.h:137
V0Validator::vec_recoVertex_Token_
edm::EDGetTokenT< std::vector< reco::Vertex > > vec_recoVertex_Token_
Definition: V0Validator.h:147
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
source
static const std::string source
Definition: EdmProvDump.cc:47
edm::ESHandle< MagneticField >
V0Validator::doFakeRates
void doFakeRates(const reco::VertexCompositeCandidateCollection &collection, const reco::RecoToSimCollection &recotosimCollection, V0Type t, int particle_pdgid, int misreconstructed_particle_pdgid)
Definition: V0Validator.cc:172
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
V0Validator::candidateTkFakeVsR_num_
std::array< MonitorElement *, 2 > candidateTkFakeVsR_num_
Definition: V0Validator.h:124
V0Validator::candidateFakeVsPt_denom_
std::array< MonitorElement *, 2 > candidateFakeVsPt_denom_
Definition: V0Validator.h:130
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
V0Validator::nCandidates_
std::array< MonitorElement *, 2 > nCandidates_
Definition: V0Validator.h:135
V0Validator::trackingVertexCollection_Token_
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollection_Token_
Definition: V0Validator.h:146
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
iEvent
int iEvent
Definition: GenABIO.cc:224
universalConfigTemplate.collection
collection
Definition: universalConfigTemplate.py:81
V0Validator::candidateFakeVsPt_num_
std::array< MonitorElement *, 2 > candidateFakeVsPt_num_
Definition: V0Validator.h:123
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:118
V0Validator::candidateTkFakeVsPt_num_
std::array< MonitorElement *, 2 > candidateTkFakeVsPt_num_
Definition: V0Validator.h:126
get
#define get
std
Definition: JetResolutionObject.h:76
V0Validator::candidateEffVsEta_denom_
std::array< MonitorElement *, 2 > candidateEffVsEta_denom_
Definition: V0Validator.h:132
V0Validator::candidateEffVsR_num_
std::array< MonitorElement *, 2 > candidateEffVsR_num_
Definition: V0Validator.h:115
edm::RefVectorIterator
Definition: EDProductfwd.h:33
edm::AssociationMap::begin
const_iterator begin() const
first iterator over the map (read only)
Definition: AssociationMap.h:169
V0Validator::candidateFakeVsEta_denom_
std::array< MonitorElement *, 2 > candidateFakeVsEta_denom_
Definition: V0Validator.h:129
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
edm::RefToBase< reco::Track >
v0validator_cfi.lambdaCollection
lambdaCollection
Definition: v0validator_cfi.py:7
V0Validator::recoRecoToSimCollectionToken_
edm::EDGetTokenT< reco::RecoToSimCollection > recoRecoToSimCollectionToken_
Definition: V0Validator.h:144
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
V0Validator::theDQMRootFileName
std::string theDQMRootFileName
Definition: V0Validator.h:142
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7799
V0Validator::candidateStatus_
std::array< MonitorElement *, 2 > candidateStatus_
Definition: V0Validator.h:136
V0Validator::candidateEffVsPt_denom_
std::array< MonitorElement *, 2 > candidateEffVsPt_denom_
Definition: V0Validator.h:133
edm::InputTag
Definition: InputTag.h:15
V0Validator::candidateMassAll
std::array< MonitorElement *, 2 > candidateMassAll
Definition: V0Validator.h:139
edm::View::size_type
unsigned int size_type
Definition: View.h:90
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
V0Validator::recoVertexCompositeCandidateCollection_lambda_Token_
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_lambda_Token_
Definition: V0Validator.h:148
V0Validator::doEfficiencies
void doEfficiencies(const TrackingVertexCollection &gen_vertices, V0Type t, int parent_particle_id, int first_daughter_id, int second_daughter_id, const reco::VertexCompositeCandidateCollection &collection, const reco::SimToRecoCollection &simtorecoCollection)
Definition: V0Validator.cc:296