|
28 | 28 | #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
|
29 | 29 | #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
|
30 | 30 | #include "helper.h"
|
| 31 | +#include "FWCore/MessageLogger/interface/MessageLogger.h" |
31 | 32 |
|
32 | 33 | class BToTrkTrkLLBuilder : public edm::global::EDProducer<> {
|
33 | 34 | // perhaps we need better structure here (begin run etc)
|
@@ -133,7 +134,10 @@ void BToTrkTrkLLBuilder::produce(edm::StreamID, edm::Event &evt, edm::EventSetup
|
133 | 134 | cand.addUserInt("l2_idx", l2_idx);
|
134 | 135 | cand.addUserInt("trk1_idx", trk1_idx);
|
135 | 136 | cand.addUserInt("trk2_idx", trk2_idx);
|
136 |
| - cand.addUserInt("ditrack_idx", ditracks_idx); |
| 137 | + // cand.addUserInt("ditrack_idx", ditracks_idx); this index corresponds to the ditrack collection. |
| 138 | + // However, in order to refuce the event size, we do not store all the ditrack candidates but only those used to build a B candidate. |
| 139 | + // So, now, index of B candidate is the same number for index of ditrack candidate |
| 140 | + // This variable is not removed from the code in case we decide to store in the future all the ditrack candidates. |
137 | 141 | cand.addUserInt("ll_idx", ll_idx);
|
138 | 142 |
|
139 | 143 | auto lep1_p4 = l1_ptr->polarP4();
|
@@ -162,28 +166,49 @@ void BToTrkTrkLLBuilder::produce(edm::StreamID, edm::Event &evt, edm::EventSetup
|
162 | 166 | if (!pre_vtx_selection_(cand))
|
163 | 167 | continue;
|
164 | 168 |
|
165 |
| - KinVtxFitter fitter({leptons_ttracks->at(l1_idx), |
166 |
| - leptons_ttracks->at(l2_idx), |
167 |
| - ditracks_ttracks->at(trk1_idx), |
168 |
| - ditracks_ttracks->at(trk2_idx)}, |
169 |
| - {l1_ptr->mass(), l2_ptr->mass(), bph::K_MASS, bph::K_MASS}, |
170 |
| - {bph::LEP_SIGMA, bph::LEP_SIGMA, bph::K_SIGMA, bph::K_SIGMA}); |
171 |
| - if (!fitter.success()) |
172 |
| - continue; |
173 |
| - KinVtxFitter fitter_Kpi({leptons_ttracks->at(l1_idx), |
| 169 | + KinVtxFitter fitter; |
| 170 | + try { |
| 171 | + fitter = KinVtxFitter({leptons_ttracks->at(l1_idx), |
174 | 172 | leptons_ttracks->at(l2_idx),
|
175 | 173 | ditracks_ttracks->at(trk1_idx),
|
176 | 174 | ditracks_ttracks->at(trk2_idx)},
|
177 |
| - {l1_ptr->mass(), l2_ptr->mass(), bph::K_MASS, bph::PI_MASS}, |
| 175 | + {l1_ptr->mass(), l2_ptr->mass(), bph::K_MASS, bph::K_MASS}, |
178 | 176 | {bph::LEP_SIGMA, bph::LEP_SIGMA, bph::K_SIGMA, bph::K_SIGMA});
|
| 177 | + } catch (const VertexException &e) { |
| 178 | + edm::LogWarning("KinematicFit") << "BToTrkTrkLL - KK mass hypothesis: Skipping candidate due to fit failure: " |
| 179 | + << e.what(); |
| 180 | + continue; |
| 181 | + } |
| 182 | + if (!fitter.success()) |
| 183 | + continue; |
| 184 | + KinVtxFitter fitter_Kpi; |
| 185 | + try { |
| 186 | + fitter_Kpi = KinVtxFitter({leptons_ttracks->at(l1_idx), |
| 187 | + leptons_ttracks->at(l2_idx), |
| 188 | + ditracks_ttracks->at(trk1_idx), |
| 189 | + ditracks_ttracks->at(trk2_idx)}, |
| 190 | + {l1_ptr->mass(), l2_ptr->mass(), bph::K_MASS, bph::PI_MASS}, |
| 191 | + {bph::LEP_SIGMA, bph::LEP_SIGMA, bph::K_SIGMA, bph::K_SIGMA}); |
| 192 | + } catch (const VertexException &e) { |
| 193 | + edm::LogWarning("KinematicFit") << "BToTrkTrkLL - Kpi mass hypothesis: Skipping candidate due to fit failure: " |
| 194 | + << e.what(); |
| 195 | + continue; |
| 196 | + } |
179 | 197 | if (!fitter_Kpi.success())
|
180 | 198 | continue;
|
181 |
| - KinVtxFitter fitter_piK({leptons_ttracks->at(l1_idx), |
182 |
| - leptons_ttracks->at(l2_idx), |
183 |
| - ditracks_ttracks->at(trk1_idx), |
184 |
| - ditracks_ttracks->at(trk2_idx)}, |
185 |
| - {l1_ptr->mass(), l2_ptr->mass(), bph::PI_MASS, bph::K_MASS}, |
186 |
| - {bph::LEP_SIGMA, bph::LEP_SIGMA, bph::K_SIGMA, bph::K_SIGMA}); |
| 199 | + KinVtxFitter fitter_piK; |
| 200 | + try { |
| 201 | + fitter_piK = KinVtxFitter({leptons_ttracks->at(l1_idx), |
| 202 | + leptons_ttracks->at(l2_idx), |
| 203 | + ditracks_ttracks->at(trk1_idx), |
| 204 | + ditracks_ttracks->at(trk2_idx)}, |
| 205 | + {l1_ptr->mass(), l2_ptr->mass(), bph::PI_MASS, bph::K_MASS}, |
| 206 | + {bph::LEP_SIGMA, bph::LEP_SIGMA, bph::K_SIGMA, bph::K_SIGMA}); |
| 207 | + } catch (const VertexException &e) { |
| 208 | + edm::LogWarning("KinematicFit") << "BToTrkTrkLL - piK mass hypothesis: Skipping candidate due to fit failure: " |
| 209 | + << e.what(); |
| 210 | + continue; |
| 211 | + } |
187 | 212 | if (!fitter_piK.success())
|
188 | 213 | continue;
|
189 | 214 |
|
@@ -310,31 +335,55 @@ void BToTrkTrkLLBuilder::produce(edm::StreamID, edm::Event &evt, edm::EventSetup
|
310 | 335 | // "particles" vector Make sure that the first two particles are the
|
311 | 336 | // ones you want to constrain
|
312 | 337 |
|
313 |
| - KinVtxFitter constraint_fitter_KK({leptons_ttracks->at(l1_idx), |
314 |
| - leptons_ttracks->at(l2_idx), |
315 |
| - ditracks_ttracks->at(trk1_idx), |
316 |
| - ditracks_ttracks->at(trk2_idx)}, |
317 |
| - {l1_ptr->mass(), l2_ptr->mass(), bph::K_MASS, bph::K_MASS}, |
318 |
| - {bph::LEP_SIGMA, bph::LEP_SIGMA, bph::K_SIGMA, bph::K_SIGMA}, |
319 |
| - mass_constraint); |
| 338 | + KinVtxFitter constraint_fitter_KK; |
| 339 | + try { |
| 340 | + constraint_fitter_KK = KinVtxFitter({leptons_ttracks->at(l1_idx), |
| 341 | + leptons_ttracks->at(l2_idx), |
| 342 | + ditracks_ttracks->at(trk1_idx), |
| 343 | + ditracks_ttracks->at(trk2_idx)}, |
| 344 | + {l1_ptr->mass(), l2_ptr->mass(), bph::K_MASS, bph::K_MASS}, |
| 345 | + {bph::LEP_SIGMA, bph::LEP_SIGMA, bph::K_SIGMA, bph::K_SIGMA}, |
| 346 | + mass_constraint); |
| 347 | + } catch (const VertexException &e) { |
| 348 | + edm::LogWarning("KinematicFit") |
| 349 | + << "BToTrkTrkLL - KK mass hypothesis constrained fit: Skipping candidate due to fit failure: " |
| 350 | + << e.what(); |
| 351 | + continue; |
| 352 | + } |
320 | 353 | if (!constraint_fitter_KK.success())
|
321 | 354 | continue;
|
322 |
| - KinVtxFitter constraint_fitter_Kpi({leptons_ttracks->at(l1_idx), |
323 |
| - leptons_ttracks->at(l2_idx), |
324 |
| - ditracks_ttracks->at(trk1_idx), |
325 |
| - ditracks_ttracks->at(trk2_idx)}, |
326 |
| - {l1_ptr->mass(), l2_ptr->mass(), bph::K_MASS, bph::PI_MASS}, |
327 |
| - {bph::LEP_SIGMA, bph::LEP_SIGMA, bph::K_SIGMA, bph::K_SIGMA}, |
328 |
| - mass_constraint); |
| 355 | + KinVtxFitter constraint_fitter_Kpi; |
| 356 | + try { |
| 357 | + constraint_fitter_Kpi = KinVtxFitter({leptons_ttracks->at(l1_idx), |
| 358 | + leptons_ttracks->at(l2_idx), |
| 359 | + ditracks_ttracks->at(trk1_idx), |
| 360 | + ditracks_ttracks->at(trk2_idx)}, |
| 361 | + {l1_ptr->mass(), l2_ptr->mass(), bph::K_MASS, bph::PI_MASS}, |
| 362 | + {bph::LEP_SIGMA, bph::LEP_SIGMA, bph::K_SIGMA, bph::K_SIGMA}, |
| 363 | + mass_constraint); |
| 364 | + } catch (const VertexException &e) { |
| 365 | + edm::LogWarning("KinematicFit") |
| 366 | + << "BToTrkTrkLL - Kpi mass hypothesis constrained fit: Skipping candidate due to fit failure: " |
| 367 | + << e.what(); |
| 368 | + continue; |
| 369 | + } |
329 | 370 | if (!constraint_fitter_Kpi.success())
|
330 | 371 | continue;
|
331 |
| - KinVtxFitter constraint_fitter_piK({leptons_ttracks->at(l1_idx), |
332 |
| - leptons_ttracks->at(l2_idx), |
333 |
| - ditracks_ttracks->at(trk1_idx), |
334 |
| - ditracks_ttracks->at(trk2_idx)}, |
335 |
| - {l1_ptr->mass(), l2_ptr->mass(), bph::PI_MASS, bph::K_MASS}, |
336 |
| - {bph::LEP_SIGMA, bph::LEP_SIGMA, bph::K_SIGMA, bph::K_SIGMA}, |
337 |
| - mass_constraint); |
| 372 | + KinVtxFitter constraint_fitter_piK; |
| 373 | + try { |
| 374 | + constraint_fitter_piK = KinVtxFitter({leptons_ttracks->at(l1_idx), |
| 375 | + leptons_ttracks->at(l2_idx), |
| 376 | + ditracks_ttracks->at(trk1_idx), |
| 377 | + ditracks_ttracks->at(trk2_idx)}, |
| 378 | + {l1_ptr->mass(), l2_ptr->mass(), bph::PI_MASS, bph::K_MASS}, |
| 379 | + {bph::LEP_SIGMA, bph::LEP_SIGMA, bph::K_SIGMA, bph::K_SIGMA}, |
| 380 | + mass_constraint); |
| 381 | + } catch (const VertexException &e) { |
| 382 | + edm::LogWarning("KinematicFit") |
| 383 | + << "BToTrkTrkLL - piK mass hypothesis constrained fit: Skipping candidate due to fit failure: " |
| 384 | + << e.what(); |
| 385 | + continue; |
| 386 | + } |
338 | 387 | if (!constraint_fitter_piK.success())
|
339 | 388 | continue;
|
340 | 389 |
|
|
0 commit comments