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::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  V0Couple
 

Public Types

enum  V0Type { KSHORT, LAMBDA }
 
- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
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 Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 V0Validator (const edm::ParameterSet &)
 
 ~V0Validator ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual 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 std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 81 of file V0Validator.h.

Member Enumeration Documentation

Enumerator
KSHORT 
LAMBDA 

Definition at line 85 of file V0Validator.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file V0Validator.cc.

30  iConfig.getUntrackedParameter<std::string>("DQMRootFileName")),
31  dirName(iConfig.getUntrackedParameter<std::string>("dirName")),
32  recoRecoToSimCollectionToken_(consumes<reco::RecoToSimCollection>(
33  iConfig.getUntrackedParameter<edm::InputTag>("trackAssociatorMap"))),
34  recoSimToRecoCollectionToken_(consumes<reco::SimToRecoCollection>(
35  iConfig.getUntrackedParameter<edm::InputTag>("trackAssociatorMap"))),
36  trackingVertexCollection_Token_(consumes<TrackingVertexCollection>(
38  "trackingVertexCollection"))),
39  vec_recoVertex_Token_(consumes<std::vector<reco::Vertex> >(
40  iConfig.getUntrackedParameter<edm::InputTag>("vertexCollection"))),
42  consumes<reco::VertexCompositeCandidateCollection>(
44  "kShortCollection"))),
46  consumes<reco::VertexCompositeCandidateCollection>(
48  "lambdaCollection"))) {}
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::SimToRecoCollection > recoSimToRecoCollectionToken_
Definition: V0Validator.h:154
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_k0s_Token_
Definition: V0Validator.h:158
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollection_Token_
Definition: V0Validator.h:155
edm::EDGetTokenT< std::vector< reco::Vertex > > vec_recoVertex_Token_
Definition: V0Validator.h:156
std::string theDQMRootFileName
Definition: V0Validator.h:151
edm::EDGetTokenT< reco::RecoToSimCollection > recoRecoToSimCollectionToken_
Definition: V0Validator.h:153
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_lambda_Token_
Definition: V0Validator.h:158
std::string dirName
Definition: V0Validator.h:152
V0Validator::~V0Validator ( )

Definition at line 50 of file V0Validator.cc.

50 {}

Member Function Documentation

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

Definition at line 426 of file V0Validator.cc.

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

Referenced by V0Validator::V0Couple::operator==().

427  {
428  using std::cout;
429  using std::endl;
430  using namespace edm;
431  using namespace std;
432 
433  // Get event setup info, B-field and tracker geometry
434  ESHandle<MagneticField> bFieldHandle;
435  iSetup.get<IdealMagneticFieldRecord>().get(bFieldHandle);
436  ESHandle<GlobalTrackingGeometry> globTkGeomHandle;
437  iSetup.get<GlobalTrackingGeometryRecord>().get(globTkGeomHandle);
438 
439  // Make matching collections
440  Handle<reco::RecoToSimCollection> recotosimCollectionH;
441  iEvent.getByToken(recoRecoToSimCollectionToken_, recotosimCollectionH);
442 
443  Handle<reco::SimToRecoCollection> simtorecoCollectionH;
444  iEvent.getByToken(recoSimToRecoCollectionToken_, simtorecoCollectionH);
445 
446  // Get Monte Carlo information
448  iEvent.getByToken(trackingVertexCollection_Token_, TVCollectionH);
449 
450  // Select the primary vertex, create a new reco::Vertex to hold it
451  edm::Handle<std::vector<reco::Vertex> > primaryVtxCollectionH;
452  iEvent.getByToken(vec_recoVertex_Token_, primaryVtxCollectionH);
453 
454  std::vector<reco::Vertex>::const_iterator iVtxPH =
455  primaryVtxCollectionH->begin();
456  for (std::vector<reco::Vertex>::const_iterator iVtx =
457  primaryVtxCollectionH->begin();
458  iVtx < primaryVtxCollectionH->end(); iVtx++) {
459  if (primaryVtxCollectionH->size() > 1) {
460  if (iVtx->tracksSize() > iVtxPH->tracksSize()) {
461  iVtxPH = iVtx;
462  }
463  } else
464  iVtxPH = iVtx;
465  }
466 
467  // get the V0s;
471  k0sCollection);
473  lambdaCollection);
474 
475  // Do fake rate and efficiency calculation
476 
477  // Get gen vertex collection out of the event, as done in the Vertex
478  // validation package!!!
479  if (k0sCollection.isValid()) {
480  doFakeRates(*k0sCollection.product(), *recotosimCollectionH.product(),
481  V0Type::KSHORT, 310, 3122);
482  doEfficiencies(*TVCollectionH.product(), V0Type::KSHORT, 310, 211, 211,
483  *k0sCollection.product(), *simtorecoCollectionH.product());
484  }
485  if (lambdaCollection.isValid()) {
486  doFakeRates(*lambdaCollection.product(), *recotosimCollectionH.product(),
487  V0Type::LAMBDA, 3122, 310);
488  doEfficiencies(*TVCollectionH.product(), V0Type::LAMBDA, 3122, 211, 2212,
489  *lambdaCollection.product(),
490  *simtorecoCollectionH.product());
491  }
492 }
edm::EDGetTokenT< reco::SimToRecoCollection > recoSimToRecoCollectionToken_
Definition: V0Validator.h:154
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_k0s_Token_
Definition: V0Validator.h:158
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollection_Token_
Definition: V0Validator.h:155
edm::EDGetTokenT< std::vector< reco::Vertex > > vec_recoVertex_Token_
Definition: V0Validator.h:156
bool isValid() const
Definition: HandleBase.h:74
void doFakeRates(const reco::VertexCompositeCandidateCollection &collection, const reco::RecoToSimCollection &recotosimCollection, V0Type t, int particle_pdgid, int misreconstructed_particle_pdgid)
Definition: V0Validator.cc:199
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
HLT enums.
edm::EDGetTokenT< reco::RecoToSimCollection > recoRecoToSimCollectionToken_
Definition: V0Validator.h:153
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_lambda_Token_
Definition: V0Validator.h:158
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:326
void V0Validator::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 52 of file V0Validator.cc.

References DQMStore::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_, DQMStore::IBooker::cd(), dirName, fakeCandidateMass_, goodCandidateMass, KSHORT, LAMBDA, nCandidates_, DQMStore::IBooker::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by V0Validator::V0Couple::operator==().

53  {
54  double minKsMass = 0.49767 - 0.07;
55  double maxKsMass = 0.49767 + 0.07;
56  double minLamMass = 1.1156 - 0.05;
57  double maxLamMass = 1.1156 + 0.05;
58  int ksMassNbins = 100;
59  double ksMassXmin = minKsMass;
60  double ksMassXmax = maxKsMass;
61  int lamMassNbins = 100;
62  double lamMassXmin = minLamMass;
63  double lamMassXmax = maxLamMass;
64 
65  ibooker.cd();
66  std::string subDirName = V0Validator::dirName + "/K0";
67  ibooker.setCurrentFolder(subDirName.c_str());
68 
70  "K0sEffVsR_num", "K^{0}_{S} Efficiency vs #rho", 80, 0., 40.);
72  "K0sEffVsEta_num", "K^{0}_{S} Efficiency vs #eta", 40, -2.5, 2.5);
74  "K0sEffVsPt_num", "K^{0}_{S} Efficiency vs p_{T}", 70, 0., 20.);
75 
77  "K0sTkEffVsR_num", "K^{0}_{S} Tracking Efficiency vs #rho", 80, 0., 40.);
79  ibooker.book1D("K0sTkEffVsEta_num",
80  "K^{0}_{S} Tracking Efficiency vs #eta", 40, -2.5, 2.5);
82  ibooker.book1D("K0sTkEffVsPt_num",
83  "K^{0}_{S} Tracking Efficiency vs p_{T}", 70, 0., 20.);
84 
86  "K0sEffVsR_denom", "K^{0}_{S} Efficiency vs #rho", 80, 0., 40.);
88  "K0sEffVsEta_denom", "K^{0}_{S} Efficiency vs #eta", 40, -2.5, 2.5);
90  "K0sEffVsPt_denom", "K^{0}_{S} Efficiency vs p_{T}", 70, 0., 20.);
91 
93  "K0sFakeVsR_num", "K^{0}_{S} Fake Rate vs #rho", 80, 0., 40.);
95  "K0sFakeVsEta_num", "K^{0}_{S} Fake Rate vs #eta", 40, -2.5, 2.5);
97  "K0sFakeVsPt_num", "K^{0}_{S} Fake Rate vs p_{T}", 70, 0., 20.);
99  "K0sTkFakeVsR_num", "K^{0}_{S} Tracking Fake Rate vs #rho", 80, 0., 80.);
101  ibooker.book1D("K0sTkFakeVsEta_num",
102  "K^{0}_{S} Tracking Fake Rate vs #eta", 40, -2.5, 2.5);
104  ibooker.book1D("K0sTkFakeVsPt_num",
105  "K^{0}_{S} Tracking Fake Rate vs p_{T}", 70, 0., 20.);
106 
108  "K0sFakeVsR_denom", "K^{0}_{S} Fake Rate vs #rho", 80, 0., 40.);
110  "K0sFakeVsEta_denom", "K^{0}_{S} Fake Rate vs #eta", 40, -2.5, 2.5);
112  "K0sFakeVsPt_denom", "K^{0}_{S} Fake Rate vs p_{T}", 70, 0., 20.);
114  "nK0s", "Number of K^{0}_{S} found per event", 60, 0., 60.);
116  "ksMassFake", "Mass of fake K0S", ksMassNbins, minKsMass, maxKsMass);
118  "ksMassGood", "Mass of good reco K0S", ksMassNbins, minKsMass, maxKsMass);
120  ibooker.book1D("ksMassAll", "Invariant mass of all K0S", ksMassNbins,
121  ksMassXmin, ksMassXmax);
123  "radDistFakeKs", "Production radius of daughter particle of Ks fake", 100,
124  0., 15.);
126  ibooker.book1D("ksCandStatus", "Fake type by cand status", 10, 0., 10.);
127 
128  // Lambda Plots follow
129 
130  subDirName = V0Validator::dirName + "/Lambda";
131  ibooker.setCurrentFolder(subDirName.c_str());
132 
134  "LamEffVsR_num", "#Lambda^{0} Efficiency vs #rho", 80, 0., 40.);
136  "LamEffVsEta_num", "#Lambda^{0} Efficiency vs #eta", 40, -2.5, 2.5);
138  "LamEffVsPt_num", "#Lambda^{0} Efficiency vs p_{T}", 70, 0., 20.);
139 
141  "LamTkEffVsR_num", "#Lambda^{0} TrackingEfficiency vs #rho", 80, 0., 40.);
143  ibooker.book1D("LamTkEffVsEta_num",
144  "#Lambda^{0} Tracking Efficiency vs #eta", 40, -2.5, 2.5);
146  ibooker.book1D("LamTkEffVsPt_num",
147  "#Lambda^{0} Tracking Efficiency vs p_{T}", 70, 0., 20.);
148 
150  "LamEffVsR_denom", "#Lambda^{0} Efficiency vs #rho", 80, 0., 40.);
152  "LamEffVsEta_denom", "#Lambda^{0} Efficiency vs #eta", 40, -2.5, 2.5);
154  "LamEffVsPt_denom", "#Lambda^{0} Efficiency vs p_{T}", 70, 0., 20.);
155 
157  "LamFakeVsR_num", "#Lambda^{0} Fake Rate vs #rho", 80, 0., 40.);
159  "LamFakeVsEta_num", "#Lambda^{0} Fake Rate vs #eta", 40, -2.5, 2.5);
161  "LamFakeVsPt_num", "#Lambda^{0} Fake Rate vs p_{T}", 70, 0., 20.);
163  ibooker.book1D("LamTkFakeVsR_num",
164  "#Lambda^{0} Tracking Fake Rate vs #rho", 80, 0., 40.);
166  ibooker.book1D("LamTkFakeVsEta_num",
167  "#Lambda^{0} Tracking Fake Rate vs #eta", 40, -2.5, 2.5);
169  ibooker.book1D("LamTkFakeVsPt_num",
170  "#Lambda^{0} Tracking Fake Rate vs p_{T}", 70, 0., 20.);
171 
173  "LamFakeVsR_denom", "#Lambda^{0} Fake Rate vs #rho", 80, 0., 40.);
175  "LamFakeVsEta_denom", "#Lambda^{0} Fake Rate vs #eta", 40, -2.5, 2.5);
177  "LamFakeVsPt_denom", "#Lambda^{0} Fake Rate vs p_{T}", 70, 0., 20.);
178 
180  "nLam", "Number of #Lambda^{0} found per event", 60, 0., 60.);
182  ibooker.book1D("lamMassFake", "Mass of fake Lambda", lamMassNbins,
183  minLamMass, maxLamMass);
185  ibooker.book1D("lamMassGood", "Mass of good Lambda", lamMassNbins,
186  minLamMass, maxLamMass);
187 
189  ibooker.book1D("lamMassAll", "Invariant mass of all #Lambda^{0}",
190  lamMassNbins, lamMassXmin, lamMassXmax);
192  "radDistFakeLam", "Production radius of daughter particle of Lam fake",
193  100, 0., 15.);
194 
196  ibooker.book1D("ksCandStatus", "Fake type by cand status", 10, 0., 10.);
197 }
std::array< MonitorElement *, 2 > candidateStatus_
Definition: V0Validator.h:145
std::array< MonitorElement *, 2 > candidateEffVsEta_num_
Definition: V0Validator.h:125
void cd(void)
Definition: DQMStore.cc:269
std::array< MonitorElement *, 2 > candidateFakeVsEta_num_
Definition: V0Validator.h:131
std::array< MonitorElement *, 2 > candidateFakeVsR_denom_
Definition: V0Validator.h:137
std::array< MonitorElement *, 2 > goodCandidateMass
Definition: V0Validator.h:149
std::array< MonitorElement *, 2 > candidateTkEffVsPt_num_
Definition: V0Validator.h:129
std::array< MonitorElement *, 2 > fakeCandidateMass_
Definition: V0Validator.h:146
std::array< MonitorElement *, 2 > candidateEffVsPt_num_
Definition: V0Validator.h:126
std::array< MonitorElement *, 2 > candidateEffVsR_denom_
Definition: V0Validator.h:140
std::array< MonitorElement *, 2 > candidateFakeVsR_num_
Definition: V0Validator.h:130
std::array< MonitorElement *, 2 > candidateFakeDauRadDist_
Definition: V0Validator.h:147
std::array< MonitorElement *, 2 > candidateTkFakeVsEta_num_
Definition: V0Validator.h:134
std::array< MonitorElement *, 2 > candidateTkEffVsEta_num_
Definition: V0Validator.h:128
std::array< MonitorElement *, 2 > candidateTkEffVsR_num_
Definition: V0Validator.h:127
std::array< MonitorElement *, 2 > candidateFakeVsPt_num_
Definition: V0Validator.h:132
std::array< MonitorElement *, 2 > candidateTkFakeVsR_num_
Definition: V0Validator.h:133
std::array< MonitorElement *, 2 > candidateTkFakeVsPt_num_
Definition: V0Validator.h:135
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
std::array< MonitorElement *, 2 > nCandidates_
Definition: V0Validator.h:144
std::array< MonitorElement *, 2 > candidateFakeVsPt_denom_
Definition: V0Validator.h:139
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
std::array< MonitorElement *, 2 > candidateFakeVsEta_denom_
Definition: V0Validator.h:138
std::array< MonitorElement *, 2 > candidateEffVsPt_denom_
Definition: V0Validator.h:142
std::array< MonitorElement *, 2 > candidateMassAll
Definition: V0Validator.h:148
std::array< MonitorElement *, 2 > candidateEffVsR_num_
Definition: V0Validator.h:124
std::array< MonitorElement *, 2 > candidateEffVsEta_denom_
Definition: V0Validator.h:141
std::string dirName
Definition: V0Validator.h:152
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 326 of file V0Validator.cc.

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

Referenced by analyze(), and V0Validator::V0Couple::operator==().

332  {
333  /* We store the TrackRef of the tracks that have been used to
334  * produce the V0 under consideration here. This is used later to
335  * check if a specific V0 has been really reconstructed or not. The
336  * ordering is based on the key_index of the reference, since it
337  * indeed does not matter that much. */
338 
339  std::set<V0Couple> reconstructed_V0_couples;
340  if (collection.size() > 0) {
341  for (reco::VertexCompositeCandidateCollection::const_iterator iCandidate =
342  collection.begin();
343  iCandidate != collection.end(); iCandidate++) {
344  reconstructed_V0_couples.insert(
345  V0Couple((dynamic_cast<const reco::RecoChargedCandidate*>(
346  iCandidate->daughter(0)))->track(),
347  (dynamic_cast<const reco::RecoChargedCandidate*>(
348  iCandidate->daughter(1)))->track()));
349  }
350  }
351 
352  /* PSEUDO CODE
353  for v in gen_vertices
354  if v.eventId().BX() !=0 continue
355  if v.nDaughterTracks != 2 continue
356  for source in v.sourceTracks_begin
357  if source is parent_particle_id
358  for daughter in v.daughterTracks_begin
359  if daughter in region_and_kine_cuts
360  decay_found
361  */
362  unsigned int candidateEff[2] = {0, 0};
363  for (auto const& gen_vertex : gen_vertices) {
364  if (gen_vertex.eventId().bunchCrossing() != 0)
365  continue; // Consider only in-time events
366  if (gen_vertex.nDaughterTracks() != 2) continue; // Keep only V0 vertices
367  for (TrackingVertex::tp_iterator source = gen_vertex.sourceTracks_begin();
368  source != gen_vertex.sourceTracks_end(); ++source) {
369  if (std::abs((*source)->pdgId()) == parent_particle_id) {
370  if ((std::abs((gen_vertex.daughterTracks().at(0))->pdgId()) ==
371  first_daughter_id &&
372  std::abs((gen_vertex.daughterTracks().at(1))->pdgId()) ==
373  second_daughter_id) ||
374  (std::abs((gen_vertex.daughterTracks().at(0))->pdgId()) ==
375  second_daughter_id &&
376  std::abs((gen_vertex.daughterTracks().at(1))->pdgId()) ==
377  first_daughter_id)) {
378  if ((std::abs((gen_vertex.daughterTracks().at(0))->momentum().eta()) <
379  2.4 &&
380  gen_vertex.daughterTracks().at(0)->pt() > 0.9) &&
381  (std::abs((gen_vertex.daughterTracks().at(1))->momentum().eta()) <
382  2.4 &&
383  gen_vertex.daughterTracks().at(1)->pt() > 0.9)) {
384  // found desired generated Candidate
385  float candidateGenpT = sqrt((*source)->momentum().perp2());
386  float candidateGenEta = (*source)->momentum().eta();
387  float candidateGenR = sqrt((*source)->vertex().perp2());
388  candidateEffVsPt_denom_[v0_type]->Fill(candidateGenpT);
389  candidateEffVsEta_denom_[v0_type]->Fill(candidateGenEta);
390  candidateEffVsR_denom_[v0_type]->Fill(candidateGenR);
391 
392  std::array<reco::TrackRef, 2> reco_daughter;
393 
394  for (unsigned int daughter = 0; daughter < 2; ++daughter) {
395  if (simtorecoCollection.find(
396  gen_vertex.daughterTracks()[daughter]) !=
397  simtorecoCollection.end()) {
398  if (simtorecoCollection[gen_vertex.daughterTracks()[daughter]]
399  .size() != 0) {
400  candidateEff[daughter] = 1; // Found a daughter track
401  reco_daughter[daughter] =
402  simtorecoCollection[gen_vertex.daughterTracks()[daughter]]
403  .begin()
404  ->first.castTo<reco::TrackRef>();
405  }
406  } else {
407  candidateEff[daughter] = 2; // First daughter not found
408  }
409  }
410  if ((candidateEff[0] == 1 && candidateEff[1] == 1) &&
411  (reco_daughter[0].key() != reco_daughter[1].key()) &&
412  (reconstructed_V0_couples.find(
413  V0Couple(reco_daughter[0], reco_daughter[1])) !=
414  reconstructed_V0_couples.end())) {
415  candidateEffVsPt_num_[v0_type]->Fill(candidateGenpT);
416  candidateEffVsEta_num_[v0_type]->Fill(candidateGenEta);
417  candidateEffVsR_num_[v0_type]->Fill(candidateGenR);
418  }
419  } // Check that daughters are inside the desired kinematic region
420  } // Check decay products of the current generatex vertex
421  } // Check pdgId of the source of the current generated vertex
422  } // Loop over all sources of the current generated vertex
423  } // Loop over all generated vertices
424 }
const_iterator end() const
last iterator over the map (read only)
std::array< MonitorElement *, 2 > candidateEffVsEta_num_
Definition: V0Validator.h:125
const_iterator find(const key_type &k) const
find element with specified reference key
std::array< MonitorElement *, 2 > candidateEffVsPt_num_
Definition: V0Validator.h:126
std::array< MonitorElement *, 2 > candidateEffVsR_denom_
Definition: V0Validator.h:140
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
size_type size() const
map size
std::array< MonitorElement *, 2 > candidateEffVsPt_denom_
Definition: V0Validator.h:142
std::array< MonitorElement *, 2 > candidateEffVsR_num_
Definition: V0Validator.h:124
const_iterator begin() const
first iterator over the map (read only)
std::array< MonitorElement *, 2 > candidateEffVsEta_denom_
Definition: V0Validator.h:141
static std::string const source
Definition: EdmProvDump.cc:43
void V0Validator::doFakeRates ( const reco::VertexCompositeCandidateCollection collection,
const reco::RecoToSimCollection recotosimCollection,
V0Type  t,
int  particle_pdgid,
int  misreconstructed_particle_pdgid 
)
private

Definition at line 199 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_, SoftLeptonByDistance_cfi::distance, edm::AssociationMap< Tag >::end(), fakeCandidateMass_, edm::AssociationMap< Tag >::find(), goodCandidateMass, mps_fire::i, edm::Ref< C, T, F >::isNonnull(), ResonanceBuilder::mass, nCandidates_, mathSSE::sqrt(), and HiIsolationCommonParameters_cff::track.

Referenced by analyze(), and V0Validator::V0Couple::operator==().

202  {
203  using namespace edm;
204 
205  int numCandidateFound = 0;
206  int realCandidateFound = 0;
207  double mass = 0.;
208  float CandidatepT = 0.;
209  float CandidateEta = 0.;
210  float CandidateR = 0.;
211  int CandidateStatus = 0;
212  const unsigned int NUM_DAUGHTERS = 2;
213  if (collection.size() > 0) {
214  for (reco::VertexCompositeCandidateCollection::const_iterator iCandidate =
215  collection.begin();
216  iCandidate != collection.end(); iCandidate++) {
217  // Fill values to be histogrammed
218  mass = iCandidate->mass();
219  CandidatepT = (sqrt(iCandidate->momentum().perp2()));
220  CandidateEta = iCandidate->momentum().eta();
221  CandidateR = (sqrt(iCandidate->vertex().perp2()));
222  candidateMassAll[v0_type]->Fill(mass);
223  CandidateStatus = 0;
224 
225  std::array<reco::TrackRef, NUM_DAUGHTERS> theDaughterTracks = {
226  {(*(dynamic_cast<const reco::RecoChargedCandidate*>(
227  iCandidate->daughter(0)))).track(),
228  (*(dynamic_cast<const reco::RecoChargedCandidate*>(
229  iCandidate->daughter(1)))).track()}};
230 
231  TrackingParticleRef tpref;
232  TrackingParticleRef firstDauTP;
233  TrackingVertexRef candidateVtx;
234 
235  std::array<double, NUM_DAUGHTERS> radDist;
236  // Loop through candidate's daugher tracks
237  for (View<reco::Track>::size_type i = 0; i < theDaughterTracks.size();
238  ++i) {
239  radDist = {{-1., -1.}};
240  // Found track from theDaughterTracks
241  RefToBase<reco::Track> track(theDaughterTracks.at(i));
242 
243  if (recotosimCollection.find(track) != recotosimCollection.end()) {
244  const std::vector<std::pair<TrackingParticleRef, double> >& tp =
245  recotosimCollection[track];
246  if (tp.size() != 0) {
247  tpref = tp.begin()->first;
248 
249  TrackingVertexRef parentVertex = tpref->parentVertex();
250  if (parentVertex.isNonnull()) {
251  radDist[i] = parentVertex->position().R();
252  if (candidateVtx.isNonnull()) {
253  if (candidateVtx->position() == parentVertex->position()) {
254  if (parentVertex->nDaughterTracks() == 2) {
255  if (parentVertex->nSourceTracks() == 0) {
256  // No source tracks found for candidate's
257  // vertex: it shouldn't happen, but does for
258  // evtGen events
259  CandidateStatus = 6;
260  }
261 
262  for (TrackingVertex::tp_iterator iTP =
263  parentVertex->sourceTracks_begin();
264  iTP != parentVertex->sourceTracks_end(); iTP++) {
265  if (abs((*iTP)->pdgId()) == particle_pdgid) {
266  CandidateStatus = 1;
267  realCandidateFound++;
268  numCandidateFound += 1.;
269  goodCandidateMass[v0_type]->Fill(mass);
270  } else {
271  CandidateStatus = 2;
272  if (abs((*iTP)->pdgId()) ==
273  misreconstructed_particle_pdgid) {
274  CandidateStatus = 7;
275  }
276  }
277  }
278  } else {
279  // Found a bad match because the mother has too
280  // many daughters
281  CandidateStatus = 3;
282  }
283  } else {
284  // Found a bad match because the parent vertices
285  // from the two tracks are different
286  CandidateStatus = 4;
287  }
288  } else {
289  // if candidateVtx is null, fill it with parentVertex
290  // to compare to the parentVertex from the second
291  // track
292  candidateVtx = parentVertex;
293  firstDauTP = tpref;
294  }
295  } // parent vertex is null
296  } // check on associated tp size zero
297  } else {
298  CandidateStatus = 5;
299  }
300  } // Loop on candidate's daughter tracks
301 
302  // fill the fake rate histograms
303  if (CandidateStatus > 1) {
304  candidateFakeVsR_num_[v0_type]->Fill(CandidateR);
305  candidateFakeVsEta_num_[v0_type]->Fill(CandidateEta);
306  candidateFakeVsPt_num_[v0_type]->Fill(CandidatepT);
307  candidateStatus_[v0_type]->Fill((float)CandidateStatus);
308  fakeCandidateMass_[v0_type]->Fill(mass);
309  for (auto distance : radDist) {
310  if (distance > 0) candidateFakeDauRadDist_[v0_type]->Fill(distance);
311  }
312  }
313  if (CandidateStatus == 5) {
314  candidateTkFakeVsR_num_[v0_type]->Fill(CandidateR);
315  candidateTkFakeVsEta_num_[v0_type]->Fill(CandidateEta);
316  candidateTkFakeVsPt_num_[v0_type]->Fill(CandidatepT);
317  }
318  candidateFakeVsR_denom_[v0_type]->Fill(CandidateR);
319  candidateFakeVsEta_denom_[v0_type]->Fill(CandidateEta);
320  candidateFakeVsPt_denom_[v0_type]->Fill(CandidatepT);
321  } // Loop on candidates
322  } // check on presence of candidate's collection in the event
323  nCandidates_[v0_type]->Fill((float)numCandidateFound);
324 }
unsigned int size_type
Definition: View.h:90
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
std::array< MonitorElement *, 2 > candidateStatus_
Definition: V0Validator.h:145
const_iterator end() const
last iterator over the map (read only)
std::array< MonitorElement *, 2 > candidateFakeVsEta_num_
Definition: V0Validator.h:131
const_iterator find(const key_type &k) const
find element with specified reference key
std::array< MonitorElement *, 2 > candidateFakeVsR_denom_
Definition: V0Validator.h:137
std::array< MonitorElement *, 2 > goodCandidateMass
Definition: V0Validator.h:149
std::array< MonitorElement *, 2 > fakeCandidateMass_
Definition: V0Validator.h:146
std::array< MonitorElement *, 2 > candidateFakeVsR_num_
Definition: V0Validator.h:130
std::array< MonitorElement *, 2 > candidateFakeDauRadDist_
Definition: V0Validator.h:147
std::array< MonitorElement *, 2 > candidateTkFakeVsEta_num_
Definition: V0Validator.h:134
T sqrt(T t)
Definition: SSEVec.h:18
std::array< MonitorElement *, 2 > candidateFakeVsPt_num_
Definition: V0Validator.h:132
std::array< MonitorElement *, 2 > candidateTkFakeVsR_num_
Definition: V0Validator.h:133
std::array< MonitorElement *, 2 > candidateTkFakeVsPt_num_
Definition: V0Validator.h:135
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::array< MonitorElement *, 2 > nCandidates_
Definition: V0Validator.h:144
std::array< MonitorElement *, 2 > candidateFakeVsPt_denom_
Definition: V0Validator.h:139
std::array< MonitorElement *, 2 > candidateFakeVsEta_denom_
Definition: V0Validator.h:138
HLT enums.
std::array< MonitorElement *, 2 > candidateMassAll
Definition: V0Validator.h:148

Member Data Documentation

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

Definition at line 141 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

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

Definition at line 125 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

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

Definition at line 142 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

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

Definition at line 126 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

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

Definition at line 140 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

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

Definition at line 124 of file V0Validator.h.

Referenced by bookHistograms(), and doEfficiencies().

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

Definition at line 147 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 138 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 131 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 139 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 132 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 137 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 130 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 148 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 145 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 128 of file V0Validator.h.

Referenced by bookHistograms().

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

Definition at line 129 of file V0Validator.h.

Referenced by bookHistograms().

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

Definition at line 127 of file V0Validator.h.

Referenced by bookHistograms().

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

Definition at line 134 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 135 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 133 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

std::string V0Validator::dirName
private

Definition at line 152 of file V0Validator.h.

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

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

Definition at line 146 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 149 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 144 of file V0Validator.h.

Referenced by bookHistograms(), and doFakeRates().

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

Definition at line 153 of file V0Validator.h.

Referenced by analyze().

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

Definition at line 154 of file V0Validator.h.

Referenced by analyze().

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

Definition at line 158 of file V0Validator.h.

Referenced by analyze().

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

Definition at line 158 of file V0Validator.h.

Referenced by analyze().

std::string V0Validator::theDQMRootFileName
private

Definition at line 151 of file V0Validator.h.

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

Definition at line 155 of file V0Validator.h.

Referenced by analyze().

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

Definition at line 156 of file V0Validator.h.

Referenced by analyze().