Implements edm::one::EDAnalyzerBase.
Definition at line 253 of file SagittaBiasNtuplizer.cc.
References funct::abs(), alcaRecoToken_, pwdgSkimBPark_cfi::beamSpot, edm::View< T >::begin(), cms::cuda::bs, bsToken_, ALCARECOTkAlJpsiMuMu_cff::charge, d0, d0CompatibilityCut_, reco::deltaR2(), HLTMuonOfflineAnalyzer_cfi::deltaR2, doGen_, HGC3DClusterGenMatchSelector_cfi::dR, PVValHelper::dz, edm::View< T >::end(), findClosestVertex(), g, genNegMuonD0_, genNegMuonDz_, genNegMuonEta_, genNegMuonPhi_, genNegMuonPt_, genParticlesToken_, genPosMuonD0_, genPosMuonDz_, genPosMuonEta_, genPosMuonPhi_, genPosMuonPt_, h_CosOpeningAngle, h_cutFlow, h_DeltaD0, h_DeltaDz, h_VertexMatrix, reco::TrackBase::highPurity, mps_fire::i, LogDebug, LogTrace, mass_, maxMassWindowCut_, minMassWindowCut_, muMass, muondxySigCut_, muonEtaCut_, muonPtCut_, muonsToken_, negTrackD0_, negTrackDz_, negTrackEta_, negTrackPhi_, negTrackPt_, openingAngle(), posTrackD0_, posTrackDz_, posTrackEta_, posTrackPhi_, posTrackPt_, DiDispStaMuonMonitor_cfi::pt, reco::LeafCandidate::pt(), pTthresholds_, jetUpdater_cfi::sort, submitPVValidationJobs::t, HLT_2024v12_cff::track, tracksToken_, tree_, useReco_, AlignmentTracksFromVertexSelector_cfi::vertices, L1BJetProducer_cff::vtx, vtxToken_, and z0CompatibilityCut_.
257 std::vector<const reco::Track*> myTracks;
262 std::vector<const reco::Muon*> myGoodMuonVector;
267 if (
t->chi2() /
t->ndof() <= 2.5 &&
t->numberOfValidHits() >= 5 &&
269 myGoodMuonVector.emplace_back(&
muon);
274 LogDebug(
"SagittaBiasNtuplizer") <<
"myGoodMuonVector size: " << myGoodMuonVector.size() << std::endl;
276 return lhs->
pt() > rhs->pt();
280 for (
const auto&
muon : myGoodMuonVector) {
281 LogDebug(
"SagittaBiasNtuplizer") <<
"pT: " <<
muon->pt() <<
" ";
283 LogDebug(
"SagittaBiasNtuplizer") << std::endl;
286 if (myGoodMuonVector.size() < 2)
292 if (myGoodMuonVector[0]->
charge() * myGoodMuonVector[1]->charge() > 0)
300 std::vector<const reco::Muon*> theZMuonVector;
301 theZMuonVector.reserve(2);
302 theZMuonVector.emplace_back(myGoodMuonVector[1]);
303 theZMuonVector.emplace_back(myGoodMuonVector[0]);
307 for (
const auto&
muon : theZMuonVector) {
318 LogDebug(
"SagittaBiasNtuplizer") <<
"pushing new track: " <<
i << std::endl;
319 myTracks.emplace_back(theMatch);
324 myTracks.emplace_back(&
muon);
334 if ((myTracks.size() != 2)) {
335 LogTrace(
"SagittaBiasNtuplizer") <<
"Found " << myTracks.size() <<
" muons in the event. Skipping";
339 bool passSameVertex{
true};
340 bool passD0sigCut{
true};
341 bool passPtCut{
true};
342 bool passEtaCut{
true};
343 bool passMassWindow{
true};
344 bool passDeltaD0{
true};
345 bool passDeltaDz{
true};
346 bool passOpeningAngle{
true};
347 double d0[2] = {0., 0.};
348 double dz[2] = {0., 0.};
349 unsigned int vtxIndex[2] = {999, 999};
352 for (
const auto&
track : myTracks) {
364 vtxIndex[
i] = closestVertex.first;
365 d0[
i] =
track->dxy(closestVertex.second.position());
366 dz[
i] =
track->dz(closestVertex.second.position());
369 passD0sigCut =
false;
373 if (
track->charge() > 0) {
391 passSameVertex = (vtxIndex[0] == vtxIndex[1]);
412 TLorentzVector posTrack, negTrack, mother;
415 mother = posTrack + negTrack;
441 passOpeningAngle =
true;
443 if (!passOpeningAngle)
451 for (
const auto&
track : myTracks) {
454 for (
auto g = genPartCollection->
begin();
g != genPartCollection->
end(); ++
g) {
455 if (
g->status() != 1)
461 if (
g->charge() !=
track->charge())
466 auto const&
vtx =
g->vertex();
467 auto const& myBeamSpot =
beamSpot.position(
vtx.z());
468 const auto& theptinv2 = 1 /
g->pt() *
g->pt();
473 if (
g->charge() > 0) {
478 genPosMuonD0_ = -(-(
vtx.x() - myBeamSpot.x()) *
g->py() + (
vtx.y() - myBeamSpot.y()) *
g->px()) /
g->pt();
481 (
vtx.z() - myBeamSpot.z()) -
482 ((
vtx.x() - myBeamSpot.x()) *
g->px() + (
vtx.y() - myBeamSpot.y()) *
g->py()) *
g->pz() * theptinv2;
491 (
vtx.z() - myBeamSpot.z()) -
492 ((
vtx.x() - myBeamSpot.x()) *
g->px() + (
vtx.y() - myBeamSpot.y()) *
g->py()) *
g->pz() * theptinv2;
const double z0CompatibilityCut_
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
double pt() const final
transverse momentum
edm::EDGetTokenT< reco::MuonCollection > muonsToken_
const double minMassWindowCut_
edm::EDGetTokenT< reco::TrackCollection > alcaRecoToken_
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::EDGetTokenT< edm::View< reco::Candidate > > genParticlesToken_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
const edm::EDGetTokenT< reco::VertexCollection > vtxToken_
static double constexpr muMass
Muon mass [GeV].
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
const double maxMassWindowCut_
double openingAngle(const reco::Track *track1, const reco::Track *track2)
Abs< T >::type abs(const T &t)
static constexpr float d0
std::pair< unsigned int, reco::Vertex > findClosestVertex(const reco::Track *track1, const reco::VertexCollection &vertices)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
DecomposeProduct< arg, typename Div::arg > D
XYZPointD XYZPoint
point in space with cartesian internal representation
const double d0CompatibilityCut_
const double muondxySigCut_
const_iterator begin() const
std::vector< double > pTthresholds_
const_iterator end() const