28 : theDQMRootFileName(iConfig.getUntrackedParameter<
std::
string>(
"DQMRootFileName")),
30 recoRecoToSimCollectionToken_(
32 recoSimToRecoCollectionToken_(
34 trackingVertexCollection_Token_(
36 vec_recoVertex_Token_(
39 iConfig.getUntrackedParameter<
edm::
InputTag>(
"kShortCollection"))),
41 iConfig.getUntrackedParameter<
edm::
InputTag>(
"lambdaCollection"))) {}
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;
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.);
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.);
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.);
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.);
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.);
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.);
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.);
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.);
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.);
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.);
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.);
160 ibooker.
book1D(
"lamMassFake",
"Mass of fake Lambda", lamMassNbins, minLamMass, maxLamMass);
162 ibooker.
book1D(
"lamMassGood",
"Mass of good Lambda", lamMassNbins, minLamMass, maxLamMass);
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.);
176 int misreconstructed_particle_pdgid) {
179 int numCandidateFound = 0;
180 int realCandidateFound = 0;
182 float CandidatepT = 0.;
183 float CandidateEta = 0.;
184 float CandidateR = 0.;
185 int CandidateStatus = 0;
186 const unsigned int NUM_DAUGHTERS = 2;
187 if (!collection.empty()) {
188 for (reco::VertexCompositeCandidateCollection::const_iterator iCandidate = collection.begin();
189 iCandidate != collection.end();
192 mass = iCandidate->mass();
193 CandidatepT = (
sqrt(iCandidate->momentum().perp2()));
194 CandidateEta = iCandidate->momentum().eta();
195 CandidateR = (
sqrt(iCandidate->vertex().perp2()));
199 std::array<reco::TrackRef, NUM_DAUGHTERS> theDaughterTracks = {
207 std::array<double, NUM_DAUGHTERS> radDist;
210 radDist = {{-1., -1.}};
214 if (recotosimCollection.
find(
track) != recotosimCollection.
end()) {
215 const std::vector<std::pair<TrackingParticleRef, double> >& tp = recotosimCollection[
track];
217 tpref = tp.begin()->first;
221 radDist[
i] = parentVertex->position().R();
223 if (candidateVtx->position() == parentVertex->position()) {
224 if (parentVertex->nDaughterTracks() == 2) {
225 if (parentVertex->nSourceTracks() == 0) {
233 iTP != parentVertex->sourceTracks_end();
235 if (
abs((*iTP)->pdgId()) == particle_pdgid) {
237 realCandidateFound++;
238 numCandidateFound += 1.;
242 if (
abs((*iTP)->pdgId()) == misreconstructed_particle_pdgid) {
261 candidateVtx = parentVertex;
272 if (CandidateStatus > 1) {
283 if (CandidateStatus == 5) {
298 int parent_particle_id,
299 int first_daughter_id,
300 int second_daughter_id,
309 std::set<V0Couple> reconstructed_V0_couples;
310 if (!collection.empty()) {
311 for (reco::VertexCompositeCandidateCollection::const_iterator iCandidate = collection.begin();
312 iCandidate != collection.end();
314 reconstructed_V0_couples.insert(
315 V0Couple((dynamic_cast<const reco::RecoChargedCandidate*>(iCandidate->daughter(0)))->track(),
330 unsigned int candidateEff[2] = {0, 0};
331 for (
auto const& gen_vertex : gen_vertices) {
332 if (gen_vertex.eventId().bunchCrossing() != 0)
334 if (gen_vertex.nDaughterTracks() != 2)
338 if (
std::abs((*source)->pdgId()) == parent_particle_id) {
339 if ((
std::abs((gen_vertex.daughterTracks().at(0))->
pdgId()) == first_daughter_id &&
340 std::abs((gen_vertex.daughterTracks().at(1))->
pdgId()) == second_daughter_id) ||
341 (
std::abs((gen_vertex.daughterTracks().at(0))->
pdgId()) == second_daughter_id &&
342 std::abs((gen_vertex.daughterTracks().at(1))->
pdgId()) == first_daughter_id)) {
343 if ((
std::abs((gen_vertex.daughterTracks().at(0))->momentum().eta()) < 2.4 &&
344 gen_vertex.daughterTracks().at(0)->pt() > 0.9) &&
345 (
std::abs((gen_vertex.daughterTracks().at(1))->momentum().eta()) < 2.4 &&
346 gen_vertex.daughterTracks().at(1)->pt() > 0.9)) {
348 float candidateGenpT =
sqrt((*source)->momentum().perp2());
349 float candidateGenEta = (*source)->momentum().eta();
350 float candidateGenR =
sqrt((*source)->vertex().perp2());
355 std::array<reco::TrackRef, 2> reco_daughter;
357 for (
unsigned int daughter = 0; daughter < 2; ++daughter) {
358 if (simtorecoCollection.
find(gen_vertex.daughterTracks()[daughter]) != simtorecoCollection.
end()) {
359 if (!simtorecoCollection[gen_vertex.daughterTracks()[daughter]].
empty()) {
360 candidateEff[daughter] = 1;
361 reco_daughter[daughter] =
362 simtorecoCollection[gen_vertex.daughterTracks()[daughter]].
begin()->first.castTo<
reco::TrackRef>();
365 candidateEff[daughter] = 2;
368 if ((candidateEff[0] == 1 && candidateEff[1] == 1) && (reco_daughter[0].key() != reco_daughter[1].key()) &&
369 (reconstructed_V0_couples.find(
V0Couple(reco_daughter[0], reco_daughter[1])) !=
370 reconstructed_V0_couples.end())) {
409 std::vector<reco::Vertex>::const_iterator iVtxPH = primaryVtxCollectionH->begin();
410 for (std::vector<reco::Vertex>::const_iterator iVtx = primaryVtxCollectionH->begin();
411 iVtx < primaryVtxCollectionH->end();
413 if (primaryVtxCollectionH->size() > 1) {
414 if (iVtx->tracksSize() > iVtxPH->tracksSize()) {
439 *simtorecoCollectionH.
product());
441 if (lambdaCollection.
isValid()) {
449 *simtorecoCollectionH.
product());
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
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_
void setCurrentFolder(std::string const &fullpath)
bool empty() const
return true if empty
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::Ref< TrackingVertexCollection > TrackingVertexRef
edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > > SimToRecoCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > > RecoToSimCollection
std::array< MonitorElement *, 2 > candidateTkEffVsR_num_
std::array< MonitorElement *, 2 > candidateFakeVsPt_num_
std::array< MonitorElement *, 2 > candidateTkFakeVsR_num_
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollection_Token_
void analyze(const edm::Event &, const edm::EventSetup &) override
std::array< MonitorElement *, 2 > candidateTkFakeVsPt_num_
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_
T const * product() const
std::vector< TrackingVertex > TrackingVertexCollection
edm::RefVector< edm::HepMCProduct, HepMC::GenVertex > GenVertexRefVector
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_
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
std::vector< TrackingVertex > TrackingVertexCollection