Skip to content

Commit 7510b16

Browse files
authored
Merge pull request #34 from gmelachr/from-CMSSW_15_1_0_pre3
BPH NanoAODs: increase precision and add decay modes
2 parents ea8a8a7 + eb7975f commit 7510b16

20 files changed

+1591
-280
lines changed

PhysicsTools/BPHNano/plugins/BPHTrackMerger.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,17 @@ void BPHTrackMerger::produce(edm::StreamID, edm::Event &evt, edm::EventSetup con
150150

151151
// clean tracks wrt to all muons
152152
int matchedToMuon = 0;
153+
int indexToMuon = -1;
154+
int mu_idx = -1;
153155
for (const pat::Muon &imutmp : *muons) {
156+
mu_idx++;
154157
for (unsigned int i = 0; i < imutmp.numberOfSourceCandidatePtrs(); ++i) {
155158
if (!((imutmp.sourceCandidatePtr(i)).isNonnull() && (imutmp.sourceCandidatePtr(i)).isAvailable()))
156159
continue;
157160

158161
const edm::Ptr<reco::Candidate> &source = imutmp.sourceCandidatePtr(i);
159162
if (source.id() == tracks.id() && source.key() == iTrk) {
163+
indexToMuon = mu_idx;
160164
matchedToMuon = 1;
161165
break;
162166
}
@@ -195,6 +199,7 @@ void BPHTrackMerger::produce(edm::StreamID, edm::Event &evt, edm::EventSetup con
195199
pcand.addUserFloat("DCASig", DCASig);
196200
pcand.addUserFloat("dzTrg", dzTrg);
197201
pcand.addUserInt("isMatchedToMuon", matchedToMuon);
202+
pcand.addUserInt("MatchedMuonIdx", indexToMuon);
198203
pcand.addUserInt("isMatchedToEle", matchedToEle);
199204
pcand.addUserInt("nValidHits", trk.bestTrack()->found());
200205
pcand.addUserInt("keyPacked", iTrk);

PhysicsTools/BPHNano/plugins/BToTrkLLBuilder.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ void BToTrkLLBuilder::produce(edm::StreamID, edm::Event &evt, edm::EventSetup co
122122
cand.addUserInt("l1_idx", l1_idx);
123123
cand.addUserInt("l2_idx", l2_idx);
124124
cand.addUserInt("trk_idx", k_idx);
125+
cand.addUserInt("ll_idx", ll_idx);
125126

126127
auto dr_info = bph::min_max_dr({l1_ptr, l2_ptr, k_ptr});
127128
cand.addUserFloat("min_dr", dr_info.first);
@@ -167,6 +168,19 @@ void BToTrkLLBuilder::produce(edm::StreamID, edm::Event &evt, edm::EventSetup co
167168
if (!post_vtx_selection_(cand))
168169
continue;
169170

171+
reco::BeamSpot beamSpot = *beamspot;
172+
TrajectoryStateClosestToPoint theDCAXBS = fitter.fitted_candidate_ttrk().trajectoryStateClosestToPoint(GlobalPoint(beamSpot.position().x(),beamSpot.position().y(),beamSpot.position().z()));
173+
double DCAB0BS = -99.;
174+
double DCAB0BSErr = -99.;
175+
176+
if (theDCAXBS.isValid() == true){
177+
DCAB0BS = theDCAXBS.perigeeParameters().transverseImpactParameter();
178+
DCAB0BSErr = theDCAXBS.perigeeError().transverseImpactParameterError();
179+
}
180+
cand.addUserFloat("dca", DCAB0BS);
181+
cand.addUserFloat("dcaErr", DCAB0BSErr);
182+
183+
170184
cand.addUserFloat("vtx_x", cand.vx());
171185
cand.addUserFloat("vtx_y", cand.vy());
172186
cand.addUserFloat("vtx_z", cand.vz());

PhysicsTools/BPHNano/plugins/BToTrkTrkLLBuilder.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ void BToTrkTrkLLBuilder::produce(edm::StreamID, edm::Event &evt, edm::EventSetup
134134
cand.addUserInt("trk1_idx", trk1_idx);
135135
cand.addUserInt("trk2_idx", trk2_idx);
136136
cand.addUserInt("ditrack_idx", ditracks_idx);
137+
cand.addUserInt("ll_idx", ll_idx);
137138

138139
auto lep1_p4 = l1_ptr->polarP4();
139140
auto lep2_p4 = l2_ptr->polarP4();
@@ -243,6 +244,19 @@ void BToTrkTrkLLBuilder::produce(edm::StreamID, edm::Event &evt, edm::EventSetup
243244
if (!post_vtx_selection_(cand))
244245
continue;
245246

247+
reco::BeamSpot beamSpot = *beamspot;
248+
TrajectoryStateClosestToPoint theDCAXBS = fitter.fitted_candidate_ttrk().trajectoryStateClosestToPoint(GlobalPoint(beamSpot.position().x(),beamSpot.position().y(),beamSpot.position().z()));
249+
double DCAB0BS = -99.;
250+
double DCAB0BSErr = -99.;
251+
252+
if (theDCAXBS.isValid() == true){
253+
DCAB0BS = theDCAXBS.perigeeParameters().transverseImpactParameter();
254+
DCAB0BSErr = theDCAXBS.perigeeError().transverseImpactParameterError();
255+
}
256+
cand.addUserFloat("dca", DCAB0BS);
257+
cand.addUserFloat("dcaErr", DCAB0BSErr);
258+
259+
246260
cand.addUserFloat("vtx_x", cand.vx());
247261
cand.addUserFloat("vtx_y", cand.vy());
248262
cand.addUserFloat("vtx_z", cand.vz());

PhysicsTools/BPHNano/plugins/BToV0LLBuilder.cc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ void BToV0LLBuilder::produce(edm::StreamID, edm::Event &evt, edm::EventSetup con
168168
if (!post_vtx_selection_(cand))
169169
continue;
170170

171+
reco::BeamSpot beamSpot = *beamspot;
172+
TrajectoryStateClosestToPoint theDCAXBS = fitter.fitted_candidate_ttrk().trajectoryStateClosestToPoint(GlobalPoint(beamSpot.position().x(),beamSpot.position().y(),beamSpot.position().z()));
173+
double DCAB0BS = -99.;
174+
double DCAB0BSErr = -99.;
175+
176+
if (theDCAXBS.isValid() == true){
177+
DCAB0BS = theDCAXBS.perigeeParameters().transverseImpactParameter();
178+
DCAB0BSErr = theDCAXBS.perigeeError().transverseImpactParameterError();
179+
}
180+
cand.addUserFloat("dca", DCAB0BS);
181+
cand.addUserFloat("dcaErr", DCAB0BSErr);
182+
171183
cand.addUserFloat("vtx_x", cand.vx());
172184
cand.addUserFloat("vtx_y", cand.vy());
173185
cand.addUserFloat("vtx_z", cand.vz());
@@ -307,7 +319,7 @@ void BToV0LLBuilder::produce(edm::StreamID, edm::Event &evt, edm::EventSetup con
307319
cand.addUserFloat("cstr_cos_theta_2D", cstr_cos_theta_2D);
308320

309321
ret_val->push_back(cand);
310-
}
322+
}// for(size_t ll_idx = 0; ll_idx < dileptons->size(); ++ll_idx) {
311323
}
312324
evt.put(std::move(ret_val));
313325
}

0 commit comments

Comments
 (0)