30 iConfig.getUntrackedParameter<std::
string>(
"DQMRootFileName")),
31 dirName(iConfig.getUntrackedParameter<std::
string>(
"dirName")),
33 iConfig.getUntrackedParameter<edm::
InputTag>(
"trackAssociatorMap"))),
35 iConfig.getUntrackedParameter<edm::
InputTag>(
"trackAssociatorMap"))),
37 iConfig.getUntrackedParameter<edm::
InputTag>(
38 "trackingVertexCollection"))),
39 vec_recoVertex_Token_(consumes<std::vector<
reco::Vertex> >(
40 iConfig.getUntrackedParameter<edm::
InputTag>(
"vertexCollection"))),
41 recoVertexCompositeCandidateCollection_k0s_Token_(
43 iConfig.getUntrackedParameter<edm::
InputTag>(
44 "kShortCollection"))),
45 recoVertexCompositeCandidateCollection_lambda_Token_(
47 iConfig.getUntrackedParameter<edm::
InputTag>(
48 "lambdaCollection"))) {}
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;
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.);
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.);
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.);
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.);
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,
126 ibooker.
book1D(
"ksCandStatus",
"Fake type by cand status", 10, 0., 10.);
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.);
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.);
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.);
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.);
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.);
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);
189 ibooker.
book1D(
"lamMassAll",
"Invariant mass of all #Lambda^{0}",
190 lamMassNbins, lamMassXmin, lamMassXmax);
192 "radDistFakeLam",
"Production radius of daughter particle of Lam fake",
196 ibooker.
book1D(
"ksCandStatus",
"Fake type by cand status", 10, 0., 10.);
202 int particle_pdgid,
int misreconstructed_particle_pdgid) {
205 int numCandidateFound = 0;
206 int realCandidateFound = 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 =
216 iCandidate != collection.end(); iCandidate++) {
218 mass = iCandidate->mass();
219 CandidatepT = (
sqrt(iCandidate->momentum().perp2()));
220 CandidateEta = iCandidate->momentum().eta();
221 CandidateR = (
sqrt(iCandidate->vertex().perp2()));
225 std::array<reco::TrackRef, NUM_DAUGHTERS> theDaughterTracks = {
227 iCandidate->daughter(0)))).track(),
229 iCandidate->daughter(1)))).track()}};
235 std::array<double, NUM_DAUGHTERS> radDist;
239 radDist = {{-1., -1.}};
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;
251 radDist[
i] = parentVertex->position().R();
253 if (candidateVtx->position() == parentVertex->position()) {
254 if (parentVertex->nDaughterTracks() == 2) {
255 if (parentVertex->nSourceTracks() == 0) {
263 parentVertex->sourceTracks_begin();
264 iTP != parentVertex->sourceTracks_end(); iTP++) {
265 if ((*iTP)->pdgId() == particle_pdgid) {
267 realCandidateFound++;
268 numCandidateFound += 1.;
272 if ((*iTP)->pdgId() ==
273 misreconstructed_particle_pdgid) {
292 candidateVtx = parentVertex;
303 if (CandidateStatus > 1) {
313 if (CandidateStatus == 5) {
328 int parent_particle_id,
329 int first_daughter_id,
330 int second_daughter_id,
339 std::set<V0Couple> reconstructed_V0_couples;
340 if (collection.size() > 0) {
341 for (reco::VertexCompositeCandidateCollection::const_iterator iCandidate =
343 iCandidate != collection.end(); iCandidate++) {
344 reconstructed_V0_couples.insert(
345 V0Couple((dynamic_cast<const reco::RecoChargedCandidate*>(
346 iCandidate->daughter(0)))->track(),
348 iCandidate->daughter(1)))->track()));
362 unsigned int candidateEff[2] = {0, 0};
363 for (
auto const& gen_vertex : gen_vertices) {
364 if (gen_vertex.eventId().bunchCrossing() != 0)
366 if (gen_vertex.nDaughterTracks() != 2)
continue;
369 if (
std::abs((*source)->pdgId()) == parent_particle_id) {
370 if ((
std::abs((gen_vertex.daughterTracks().at(0))->
pdgId()) ==
373 second_daughter_id) ||
375 second_daughter_id &&
377 first_daughter_id)) {
378 if ((
std::abs((gen_vertex.daughterTracks().at(0))->momentum().eta()) <
380 gen_vertex.daughterTracks().at(0)->pt() > 0.9) &&
381 (
std::abs((gen_vertex.daughterTracks().at(1))->momentum().eta()) <
383 gen_vertex.daughterTracks().at(1)->pt() > 0.9)) {
385 float candidateGenpT =
sqrt((*source)->momentum().perp2());
386 float candidateGenEta = (*source)->momentum().eta();
387 float candidateGenR =
sqrt((*source)->vertex().perp2());
392 std::array<reco::TrackRef, 2> reco_daughter;
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]]
400 candidateEff[daughter] = 1;
401 reco_daughter[daughter] =
402 simtorecoCollection[gen_vertex.daughterTracks()[daughter]]
407 candidateEff[daughter] = 2;
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())) {
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()) {
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());
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());
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< VertexCompositeCandidate > VertexCompositeCandidateCollection
collection of Candidate objects
bool isNonnull() const
Checks for non-null.
edm::EDGetTokenT< reco::SimToRecoCollection > recoSimToRecoCollectionToken_
V0Validator(const edm::ParameterSet &)
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_k0s_Token_
std::array< MonitorElement *, 2 > candidateStatus_
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::RefVector< edm::HepMCProduct, HepMC::GenParticle > GenParticleRefVector
std::array< MonitorElement *, 2 > candidateEffVsEta_num_
std::array< MonitorElement *, 2 > candidateFakeVsEta_num_
const_iterator find(const key_type &k) const
find element with specified reference key
std::array< MonitorElement *, 2 > candidateFakeVsR_denom_
std::array< MonitorElement *, 2 > goodCandidateMass
std::array< MonitorElement *, 2 > candidateTkEffVsPt_num_
std::array< MonitorElement *, 2 > fakeCandidateMass_
std::array< MonitorElement *, 2 > candidateEffVsPt_num_
std::array< MonitorElement *, 2 > candidateEffVsR_denom_
std::array< MonitorElement *, 2 > candidateFakeVsR_num_
std::array< MonitorElement *, 2 > candidateFakeDauRadDist_
std::array< MonitorElement *, 2 > candidateTkFakeVsEta_num_
std::array< MonitorElement *, 2 > candidateTkEffVsEta_num_
edm::RefVector< edm::HepMCProduct, HepMC::GenVertex > GenVertexRefVector
std::array< MonitorElement *, 2 > candidateTkEffVsR_num_
std::array< MonitorElement *, 2 > candidateFakeVsPt_num_
std::array< MonitorElement *, 2 > candidateTkFakeVsR_num_
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollection_Token_
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
std::array< MonitorElement *, 2 > candidateTkFakeVsPt_num_
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< std::vector< reco::Vertex > > vec_recoVertex_Token_
std::array< MonitorElement *, 2 > nCandidates_
void doFakeRates(const reco::VertexCompositeCandidateCollection &collection, const reco::RecoToSimCollection &recotosimCollection, V0Type t, int particle_pdgid, int misreconstructed_particle_pdgid)
std::array< MonitorElement *, 2 > candidateFakeVsPt_denom_
edm::Ref< TrackingVertexCollection > TrackingVertexRef
void setCurrentFolder(const std::string &fullpath)
size_type size() const
map size
std::vector< TrackingVertex > TrackingVertexCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > > RecoToSimCollection
std::array< MonitorElement *, 2 > candidateFakeVsEta_denom_
std::array< MonitorElement *, 2 > candidateEffVsPt_denom_
std::array< MonitorElement *, 2 > candidateMassAll
edm::EDGetTokenT< reco::RecoToSimCollection > recoRecoToSimCollectionToken_
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > recoVertexCompositeCandidateCollection_lambda_Token_
edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > > SimToRecoCollection
std::array< MonitorElement *, 2 > candidateEffVsR_num_
const_iterator begin() const
first iterator over the map (read only)
std::array< MonitorElement *, 2 > candidateEffVsEta_denom_
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)
static std::string const source