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

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

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.

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"))) {}
edm::EDGetTokenT< reco::SimToRecoCollection > recoSimToRecoCollectionToken_
Definition: V0Validator.h:145
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_k0s_Token_
Definition: V0Validator.h:148
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollection_Token_
Definition: V0Validator.h:146
edm::EDGetTokenT< std::vector< reco::Vertex > > vec_recoVertex_Token_
Definition: V0Validator.h:147
std::string theDQMRootFileName
Definition: V0Validator.h:142
edm::EDGetTokenT< reco::RecoToSimCollection > recoRecoToSimCollectionToken_
Definition: V0Validator.h:144
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_lambda_Token_
Definition: V0Validator.h:148
std::string dirName
Definition: V0Validator.h:143

◆ ~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 380 of file V0Validator.cc.

References gather_cfg::cout, doEfficiencies(), doFakeRates(), 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_.

380  {
381  using std::cout;
382  using std::endl;
383  using namespace edm;
384  using namespace std;
385 
386  // Make matching collections
387  Handle<reco::RecoToSimCollection> recotosimCollectionH;
388  iEvent.getByToken(recoRecoToSimCollectionToken_, recotosimCollectionH);
389 
390  Handle<reco::SimToRecoCollection> simtorecoCollectionH;
391  iEvent.getByToken(recoSimToRecoCollectionToken_, simtorecoCollectionH);
392 
393  // Get Monte Carlo information
395  iEvent.getByToken(trackingVertexCollection_Token_, TVCollectionH);
396 
397  // Select the primary vertex, create a new reco::Vertex to hold it
398  edm::Handle<std::vector<reco::Vertex> > primaryVtxCollectionH;
399  iEvent.getByToken(vec_recoVertex_Token_, primaryVtxCollectionH);
400 
401  std::vector<reco::Vertex>::const_iterator iVtxPH = primaryVtxCollectionH->begin();
402  for (std::vector<reco::Vertex>::const_iterator iVtx = primaryVtxCollectionH->begin();
403  iVtx < primaryVtxCollectionH->end();
404  iVtx++) {
405  if (primaryVtxCollectionH->size() > 1) {
406  if (iVtx->tracksSize() > iVtxPH->tracksSize()) {
407  iVtxPH = iVtx;
408  }
409  } else
410  iVtxPH = iVtx;
411  }
412 
413  // get the V0s;
418 
419  // Do fake rate and efficiency calculation
420 
421  // Get gen vertex collection out of the event, as done in the Vertex
422  // validation package!!!
423  if (k0sCollection.isValid()) {
424  doFakeRates(*k0sCollection.product(), *recotosimCollectionH.product(), V0Type::KSHORT, 310, 3122);
425  doEfficiencies(*TVCollectionH.product(),
426  V0Type::KSHORT,
427  310,
428  211,
429  211,
430  *k0sCollection.product(),
431  *simtorecoCollectionH.product());
432  }
433  if (lambdaCollection.isValid()) {
434  doFakeRates(*lambdaCollection.product(), *recotosimCollectionH.product(), V0Type::LAMBDA, 3122, 310);
435  doEfficiencies(*TVCollectionH.product(),
436  V0Type::LAMBDA,
437  3122,
438  211,
439  2212,
440  *lambdaCollection.product(),
441  *simtorecoCollectionH.product());
442  }
443 }
edm::EDGetTokenT< reco::SimToRecoCollection > recoSimToRecoCollectionToken_
Definition: V0Validator.h:145
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_k0s_Token_
Definition: V0Validator.h:148
T const * product() const
Definition: Handle.h:70
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollection_Token_
Definition: V0Validator.h:146
edm::EDGetTokenT< std::vector< reco::Vertex > > vec_recoVertex_Token_
Definition: V0Validator.h:147
void doFakeRates(const reco::VertexCompositeCandidateCollection &collection, const reco::RecoToSimCollection &recotosimCollection, V0Type t, int particle_pdgid, int misreconstructed_particle_pdgid)
Definition: V0Validator.cc:172
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
edm::EDGetTokenT< reco::RecoToSimCollection > recoRecoToSimCollectionToken_
Definition: V0Validator.h:144
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_lambda_Token_
Definition: V0Validator.h:148
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:294

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

Definition at line 45 of file V0Validator.cc.

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.

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 }
std::array< MonitorElement *, 2 > candidateStatus_
Definition: V0Validator.h:136
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::array< MonitorElement *, 2 > candidateEffVsEta_num_
Definition: V0Validator.h:116
std::array< MonitorElement *, 2 > candidateFakeVsEta_num_
Definition: V0Validator.h:122
std::array< MonitorElement *, 2 > candidateFakeVsR_denom_
Definition: V0Validator.h:128
std::array< MonitorElement *, 2 > goodCandidateMass
Definition: V0Validator.h:140
std::array< MonitorElement *, 2 > candidateTkEffVsPt_num_
Definition: V0Validator.h:120
std::array< MonitorElement *, 2 > fakeCandidateMass_
Definition: V0Validator.h:137
std::array< MonitorElement *, 2 > candidateEffVsPt_num_
Definition: V0Validator.h:117
std::array< MonitorElement *, 2 > candidateEffVsR_denom_
Definition: V0Validator.h:131
std::array< MonitorElement *, 2 > candidateFakeVsR_num_
Definition: V0Validator.h:121
std::array< MonitorElement *, 2 > candidateFakeDauRadDist_
Definition: V0Validator.h:138
std::array< MonitorElement *, 2 > candidateTkFakeVsEta_num_
Definition: V0Validator.h:125
std::array< MonitorElement *, 2 > candidateTkEffVsEta_num_
Definition: V0Validator.h:119
std::array< MonitorElement *, 2 > candidateTkEffVsR_num_
Definition: V0Validator.h:118
std::array< MonitorElement *, 2 > candidateFakeVsPt_num_
Definition: V0Validator.h:123
std::array< MonitorElement *, 2 > candidateTkFakeVsR_num_
Definition: V0Validator.h:124
std::array< MonitorElement *, 2 > candidateTkFakeVsPt_num_
Definition: V0Validator.h:126
std::array< MonitorElement *, 2 > nCandidates_
Definition: V0Validator.h:135
std::array< MonitorElement *, 2 > candidateFakeVsPt_denom_
Definition: V0Validator.h:130
std::array< MonitorElement *, 2 > candidateFakeVsEta_denom_
Definition: V0Validator.h:129
std::array< MonitorElement *, 2 > candidateEffVsPt_denom_
Definition: V0Validator.h:133
std::array< MonitorElement *, 2 > candidateMassAll
Definition: V0Validator.h:139
std::array< MonitorElement *, 2 > candidateEffVsR_num_
Definition: V0Validator.h:115
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
std::array< MonitorElement *, 2 > candidateEffVsEta_denom_
Definition: V0Validator.h:132
std::string dirName
Definition: V0Validator.h:143

◆ 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 294 of file V0Validator.cc.

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().

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

◆ 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.

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_2024v10_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_2024v10_cff::track.

Referenced by analyze().

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

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().