60 #include "TLorentzVector.h" 138 static constexpr
float emass2 = 0.0005109990615 * 0.0005109990615;
144 : pTthresholds_(iConfig.getParameter<
std::
vector<double>>(
"pTThresholds")),
145 maxSVdist_(iConfig.getParameter<double>(
"maxSVdist")),
146 CosPhiConfiguration_(iConfig.getParameter<
edm::
ParameterSet>(
"CosPhiConfig")),
147 CosPhi3DConfiguration_(iConfig.getParameter<
edm::
ParameterSet>(
"CosPhi3DConfig")),
148 VtxProbConfiguration_(iConfig.getParameter<
edm::
ParameterSet>(
"VtxProbConfig")),
149 VtxDistConfiguration_(iConfig.getParameter<
edm::
ParameterSet>(
"VtxDistConfig")),
150 VtxDist3DConfiguration_(iConfig.getParameter<
edm::
ParameterSet>(
"VtxDist3DConfig")),
151 VtxDistSigConfiguration_(iConfig.getParameter<
edm::
ParameterSet>(
"VtxDistSigConfig")),
152 VtxDist3DSigConfiguration_(iConfig.getParameter<
edm::
ParameterSet>(
"VtxDist3DSigConfig")),
153 DiMuMassConfiguration_(iConfig.getParameter<
edm::
ParameterSet>(
"DiMuMassConfig")),
163 edm::LogInfo(
"DiElectronVertexValidation") << __FUNCTION__;
165 edm::LogInfo(
"DiElectronVertexValidation") <<
" Threshold: " << thr <<
" ";
182 std::vector<const reco::GsfElectron*> myGoodGsfElectrons;
184 int totGsfCounter = 0;
188 myGoodGsfElectrons.emplace_back(&gsfEle);
195 myGoodGsfElectrons.end(),
201 if (myGoodGsfElectrons.size() < 2)
211 if (myGoodGsfElectrons[0]->
charge() * myGoodGsfElectrons[1]->charge() > 0)
219 const auto& ele1 = myGoodGsfElectrons[1]->p4();
220 const auto& ele0 = myGoodGsfElectrons[0]->p4();
221 const auto& mother = ele1 + ele0;
223 float invMass = mother.M();
227 std::vector<const reco::GsfElectron*> theZElectronVector;
228 theZElectronVector.reserve(2);
229 theZElectronVector.emplace_back(myGoodGsfElectrons[1]);
230 theZElectronVector.emplace_back(myGoodGsfElectrons[0]);
234 std::vector<const reco::GsfTrack*> myGoodGsfTracks;
237 for (
const auto&
electron : theZElectronVector) {
248 myGoodGsfTracks.emplace_back(theMatch);
258 std::vector<reco::TransientTrack> tks;
260 std::vector<const reco::GsfTrack*> myTracks;
261 myTracks.emplace_back(myGoodGsfTracks[0]);
262 myTracks.emplace_back(myGoodGsfTracks[1]);
264 if (myTracks.size() != 2)
267 const auto&
e1 = myTracks[1]->momentum();
268 const auto& e0 = myTracks[0]->momentum();
269 const auto& ditrack =
e1 + e0;
271 const auto& tplus = myTracks[0]->charge() > 0 ? myTracks[0] : myTracks[1];
272 const auto& tminus = myTracks[0]->charge() < 0 ? myTracks[0] : myTracks[1];
274 TLorentzVector p4_tplus(tplus->px(), tplus->py(), tplus->pz(),
sqrt((tplus->p() * tplus->p()) +
emass2));
275 TLorentzVector p4_tminus(tminus->px(), tminus->py(), tminus->pz(),
sqrt((tminus->p() * tminus->p()) +
emass2));
278 std::pair<TLorentzVector, TLorentzVector> tktk_p4 = std::make_pair(p4_tplus, p4_tminus);
280 const auto& Zp4 = p4_tplus + p4_tminus;
281 float track_invMass = Zp4.M();
290 for (
const auto&
track : myTracks) {
292 tks.push_back(trajectory);
296 aTransVtx = kalman.
vertex(tks);
321 int closestVtxIndex = 0;
331 if ((*vertices).at(closestVtxIndex).isValid()) {
333 TheMainVtx = (*vertices).at(closestVtxIndex);
339 const math::XYZPoint deltaVtx(mainVtx.x() - myVertex.x(), mainVtx.y() - myVertex.y(), mainVtx.z() - myVertex.z());
344 double dist_err = vertTool.
distance(aTransVtx, TheMainVtx).
error();
356 double distance3D = vertTool3D.
distance(aTransVtx, TheMainVtx).
value();
357 double dist3D_err = vertTool3D.
distance(aTransVtx, TheMainVtx).
error();
372 double cosphi = (ZpT.x() * deltaVtx.x() + ZpT.y() * deltaVtx.y()) /
373 (
sqrt(ZpT.x() * ZpT.x() + ZpT.y() * ZpT.y()) *
374 sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y()));
376 double cosphi3D = (Zp.x() * deltaVtx.x() + Zp.y() * deltaVtx.y() + Zp.z() * deltaVtx.z()) /
377 (
sqrt(Zp.x() * Zp.x() + Zp.y() * Zp.y() + Zp.z() * Zp.z()) *
378 sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y() + deltaVtx.z() * deltaVtx.z()));
404 if (
barrel && dEtaln < 0.00477 && dPhiln < 0.222 && sigmaletaleta < 0.011 && hem < 0.298 &&
resol < 0.241 &&
407 if (
endcap && dEtaln < 0.00868 && dPhiln < 0.213 && sigmaletaleta < 0.0314 && hem < 0.101 &&
resol < 0.14 &&
420 TH1F::SetDefaultSumw2(kTRUE);
422 hGSFMult_=
fs->make<TH1F>(
"GSFMult",
";# gsf tracks;N. events", 20, 0., 20.);
423 hGSFMultAftPt_=
fs->make<TH1F>(
"GSFMultAftPt",
";# gsf tracks;N. events", 20, 0., 20.);
424 hGSF0Pt_=
fs->make<TH1F>(
"GSF0Pt",
";leading GSF track p_{T};N. GSF tracks", 100, 0., 100.);
425 hGSF0Eta_=
fs->make<TH1F>(
"GSF0Eta",
";leading GSF track #eta;N. GSF tracks", 50, -2.5, 2.5);
426 hGSF1Pt_=
fs->make<TH1F>(
"GSF1Pt",
";sub-leading GSF track p_{T};N. GSF tracks", 100, 0., 100.);
427 hGSF1Eta_=
fs->make<TH1F>(
"GSF1Eta",
";sub-leading GSF track #eta;N. GSF tracks", 50, -2.5, 2.5);
429 hSVProb_ =
fs->make<TH1F>(
"VtxProb",
";ZV vertex probability;N(e^{+}e^{-} pairs)", 100, 0., 1.);
431 hSVDist_ =
fs->make<TH1F>(
"VtxDist",
";PV-ZV xy distance [#mum];N(e^{+}e^{-} pairs)", 100, 0., 1000.);
432 hSVDistSig_ =
fs->make<TH1F>(
"VtxDistSig",
";PV-ZV xy distance signficance;N(e^{+}e^{-} pairs)", 100, 0., 5.);
434 hSVDist3D_ =
fs->make<TH1F>(
"VtxDist3D",
";PV-ZV 3D distance [#mum];N(e^{+}e^{-} pairs)", 100, 0., 1000.);
435 hSVDist3DSig_ =
fs->make<TH1F>(
"VtxDist3DSig",
";PV-ZV 3D distance signficance;N(e^{+}e^{-} pairs)", 100, 0., 5.);
437 hCosPhi_ =
fs->make<TH1F>(
"CosPhi",
";cos(#phi_{xy});N(ee pairs)", 50, -1., 1.);
438 hCosPhi3D_ =
fs->make<TH1F>(
"CosPhi3D",
";cos(#phi_{3D});N(ee pairs)", 50, -1., 1.);
439 hTrackInvMass_ =
fs->make<TH1F>(
"TkTkInvMass",
";M(tk,tk) [GeV];N(tk tk pairs)", 70., 50., 120.);
440 hInvMass_ =
fs->make<TH1F>(
"InvMass",
";M(#mu#mu) [GeV];N(#mu#mu pairs)", 70., 50., 120.);
442 hClosestVtxIndex_ =
fs->make<TH1I>(
"ClosestVtxIndex",
";closest vertex index;N(tk tk pairs)", 20, -0.5, 19.5);
472 hCutFlow_ =
fs->make<TH1F>(
"hCutFlow",
"cut flow;cut step;events left",6,-0.5,5.5);
474 for(
unsigned int i=0;
i<6;
i++){
499 desc.add<std::vector<double>>(
"pTThresholds", {25., 15.});
500 desc.add<
double>(
"maxSVdist", 50.);
507 psDiMuMass.
add<
int>(
"NxBins", 24);
508 psDiMuMass.
add<
int>(
"NyBins", 50);
509 psDiMuMass.
add<
double>(
"ymin", 70.);
510 psDiMuMass.
add<
double>(
"ymax", 120.);
518 psCosPhi.
add<
int>(
"NxBins", 50);
519 psCosPhi.
add<
int>(
"NyBins", 50);
520 psCosPhi.
add<
double>(
"ymin", -1.);
521 psCosPhi.
add<
double>(
"ymax", 1.);
529 psCosPhi3D.
add<
int>(
"NxBins", 50);
530 psCosPhi3D.
add<
int>(
"NyBins", 50);
531 psCosPhi3D.
add<
double>(
"ymin", -1.);
532 psCosPhi3D.
add<
double>(
"ymax", 1.);
540 psVtxProb.
add<
int>(
"NxBins", 50);
541 psVtxProb.
add<
int>(
"NyBins", 50);
542 psVtxProb.
add<
double>(
"ymin", 0);
543 psVtxProb.
add<
double>(
"ymax", 1.);
551 psVtxDist.
add<
int>(
"NxBins", 50);
552 psVtxDist.
add<
int>(
"NyBins", 100);
553 psVtxDist.
add<
double>(
"ymin", 0);
554 psVtxDist.
add<
double>(
"ymax", 300.);
562 psVtxDist3D.
add<
int>(
"NxBins", 50);
563 psVtxDist3D.
add<
int>(
"NyBins", 250);
564 psVtxDist3D.
add<
double>(
"ymin", 0);
565 psVtxDist3D.
add<
double>(
"ymax", 500.);
571 psVtxDistSig.
add<
std::string>(
"title",
"d_{xy}(PV,SV)/#sigma_{dxy}(PV,SV)");
573 psVtxDistSig.
add<
int>(
"NxBins", 50);
574 psVtxDistSig.
add<
int>(
"NyBins", 100);
575 psVtxDistSig.
add<
double>(
"ymin", 0);
576 psVtxDistSig.
add<
double>(
"ymax", 5.);
582 psVtxDist3DSig.
add<
std::string>(
"title",
"d_{3D}(PV,SV)/#sigma_{d3D}(PV,SV)");
584 psVtxDist3DSig.
add<
int>(
"NxBins", 50);
585 psVtxDist3DSig.
add<
int>(
"NyBins", 100);
586 psVtxDist3DSig.
add<
double>(
"ymin", 0);
587 psVtxDist3DSig.
add<
double>(
"ymax", 5.);
static const std::string kSharedResource
std::vector< double > pTthresholds_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
float totalChiSquared() const
unsigned int eventsAfterVtx
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
double pt() const final
transverse momentum
GlobalPoint position() const
DiLeptonHelp::PlotsVsKinematics CosPhiPlots
edm::ParameterSet VtxDistSigConfiguration_
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
~DiElectronVertexValidation() override
const Point & position() const
position
edm::ParameterSet VtxDist3DSigConfiguration_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T const * product() const
static constexpr float emass2
unsigned int eventsAfterDist
std::vector< Vertex > VertexCollection
collection of Vertex objects
DiLeptonHelp::PlotsVsKinematics VtxDist3DPlots
DiLeptonHelp::PlotsVsKinematics CosPhi3DPlots
DiLeptonHelp::Counts myCounts
DiLeptonHelp::PlotsVsKinematics VtxDistSigPlots
std::vector< Vertex > VertexCollection
DiLeptonHelp::PlotsVsKinematics VtxProbPlots
float degreesOfFreedom() const
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
const std::string names[nVars_]
float eSuperClusterOverP() const
unsigned int eventsAfterEta
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
reco::TransientTrack build(const reco::Track *p) const
edm::ParameterSet CosPhi3DConfiguration_
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
void analyze(const edm::Event &, const edm::EventSetup &) override
bool passLooseSelection(const reco::GsfElectron &electron)
edm::EDGetTokenT< reco::GsfElectronCollection > electronsToken_
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Abs< T >::type abs(const T &t)
edm::ParameterSet CosPhiConfiguration_
#define DEFINE_FWK_MODULE(type)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
float deltaPhiSuperClusterTrackAtVtx() const
Log< level::Info, false > LogInfo
edm::ParameterSet DiMuMassConfiguration_
DiLeptonHelp::PlotsVsKinematics VtxDist3DSigPlots
float deltaEtaSuperClusterTrackAtVtx() const
DecomposeProduct< arg, typename Div::arg > D
XYZPointD XYZPoint
point in space with cartesian internal representation
edm::ParameterSet VtxProbConfiguration_
static std::atomic< unsigned int > counter
unsigned int eventsAfterPt
void fillPlots(const float val, const std::pair< TLorentzVector, TLorentzVector > &momenta)
void bookFromPSet(const TFileDirectory &fs, const edm::ParameterSet &hpar)
edm::ParameterSet VtxDistConfiguration_
float full5x5_sigmaIetaIeta() const
edm::ParameterSet VtxDist3DConfiguration_
static constexpr float cmToum
DiLeptonHelp::PlotsVsKinematics VtxDistPlots
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbESToken_
unsigned int eventsAfterMult
float hadronicOverEm() const
SuperClusterRef superCluster() const override
reference to a SuperCluster
bool isValid() const
Tells whether the vertex is valid.
DiLeptonHelp::PlotsVsKinematics ZMassPlots
edm::EDGetTokenT< reco::GsfTrackCollection > gsfTracksToken_
DiElectronVertexValidation(const edm::ParameterSet &)