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";
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_
double et() const final
transverse energy
double pz() const final
z coordinate of momentum vector
MonitorElement * hcalisoendcap_after_
double energy() const final
energy
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)
MonitorElement * detainendcap_after_
MonitorElement * njets_before_
MonitorElement * invmassPU_afterZ_
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
MonitorElement * met_after_
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_