60 #include "TLorentzVector.h" 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;
236 for (
const auto&
electron : theZElectronVector) {
246 myGoodGsfTracks.emplace_back(theMatch);
256 std::vector<reco::TransientTrack> tks;
258 std::vector<const reco::GsfTrack*> myTracks;
259 myTracks.emplace_back(myGoodGsfTracks[0]);
260 myTracks.emplace_back(myGoodGsfTracks[1]);
262 if (myTracks.size() != 2)
265 const auto&
e1 = myTracks[1]->momentum();
266 const auto& e0 = myTracks[0]->momentum();
267 const auto& ditrack =
e1 + e0;
269 const auto& tplus = myTracks[0]->charge() > 0 ? myTracks[0] : myTracks[1];
270 const auto& tminus = myTracks[0]->charge() < 0 ? myTracks[0] : myTracks[1];
272 TLorentzVector p4_tplus(tplus->px(), tplus->py(), tplus->pz(),
sqrt((tplus->p() * tplus->p()) +
emass2));
273 TLorentzVector p4_tminus(tminus->px(), tminus->py(), tminus->pz(),
sqrt((tminus->p() * tminus->p()) +
emass2));
276 std::pair<TLorentzVector, TLorentzVector> tktk_p4 = std::make_pair(p4_tplus, p4_tminus);
278 const auto& Zp4 = p4_tplus + p4_tminus;
279 float track_invMass = Zp4.M();
288 for (
const auto&
track : myTracks) {
290 tks.push_back(trajectory);
294 aTransVtx = kalman.
vertex(tks);
319 int closestVtxIndex = 0;
329 if ((*vertices).at(closestVtxIndex).isValid()) {
331 TheMainVtx = (*vertices).at(closestVtxIndex);
337 const math::XYZPoint deltaVtx(mainVtx.x() - myVertex.x(), mainVtx.y() - myVertex.y(), mainVtx.z() - myVertex.z());
342 double dist_err = vertTool.
distance(aTransVtx, TheMainVtx).
error();
354 double distance3D = vertTool3D.
distance(aTransVtx, TheMainVtx).
value();
355 double dist3D_err = vertTool3D.
distance(aTransVtx, TheMainVtx).
error();
370 double cosphi = (ZpT.x() * deltaVtx.x() + ZpT.y() * deltaVtx.y()) /
371 (
sqrt(ZpT.x() * ZpT.x() + ZpT.y() * ZpT.y()) *
372 sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y()));
374 double cosphi3D = (Zp.x() * deltaVtx.x() + Zp.y() * deltaVtx.y() + Zp.z() * deltaVtx.z()) /
375 (
sqrt(Zp.x() * Zp.x() + Zp.y() * Zp.y() + Zp.z() * Zp.z()) *
376 sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y() + deltaVtx.z() * deltaVtx.z()));
402 if (
barrel && dEtaln < 0.00477 && dPhiln < 0.222 && sigmaletaleta < 0.011 && hem < 0.298 &&
resol < 0.241 &&
405 if (
endcap && dEtaln < 0.00868 && dPhiln < 0.213 && sigmaletaleta < 0.0314 && hem < 0.101 &&
resol < 0.14 &&
418 TH1F::SetDefaultSumw2(kTRUE);
420 hGSFMult_=
fs->make<TH1F>(
"GSFMult",
";# gsf tracks;N. events", 20, 0., 20.);
421 hGSFMultAftPt_=
fs->make<TH1F>(
"GSFMultAftPt",
";# gsf tracks;N. events", 20, 0., 20.);
422 hGSF0Pt_=
fs->make<TH1F>(
"GSF0Pt",
";leading GSF track p_{T};N. GSF tracks", 100, 0., 100.);
423 hGSF0Eta_=
fs->make<TH1F>(
"GSF0Eta",
";leading GSF track #eta;N. GSF tracks", 50, -2.5, 2.5);
424 hGSF1Pt_=
fs->make<TH1F>(
"GSF1Pt",
";sub-leading GSF track p_{T};N. GSF tracks", 100, 0., 100.);
425 hGSF1Eta_=
fs->make<TH1F>(
"GSF1Eta",
";sub-leading GSF track #eta;N. GSF tracks", 50, -2.5, 2.5);
427 hSVProb_ =
fs->make<TH1F>(
"VtxProb",
";ZV vertex probability;N(e^{+}e^{-} pairs)", 100, 0., 1.);
429 hSVDist_ =
fs->make<TH1F>(
"VtxDist",
";PV-ZV xy distance [#mum];N(e^{+}e^{-} pairs)", 100, 0., 1000.);
430 hSVDistSig_ =
fs->make<TH1F>(
"VtxDistSig",
";PV-ZV xy distance signficance;N(e^{+}e^{-} pairs)", 100, 0., 5.);
432 hSVDist3D_ =
fs->make<TH1F>(
"VtxDist3D",
";PV-ZV 3D distance [#mum];N(e^{+}e^{-} pairs)", 100, 0., 1000.);
433 hSVDist3DSig_ =
fs->make<TH1F>(
"VtxDist3DSig",
";PV-ZV 3D distance signficance;N(e^{+}e^{-} pairs)", 100, 0., 5.);
435 hCosPhi_ =
fs->make<TH1F>(
"CosPhi",
";cos(#phi_{xy});N(ee pairs)", 50, -1., 1.);
436 hCosPhi3D_ =
fs->make<TH1F>(
"CosPhi3D",
";cos(#phi_{3D});N(ee pairs)", 50, -1., 1.);
437 hTrackInvMass_ =
fs->make<TH1F>(
"TkTkInvMass",
";M(tk,tk) [GeV];N(tk tk pairs)", 70., 50., 120.);
438 hInvMass_ =
fs->make<TH1F>(
"InvMass",
";M(#mu#mu) [GeV];N(#mu#mu pairs)", 70., 50., 120.);
440 hClosestVtxIndex_ =
fs->make<TH1I>(
"ClosestVtxIndex",
";closest vertex index;N(tk tk pairs)", 20, -0.5, 19.5);
470 hCutFlow_ =
fs->make<TH1F>(
"hCutFlow",
"cut flow;cut step;events left",6,-0.5,5.5);
472 for(
unsigned int i=0;
i<6;
i++){
497 desc.add<std::vector<double>>(
"pTThresholds", {25., 15.});
498 desc.add<
double>(
"maxSVdist", 50.);
505 psDiMuMass.
add<
int>(
"NxBins", 24);
506 psDiMuMass.
add<
int>(
"NyBins", 50);
507 psDiMuMass.
add<
double>(
"ymin", 70.);
508 psDiMuMass.
add<
double>(
"ymax", 120.);
516 psCosPhi.
add<
int>(
"NxBins", 50);
517 psCosPhi.
add<
int>(
"NyBins", 50);
518 psCosPhi.
add<
double>(
"ymin", -1.);
519 psCosPhi.
add<
double>(
"ymax", 1.);
527 psCosPhi3D.
add<
int>(
"NxBins", 50);
528 psCosPhi3D.
add<
int>(
"NyBins", 50);
529 psCosPhi3D.
add<
double>(
"ymin", -1.);
530 psCosPhi3D.
add<
double>(
"ymax", 1.);
538 psVtxProb.
add<
int>(
"NxBins", 50);
539 psVtxProb.
add<
int>(
"NyBins", 50);
540 psVtxProb.
add<
double>(
"ymin", 0);
541 psVtxProb.
add<
double>(
"ymax", 1.);
549 psVtxDist.
add<
int>(
"NxBins", 50);
550 psVtxDist.
add<
int>(
"NyBins", 100);
551 psVtxDist.
add<
double>(
"ymin", 0);
552 psVtxDist.
add<
double>(
"ymax", 300.);
560 psVtxDist3D.
add<
int>(
"NxBins", 50);
561 psVtxDist3D.
add<
int>(
"NyBins", 250);
562 psVtxDist3D.
add<
double>(
"ymin", 0);
563 psVtxDist3D.
add<
double>(
"ymax", 500.);
569 psVtxDistSig.
add<
std::string>(
"title",
"d_{xy}(PV,SV)/#sigma_{dxy}(PV,SV)");
571 psVtxDistSig.
add<
int>(
"NxBins", 50);
572 psVtxDistSig.
add<
int>(
"NyBins", 100);
573 psVtxDistSig.
add<
double>(
"ymin", 0);
574 psVtxDistSig.
add<
double>(
"ymax", 5.);
580 psVtxDist3DSig.
add<
std::string>(
"title",
"d_{3D}(PV,SV)/#sigma_{d3D}(PV,SV)");
582 psVtxDist3DSig.
add<
int>(
"NxBins", 50);
583 psVtxDist3DSig.
add<
int>(
"NyBins", 100);
584 psVtxDist3DSig.
add<
double>(
"ymin", 0);
585 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 &)