42 metTag_(cfg.getUntrackedParameter<edm::
InputTag>(
"METTag",
44 jetTag_(cfg.getUntrackedParameter<edm::
InputTag>(
45 "JetTag", edm::
InputTag(
"sisCone5CaloJets"))),
47 cfg.getUntrackedParameter<edm::
InputTag>(
48 "TrigTag", edm::
InputTag(
"TriggerResults::HLT")))),
50 cfg.getUntrackedParameter<edm::
InputTag>(
51 "ElecTag", edm::
InputTag(
"gsfElectrons")))),
53 cfg.getUntrackedParameter<edm::
InputTag>(
"METTag",
56 cfg.getUntrackedParameter<edm::
InputTag>(
57 "JetTag", edm::
InputTag(
"sisCone5CaloJets")))),
59 cfg.getUntrackedParameter<edm::
InputTag>(
60 "VertexTag", edm::
InputTag(
"offlinePrimaryVertices")))),
63 "BeamSpotTag", edm::
InputTag(
"BeamSpot")))),
71 cfg.getUntrackedParameter<std::vector<std::
string> >(
"ElecTrig")),
73 ptCut_(cfg.getUntrackedParameter<double>(
"PtCut", 10.)),
75 etaCut_(cfg.getUntrackedParameter<double>(
"EtaCut", 2.4)),
76 sieieCutBarrel_(cfg.getUntrackedParameter<double>(
"SieieBarrel", 0.01)),
77 sieieCutEndcap_(cfg.getUntrackedParameter<double>(
"SieieEndcap", 0.028)),
79 cfg.getUntrackedParameter<double>(
"DetainBarrel", 0.0071)),
81 cfg.getUntrackedParameter<double>(
"DetainEndcap", 0.0066)),
88 cfg.getUntrackedParameter<double>(
"EcalIsoCutBarrel", 5.7)),
90 cfg.getUntrackedParameter<double>(
"EcalIsoCutEndcap", 5.0)),
92 cfg.getUntrackedParameter<double>(
"HcalIsoCutBarrel", 8.1)),
94 cfg.getUntrackedParameter<double>(
"HcalIsoCutEndcap", 3.4)),
96 cfg.getUntrackedParameter<double>(
"TrkIsoCutBarrel", 7.2)),
98 cfg.getUntrackedParameter<double>(
"TrkIsoCutEndcap", 5.1)),
99 mtMin_(cfg.getUntrackedParameter<double>(
"MtMin", -999999)),
100 mtMax_(cfg.getUntrackedParameter<double>(
"MtMax", 999999.)),
101 metMin_(cfg.getUntrackedParameter<double>(
"MetMin", -999999.)),
102 metMax_(cfg.getUntrackedParameter<double>(
"MetMax", 999999.)),
119 eJetMin_(cfg.getUntrackedParameter<double>(
"EJetMin", 999999.)),
120 nJetMax_(cfg.getUntrackedParameter<int>(
"NJetMax", 999999)),
121 PUMax_(cfg.getUntrackedParameter<unsigned int>(
"PUMax", 60)),
122 PUBinCount_(cfg.getUntrackedParameter<unsigned int>(
"PUBinCount", 12))
140 bool isConfigChanged =
false;
154 char chtitle[256] =
"";
157 "Electron transverse momentum [GeV]", 100, 0., 100.);
159 "Electron transverse momentum [GeV]", 100, 0., 100.);
162 "Electron pseudo-rapidity", 50, -2.5, 2.5);
164 "Electron pseudo-rapidity", 50, -2.5, 2.5);
167 "Electron #sigma_{i#etai#eta} (barrel)", 70, 0., 0.07);
169 "Electron #sigma_{i#etai#eta} (barrel)", 70, 0., 0.07);
172 "Electron #sigma_{i#etai#eta} (endcap)", 70, 0., 0.07);
174 "Electron #sigma_{i#etai#eta} (endcap)", 70, 0., 0.07);
177 "Electron #Delta#eta_{in} (barrel)", 40, -0.02, 0.02);
179 "Electron #Delta#eta_{in} (barrel)", 40, -0.02, 0.02);
182 "Electron #Delta#eta_{in} (endcap)", 40, -0.02, 0.02);
184 "Electron #Delta#eta_{in} (endcap)", 40, -0.02, 0.02);
187 "Absolute electron ECAL isolation variable (barrel) [GeV]", 50, 0., 50.);
189 "Absolute electron ECAL isolation variable (barrel) [GeV]", 50, 0., 50.);
192 "Absolute electron ECAL isolation variable (endcap) [GeV]", 50, 0., 50.);
194 "Absolute electron ECAL isolation variable (endcap) [GeV]", 50, 0., 50.);
197 "Absolute electron HCAL isolation variable (barrel) [GeV]", 50, 0., 50.);
199 "Absolute electron HCAL isolation variable (barrel) [GeV]", 50, 0., 50.);
202 "Absolute electron HCAL isolation variable (endcap) [GeV]", 50, 0., 50.);
204 "Absolute electron HCAL isolation variable (endcap) [GeV]", 50, 0., 50.);
207 "Absolute electron track isolation variable (barrel) [GeV]", 50, 0., 50.);
209 "Absolute electron track isolation variable (barrel) [GeV]", 50, 0., 50.);
212 "Absolute electron track isolation variable (endcap) [GeV]", 50, 0., 50.);
214 "Absolute electron track isolation variable (endcap) [GeV]", 50, 0., 50.);
221 "Di-electron invariant mass [GeV]", 100, 0., 200.);
223 "Di-electron invariant mass [GeV]", 100, 0., 200.);
226 "Di-electron invariant mass [GeV] vs PU; mass [GeV]; PU count", 100, 0.,
229 "Di-electron invariant mass [GeV] vs PU; mass [GeV]; PU count", 100, 0.,
233 "Number of Valid Primary Vertices; nGoodPVs",
PUMax_ + 1, -0.5,
PUMax_ + 0.5);
236 "Number of Valid Primary Vertices; nGoodPVs",
PUMax_ + 1, -0.5,
PUMax_ + 0.5);
239 "Number of electrons in event", 10, -0.5, 9.5);
241 "Number of electrons in event", 10, -0.5, 9.5);
243 snprintf(chtitle, 255,
"Transverse mass (%s) [GeV]",
metTag_.
label().data());
248 snprintf(chtitle, 255,
"Missing transverse energy (%s) [GeV]",
253 snprintf(chtitle, 255,
"Number of jets (%s) above %.2f GeV",
258 snprintf(chtitle, 255,
"Jet with highest E_{T} (%s)",
jetTag_.
label().data());
262 snprintf(chtitle, 255,
"Eta of Jet with highest E_{T} (%s)",
274 LogVerbatim(
"") <<
"\n>>>>>> SELECTION SUMMARY BEGIN >>>>>>>>>>>>>>>";
275 LogVerbatim(
"") <<
"Total number of events analyzed: " <<
nall <<
" [events]";
276 LogVerbatim(
"") <<
"Total number of events selected: " <<
nsel <<
" [events]";
278 <<
"(" << setprecision(4) << esel * 100. <<
" +/- "
279 << setprecision(2) <<
sqrt(esel * (1 - esel) / all) * 100.
291 double err =
sqrt(eff * (1 - eff) / all);
292 LogVerbatim(
"") <<
"Passing Pt/Eta/Quality cuts: " << num <<
" [events], ("
293 << setprecision(4) << eff * 100. <<
" +/- " << setprecision(2)
294 << err * 100. <<
")%";
299 err =
sqrt(eff * (1 - eff) / all);
302 if (
nrec > 0) effstep = eeid / erec;
303 if (
nrec > 0) errstep =
sqrt(effstep * (1 - effstep) /
nrec);
304 LogVerbatim(
"") <<
"Passing eID cuts: " << num <<
" [events], ("
305 << setprecision(4) << eff * 100. <<
" +/- " << setprecision(2)
306 << err * 100. <<
")%, to previous step: (" << setprecision(4)
307 << effstep * 100. <<
" +/- " << setprecision(2)
308 << errstep * 100. <<
")%";
313 err =
sqrt(eff * (1 - eff) / all);
316 if (
neid > 0) effstep = eiso / eeid;
317 if (
neid > 0) errstep =
sqrt(effstep * (1 - effstep) /
neid);
318 LogVerbatim(
"") <<
"Passing isolation cuts: " << num <<
" [events], ("
319 << setprecision(4) << eff * 100. <<
" +/- " << setprecision(2)
320 << err * 100. <<
")%, to previous step: (" << setprecision(4)
321 << effstep * 100. <<
" +/- " << setprecision(2)
322 << errstep * 100. <<
")%";
340 err =
sqrt(eff * (1 - eff) / all);
343 if (
niso > 0) effstep = esel / eiso;
344 if (
niso > 0) errstep =
sqrt(effstep * (1 - effstep) /
niso);
345 LogVerbatim(
"") <<
"Passing HLT criteria: " << num <<
" [events], ("
346 << setprecision(4) << eff * 100. <<
" +/- " << setprecision(2)
347 << err * 100. <<
")%, to previous step: (" << setprecision(4)
348 << effstep * 100. <<
" +/- " << setprecision(2)
349 << errstep * 100. <<
")%";
377 LogVerbatim(
"") <<
">>>>>> SELECTION SUMMARY END >>>>>>>>>>>>>>>\n";
385 bool rec_sel =
false;
386 bool eid_sel =
false;
387 bool iso_sel =
false;
388 bool all_sel =
false;
396 unsigned int electronCollectionSize = electronCollection->size();
414 const MET&
met = metCollection->at(0);
425 double met_et =
sqrt(met_px * met_px + met_py * met_py);
426 LogTrace(
"") <<
">>> MET, MET_px, MET_py: " << met_et <<
", " << met_px
427 <<
", " << met_py <<
" [GeV]";
434 LogError(
"") <<
">>> Vertex collection does not exist !!!";
438 for (
unsigned int i = 0;
i < vertexCollection->size();
i++) {
439 const Vertex& vertex = vertexCollection->at(
i);
440 if (vertex.
isValid()) npvCount++;
451 bool trigger_fired =
false;
507 if (prescaleSet == -1) {
508 LogTrace(
"") <<
"Failed to determine prescaleSet\n";
513 for (
unsigned int i = 0;
514 (
i < triggerResults->size()) && (trigger_fired ==
false);
i++) {
516 if (!triggerResults->accept(
i))
continue;
525 if (!found)
continue;
532 trigger_fired =
true;
535 LogTrace(
"") <<
">>> Trigger bit: " << trigger_fired <<
" for one of ( ";
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;
623 bool hlt_hist_done =
false;
625 bool met_hist_done =
false;
628 bool njets_hist_done =
false;
632 const int NFLAGS = 11;
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) {
800 if (trigger_fired) electron_sel[7] =
true;
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[8] =
true;
827 if (njets <=
nJetMax_) electron_sel[10] =
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) {
933 if (!electron_sel[7] || flags_passed == NFLAGS) {
934 if (!hlt_hist_done) {
938 hlt_hist_done =
true;
939 if (!electron_sel[8] || flags_passed == NFLAGS) {
942 if (!electron_sel[9] || flags_passed == NFLAGS) {
943 if (!met_hist_done) {
947 met_hist_done =
true;
958 if (!electron_sel[10] || 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
void dqmBeginRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * invmass_after_
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
MonitorElement * hcalisobarrel_after_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * nelectrons_before_
HLTConfigProvider hltConfigProvider_
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
virtual double et() const
transverse energy
MonitorElement * sieieendcap_before_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * sieieendcap_after_
virtual double massSqr() const
mass squared
Base class for all types of Jets.
bool isValid() const
Tells whether the vertex is valid.
MonitorElement * ecalisobarrel_before_
bool isBarrel(GeomDetEnumerators::SubDetector m)
MonitorElement * sieiebarrel_before_
MonitorElement * hcalisobarrel_before_
float dr04TkSumPt() const
MonitorElement * detainbarrel_after_
MonitorElement * ecalisobarrel_after_
MonitorElement * detainendcap_before_
MonitorElement * trig_before_
MonitorElement * sieiebarrel_after_
MonitorElement * detainbarrel_before_
MonitorElement * mt_before_
MonitorElement * nelectrons_after_
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
MonitorElement * hcalisoendcap_before_
MonitorElement * npvs_afterZ_
double calcDeltaPhi(double phi1, double phi2)
MonitorElement * mt_after_
virtual double energy() const
energy
float deltaEtaSuperClusterTrackAtVtx() const
unsigned int prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
float sigmaIetaIeta() const
MonitorElement * jet_et_before_
MonitorElement * njets_after_
MonitorElement * pt_before_
MonitorElement * pt_after_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecTag_
virtual void endRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * hcalisoendcap_after_
MonitorElement * book1D(Args &&...args)
EwkElecDQM(const edm::ParameterSet &)
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
MonitorElement * invmass_before_
MonitorElement * ecalisoendcap_before_
static std::string const triggerResults
MonitorElement * jet_eta_after_
MonitorElement * trig_after_
bool isEndcap(GeomDetEnumerators::SubDetector m)
MonitorElement * jet_eta_before_
static const char *const trigNames[]
void setCurrentFolder(const std::string &fullpath)
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup) const
MonitorElement * detainendcap_after_
MonitorElement * njets_before_
virtual double px() const
x coordinate of momentum vector
MonitorElement * invmassPU_afterZ_
MonitorElement * book2D(Args &&...args)
MonitorElement * trkisobarrel_before_
std::string const & triggerName(unsigned int index) const
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
edm::EDGetTokenT< edm::View< reco::Vertex > > vertexTag_
MonitorElement * met_before_
MonitorElement * trkisoendcap_before_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
virtual double pz() const
z coordinate of momentum vector
float dr03EcalRecHitSumEt() const
edm::EDGetTokenT< edm::TriggerResults > trigTag_
MonitorElement * met_after_
void HERE(const char *msg)
MonitorElement * trkisobarrel_after_
MonitorElement * eta_after_
const std::vector< std::string > elecTrig_
MonitorElement * npvs_before_
MonitorElement * trkisoendcap_after_
float dr03HcalTowerSumEt() const
virtual double phi() const
momentum azimuthal angle
MonitorElement * eta_before_
MonitorElement * invmassPU_before_
virtual double py() const
y coordinate of momentum vector
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override