40 metTag_(cfg.getUntrackedParameter<
edm::
InputTag>(
"METTag",
58 "VertexTag",
edm::
InputTag(
"offlinePrimaryVertices")))),
69 cfg.getUntrackedParameter<
std::vector<
std::
string> >(
"ElecTrig")),
71 ptCut_(cfg.getUntrackedParameter<double>(
"PtCut", 10.)),
73 etaCut_(cfg.getUntrackedParameter<double>(
"EtaCut", 2.4)),
74 sieieCutBarrel_(cfg.getUntrackedParameter<double>(
"SieieBarrel", 0.01)),
75 sieieCutEndcap_(cfg.getUntrackedParameter<double>(
"SieieEndcap", 0.028)),
77 cfg.getUntrackedParameter<double>(
"DetainBarrel", 0.0071)),
79 cfg.getUntrackedParameter<double>(
"DetainEndcap", 0.0066)),
86 cfg.getUntrackedParameter<double>(
"EcalIsoCutBarrel", 5.7)),
88 cfg.getUntrackedParameter<double>(
"EcalIsoCutEndcap", 5.0)),
90 cfg.getUntrackedParameter<double>(
"HcalIsoCutBarrel", 8.1)),
92 cfg.getUntrackedParameter<double>(
"HcalIsoCutEndcap", 3.4)),
94 cfg.getUntrackedParameter<double>(
"TrkIsoCutBarrel", 7.2)),
96 cfg.getUntrackedParameter<double>(
"TrkIsoCutEndcap", 5.1)),
97 mtMin_(cfg.getUntrackedParameter<double>(
"MtMin", -999999)),
98 mtMax_(cfg.getUntrackedParameter<double>(
"MtMax", 999999.)),
99 metMin_(cfg.getUntrackedParameter<double>(
"MetMin", -999999.)),
100 metMax_(cfg.getUntrackedParameter<double>(
"MetMax", 999999.)),
117 eJetMin_(cfg.getUntrackedParameter<double>(
"EJetMin", 999999.)),
118 nJetMax_(cfg.getUntrackedParameter<
int>(
"NJetMax", 999999)),
119 PUMax_(cfg.getUntrackedParameter<unsigned
int>(
"PUMax", 60)),
120 PUBinCount_(cfg.getUntrackedParameter<unsigned
int>(
"PUBinCount", 12)),
121 hltPrescaleProvider_(cfg, consumesCollector(), *this)
138 bool isConfigChanged =
false;
152 char chtitle[256] =
"";
155 "Electron transverse momentum [GeV]", 100, 0., 100.);
157 "Electron transverse momentum [GeV]", 100, 0., 100.);
160 "Electron pseudo-rapidity", 50, -2.5, 2.5);
162 "Electron pseudo-rapidity", 50, -2.5, 2.5);
165 "Electron #sigma_{i#etai#eta} (barrel)", 70, 0., 0.07);
167 "Electron #sigma_{i#etai#eta} (barrel)", 70, 0., 0.07);
170 "Electron #sigma_{i#etai#eta} (endcap)", 70, 0., 0.07);
172 "Electron #sigma_{i#etai#eta} (endcap)", 70, 0., 0.07);
175 "Electron #Delta#eta_{in} (barrel)", 40, -0.02, 0.02);
177 "Electron #Delta#eta_{in} (barrel)", 40, -0.02, 0.02);
180 "Electron #Delta#eta_{in} (endcap)", 40, -0.02, 0.02);
182 "Electron #Delta#eta_{in} (endcap)", 40, -0.02, 0.02);
185 "Absolute electron ECAL isolation variable (barrel) [GeV]", 50, 0., 50.);
187 "Absolute electron ECAL isolation variable (barrel) [GeV]", 50, 0., 50.);
190 "Absolute electron ECAL isolation variable (endcap) [GeV]", 50, 0., 50.);
192 "Absolute electron ECAL isolation variable (endcap) [GeV]", 50, 0., 50.);
195 "Absolute electron HCAL isolation variable (barrel) [GeV]", 50, 0., 50.);
197 "Absolute electron HCAL isolation variable (barrel) [GeV]", 50, 0., 50.);
200 "Absolute electron HCAL isolation variable (endcap) [GeV]", 50, 0., 50.);
202 "Absolute electron HCAL isolation variable (endcap) [GeV]", 50, 0., 50.);
205 "Absolute electron track isolation variable (barrel) [GeV]", 50, 0., 50.);
207 "Absolute electron track isolation variable (barrel) [GeV]", 50, 0., 50.);
210 "Absolute electron track isolation variable (endcap) [GeV]", 50, 0., 50.);
212 "Absolute electron track isolation variable (endcap) [GeV]", 50, 0., 50.);
219 "Di-electron invariant mass [GeV]", 100, 0., 200.);
221 "Di-electron invariant mass [GeV]", 100, 0., 200.);
224 "Di-electron invariant mass [GeV] vs PU; mass [GeV]; PU count", 100, 0.,
227 "Di-electron invariant mass [GeV] vs PU; mass [GeV]; PU count", 100, 0.,
231 "Number of Valid Primary Vertices; nGoodPVs",
PUMax_ + 1, -0.5,
PUMax_ + 0.5);
234 "Number of Valid Primary Vertices; nGoodPVs",
PUMax_ + 1, -0.5,
PUMax_ + 0.5);
237 "Number of electrons in event", 10, -0.5, 9.5);
239 "Number of electrons in event", 10, -0.5, 9.5);
241 snprintf(chtitle, 255,
"Transverse mass (%s) [GeV]",
metTag_.
label().data());
246 snprintf(chtitle, 255,
"Missing transverse energy (%s) [GeV]",
251 snprintf(chtitle, 255,
"Number of jets (%s) above %.2f GeV",
256 snprintf(chtitle, 255,
"Jet with highest E_{T} (%s)",
jetTag_.
label().data());
260 snprintf(chtitle, 255,
"Eta of Jet with highest E_{T} (%s)",
272 LogVerbatim(
"") <<
"\n>>>>>> SELECTION SUMMARY BEGIN >>>>>>>>>>>>>>>";
273 LogVerbatim(
"") <<
"Total number of events analyzed: " <<
nall <<
" [events]";
274 LogVerbatim(
"") <<
"Total number of events selected: " <<
nsel <<
" [events]";
276 <<
"(" << setprecision(4) << esel * 100. <<
" +/- " 277 << setprecision(2) <<
sqrt(esel * (1 - esel) / all) * 100.
289 double err =
sqrt(eff * (1 - eff) / all);
290 LogVerbatim(
"") <<
"Passing Pt/Eta/Quality cuts: " << num <<
" [events], (" 291 << setprecision(4) << eff * 100. <<
" +/- " << setprecision(2)
292 << err * 100. <<
")%";
297 err =
sqrt(eff * (1 - eff) / all);
300 if (
nrec > 0) effstep = eeid / erec;
301 if (
nrec > 0) errstep =
sqrt(effstep * (1 - effstep) /
nrec);
302 LogVerbatim(
"") <<
"Passing eID cuts: " << num <<
" [events], (" 303 << setprecision(4) << eff * 100. <<
" +/- " << setprecision(2)
304 << err * 100. <<
")%, to previous step: (" << setprecision(4)
305 << effstep * 100. <<
" +/- " << setprecision(2)
306 << errstep * 100. <<
")%";
311 err =
sqrt(eff * (1 - eff) / all);
314 if (
neid > 0) effstep = eiso / eeid;
315 if (
neid > 0) errstep =
sqrt(effstep * (1 - effstep) /
neid);
316 LogVerbatim(
"") <<
"Passing isolation cuts: " << num <<
" [events], (" 317 << setprecision(4) << eff * 100. <<
" +/- " << setprecision(2)
318 << err * 100. <<
")%, to previous step: (" << setprecision(4)
319 << effstep * 100. <<
" +/- " << setprecision(2)
320 << errstep * 100. <<
")%";
338 err =
sqrt(eff * (1 - eff) / all);
341 if (
niso > 0) effstep = esel / eiso;
342 if (
niso > 0) errstep =
sqrt(effstep * (1 - effstep) /
niso);
343 LogVerbatim(
"") <<
"Passing HLT criteria: " << num <<
" [events], (" 344 << setprecision(4) << eff * 100. <<
" +/- " << setprecision(2)
345 << err * 100. <<
")%, to previous step: (" << setprecision(4)
346 << effstep * 100. <<
" +/- " << setprecision(2)
347 << errstep * 100. <<
")%";
375 LogVerbatim(
"") <<
">>>>>> SELECTION SUMMARY END >>>>>>>>>>>>>>>\n";
383 bool rec_sel =
false;
384 bool eid_sel =
false;
385 bool iso_sel =
false;
386 bool all_sel =
false;
394 unsigned int electronCollectionSize = electronCollection->size();
412 const MET&
met = metCollection->at(0);
423 double met_et =
sqrt(met_px * met_px + met_py * met_py);
424 LogTrace(
"") <<
">>> MET, MET_px, MET_py: " << met_et <<
", " << met_px
425 <<
", " << met_py <<
" [GeV]";
432 LogError(
"") <<
">>> Vertex collection does not exist !!!";
436 for (
unsigned int i = 0;
i < vertexCollection->size();
i++) {
437 const Vertex& vertex = vertexCollection->at(
i);
438 if (vertex.
isValid()) npvCount++;
507 if (prescaleSet == -1) {
508 LogTrace(
"") <<
"Failed to determine prescaleSet\n";
548 float electron_et = -8.0;
549 float electron_eta = -8.0;
550 float electron_phi = -8.0;
551 float electron2_et = -9.0;
552 float electron2_eta = -9.0;
553 float electron2_phi = -9.0;
555 for (
unsigned int i = 0;
i < electronCollectionSize;
i++) {
559 electron_et = elec.
pt();
560 electron_eta = elec.
eta();
561 electron_phi = elec.
phi();
564 electron2_et = elec.
pt();
565 electron2_eta = elec.
eta();
566 electron2_phi = elec.
phi();
571 float jet_eta = -8.0;
573 float jet2_et = -9.0;
574 unsigned int jetCollectionSize = jetCollection->size();
576 for (
unsigned int i = 0;
i < jetCollectionSize;
i++) {
577 const Jet&
jet = jetCollection->at(
i);
579 float jet_current_et = jet.
et();
582 if (electron_et > 0.0 && fabs(jet.
eta() - electron_eta) < 0.2 &&
585 if (electron2_et > 0.0 && fabs(jet.
eta() - electron2_eta) < 0.2 &&
597 if (jet_current_et > jet_et) {
601 }
else if (jet_current_et > jet2_et) {
614 LogTrace(
"") <<
">>> Total number of jets: " << jetCollectionSize;
616 <<
" [GeV]: " << njets;
625 bool met_hist_done =
false;
628 bool njets_hist_done =
false;
632 const int NFLAGS = 10;
641 bool electron_sel[NFLAGS];
658 double goodElectron[2][6];
660 for (
unsigned int i = 0;
i < 2;
i++) {
661 for (
unsigned int j = 0; j < 6; j++) {
663 goodElectron[
i][j] = 0.;
667 for (
unsigned int i = 0;
i < electronCollectionSize;
i++) {
668 for (
int j = 0; j < NFLAGS; ++j) {
669 electron_sel[j] =
false;
677 LogTrace(
"") <<
"> elec: processing electron number " <<
i <<
"...";
685 electron[
i][2] = elec.
energy();
686 electron[
i][3] = elec.
px();
687 electron[
i][4] = elec.
py();
688 electron[
i][5] = elec.
pz();
692 double pt = elec.
pt();
693 double px = elec.
px();
694 double py = elec.
py();
696 LogTrace(
"") <<
"\t... pt, eta: " << pt <<
" [GeV], " <<
eta;
698 if (pt >
ptCut_) electron_sel[0] =
true;
699 if (fabs(eta) <
etaCut_) electron_sel[1] =
true;
703 if (eta < 1.4442 && eta > -1.4442) {
705 }
else if ((eta > 1.56 && eta < 2.4) || (eta < -1.56 && eta > -2.4)) {
737 LogTrace(
"") <<
"\t... sieie value " << sieie <<
" (barrel), pass? " 739 LogTrace(
"") <<
"\t... detain value " << detain <<
" (barrel), pass? " 741 }
else if (isEndcap) {
742 LogTrace(
"") <<
"\t... sieie value " << sieie <<
" (endcap), pass? " 744 LogTrace(
"") <<
"\t... detain value " << detain <<
" (endcap), pass? " 751 }
else if (isEndcap) {
773 LogTrace(
"") <<
"\t... ecal isolation value " << ecalisovar
774 <<
" (barrel), pass? " << electron_sel[4];
775 LogTrace(
"") <<
"\t... hcal isolation value " << hcalisovar
776 <<
" (barrel), pass? " << electron_sel[5];
777 LogTrace(
"") <<
"\t... trk isolation value " << trkisovar
778 <<
" (barrel), pass? " << electron_sel[6];
779 }
else if (isEndcap) {
780 LogTrace(
"") <<
"\t... ecal isolation value " << ecalisovar
781 <<
" (endcap), pass? " << electron_sel[4];
782 LogTrace(
"") <<
"\t... hcal isolation value " << hcalisovar
783 <<
" (endcap), pass? " << electron_sel[5];
784 LogTrace(
"") <<
"\t... trk isolation value " << trkisovar
785 <<
" (endcap), pass? " << electron_sel[6];
793 }
else if (isEndcap) {
803 double w_et = met_et +
pt;
804 double w_px = met_px + px;
805 double w_py = met_py + py;
807 double massT = w_et * w_et - w_px * w_px - w_py * w_py;
808 massT = (massT > 0) ?
sqrt(massT) : 0;
810 LogTrace(
"") <<
"\t... W mass, W_et, W_px, W_py: " << massT <<
", " << w_et
811 <<
", " << w_px <<
", " << w_py <<
" [GeV]";
812 if (massT >
mtMin_ && massT <
mtMax_) electron_sel[7] =
true;
827 if (njets <=
nJetMax_) electron_sel[9] =
true;
830 int flags_passed = 0;
831 bool rec_sel_this =
true;
832 bool eid_sel_this =
true;
833 bool iso_sel_this =
true;
834 bool all_sel_this =
true;
835 for (
int j = 0; j < NFLAGS; ++j) {
836 if (electron_sel[j]) flags_passed += 1;
837 if (j < 2 && !electron_sel[j]) rec_sel_this =
false;
838 if (j < 4 && !electron_sel[j]) eid_sel_this =
false;
839 if (j < 7 && !electron_sel[j]) iso_sel_this =
false;
840 if (!electron_sel[j]) all_sel_this =
false;
865 if (rec_sel_this) rec_sel =
true;
867 if (eid_sel_this) iso_sel =
true;
869 if (iso_sel_this) iso_sel =
true;
872 if (all_sel_this) all_sel =
true;
875 if (flags_passed >= (NFLAGS - 1)) {
876 if (!electron_sel[0] || flags_passed == NFLAGS) {
879 if (!electron_sel[1] || flags_passed == NFLAGS) {
882 if (!electron_sel[2] || flags_passed == NFLAGS) {
885 }
else if (isEndcap) {
889 if (!electron_sel[3] || flags_passed == NFLAGS) {
892 }
else if (isEndcap) {
896 if (!electron_sel[4] || flags_passed == NFLAGS) {
899 }
else if (isEndcap) {
903 if (!electron_sel[5] || flags_passed == NFLAGS) {
906 }
else if (isEndcap) {
910 if (!electron_sel[6] || flags_passed == NFLAGS) {
913 }
else if (isEndcap) {
939 if (!electron_sel[7] || flags_passed == NFLAGS) {
942 if (!electron_sel[8] || flags_passed == NFLAGS) {
943 if (!met_hist_done) {
947 met_hist_done =
true;
958 if (!electron_sel[9] || flags_passed == NFLAGS) {
959 if (!njets_hist_done) {
968 njets_hist_done =
true;
979 if (electronCollectionSize > 1) {
980 invMass =
sqrt(electron[0][1] + electron[1][1] +
981 2 * (electron[0][2] * electron[1][2] -
982 (electron[0][3] * electron[1][3] +
983 electron[0][4] * electron[1][4] +
984 electron[0][5] * electron[1][5])));
991 invMass =
sqrt(goodElectron[0][1] + goodElectron[1][1] +
992 2 * (goodElectron[0][2] * goodElectron[1][2] -
993 (goodElectron[0][3] * goodElectron[1][3] +
994 goodElectron[0][4] * goodElectron[1][4] +
995 goodElectron[0][5] * goodElectron[1][5])));
1002 if (rec_sel)
nrec++;
1003 if (eid_sel)
neid++;
1004 if (iso_sel)
niso++;
1010 LogTrace(
"") <<
">>>> Event ACCEPTED";
1012 LogTrace(
"") <<
">>>> Event REJECTED";
1023 if (deltaPhi < 0) deltaPhi = -
deltaPhi;
1025 if (deltaPhi > 3.1415926) {
1026 deltaPhi = 2 * 3.1415926 -
deltaPhi;
MonitorElement * ecalisoendcap_after_
MonitorElement * jet_et_after_
unsigned int nGoodElectrons
MonitorElement * invmass_after_
MonitorElement * hcalisobarrel_after_
double eta() const final
momentum pseudorapidity
MonitorElement * nelectrons_before_
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
MonitorElement * sieieendcap_before_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * sieieendcap_after_
bool isValid() const
Tells whether the vertex is valid.
MonitorElement * ecalisobarrel_before_
bool isBarrel(GeomDetEnumerators::SubDetector m)
double px() const final
x coordinate of momentum vector
MonitorElement * sieiebarrel_before_
MonitorElement * hcalisobarrel_before_
float dr04TkSumPt() const
double pt() const final
transverse momentum
MonitorElement * detainbarrel_after_
MonitorElement * ecalisobarrel_after_
MonitorElement * detainendcap_before_
MonitorElement * sieiebarrel_after_
MonitorElement * detainbarrel_before_
MonitorElement * mt_before_
MonitorElement * nelectrons_after_
MonitorElement * hcalisoendcap_before_
MonitorElement * npvs_afterZ_
double calcDeltaPhi(double phi1, double phi2)
MonitorElement * mt_after_
float deltaEtaSuperClusterTrackAtVtx() const
float sigmaIetaIeta() const
MonitorElement * jet_et_before_
MonitorElement * njets_after_
MonitorElement * pt_before_
MonitorElement * pt_after_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecTag_
void setCurrentFolder(std::string const &fullpath)
double et() const final
transverse energy
double pz() const final
z coordinate of momentum vector
MonitorElement * hcalisoendcap_after_
double energy() const final
energy
MonitorElement * book1D(Args &&...args)
EwkElecDQM(const edm::ParameterSet &)
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
MonitorElement * invmass_before_
MonitorElement * ecalisoendcap_before_
MonitorElement * jet_eta_after_
bool isEndcap(GeomDetEnumerators::SubDetector m)
MonitorElement * jet_eta_before_
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
void endRun(const edm::Run &, const edm::EventSetup &) override
MonitorElement * detainendcap_after_
MonitorElement * njets_before_
MonitorElement * invmassPU_afterZ_
MonitorElement * book2D(Args &&...args)
MonitorElement * trkisobarrel_before_
edm::EDGetTokenT< edm::View< reco::Vertex > > vertexTag_
MonitorElement * met_before_
MonitorElement * trkisoendcap_before_
double py() const final
y coordinate of momentum vector
double massSqr() const final
mass squared
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
float dr03EcalRecHitSumEt() const
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
MonitorElement * met_after_
void HERE(const char *msg)
MonitorElement * trkisobarrel_after_
MonitorElement * eta_after_
MonitorElement * npvs_before_
MonitorElement * trkisoendcap_after_
float dr03HcalTowerSumEt() const
HLTPrescaleProvider hltPrescaleProvider_
double phi() const final
momentum azimuthal angle
MonitorElement * eta_before_
MonitorElement * invmassPU_before_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void analyze(const edm::Event &, const edm::EventSetup &) override