34 using namespace isodeposit;
42 trigEvToken_(consumes<
trigger::TriggerEvent>(
43 cfg.getUntrackedParameter<
edm::
InputTag>(
"triggerEvent"))),
46 "offlineBeamSpot",
edm::
InputTag(
"offlineBeamSpot")))),
48 cfg.getUntrackedParameter<
edm::
InputTag>(
"muons"))),
50 cfg.getUntrackedParameter<
edm::
InputTag>(
"tracks"))),
52 cfg.getUntrackedParameter<
edm::
InputTag>(
"calotower"))),
54 cfg.getUntrackedParameter<
edm::
InputTag>(
"metTag"))),
55 metIncludesMuons_(cfg.getUntrackedParameter<
bool>(
"METIncludesMuons")),
62 ptMuCut_(cfg.getUntrackedParameter<double>(
"ptMuCut")),
63 etaMuCut_(cfg.getUntrackedParameter<double>(
"etaMuCut")),
64 isRelativeIso_(cfg.getUntrackedParameter<
bool>(
"IsRelativeIso")),
65 isCombinedIso_(cfg.getUntrackedParameter<
bool>(
"IsCombinedIso")),
66 isoCut03_(cfg.getUntrackedParameter<double>(
"IsoCut03")),
68 ptThreshold_(cfg.getUntrackedParameter<double>(
"ptThreshold")),
70 maxDPtRel_(cfg.getUntrackedParameter<double>(
"maxDPtRel")),
71 maxDeltaR_(cfg.getUntrackedParameter<double>(
"maxDeltaR")),
72 mtMin_(cfg.getUntrackedParameter<double>(
"mtMin")),
73 mtMax_(cfg.getUntrackedParameter<double>(
"mtMax")),
74 acopCut_(cfg.getUntrackedParameter<double>(
"acopCut")),
75 dxyCut_(cfg.getUntrackedParameter<double>(
"DxyCut")) {
97 bool isConfigChanged =
false;
111 mass2HLT_ = ibooker.
book1D(
"Z_2HLT_MASS",
"Z mass [GeV/c^{2}]", 200, 0., 200.);
112 mass1HLT_ = ibooker.
book1D(
"Z_1HLT_MASS",
"Z mass [GeV/c^{2}]", 200, 0., 200.);
113 massNotIso_ = ibooker.
book1D(
"Z_NOTISO_MASS",
"Z mass [GeV/c^{2}]", 200, 0., 200.);
114 massGlbSta_ = ibooker.
book1D(
"Z_GLBSTA_MASS",
"Z mass [GeV/c^{2}]", 200, 0., 200.);
115 massGlbTrk_ = ibooker.
book1D(
"Z_GLBTRK_MASS",
"Z mass [GeV/c^{2}]", 200, 0., 200.);
117 "Z mass [GeV/c^{2}]", 200, 0., 200.);
120 "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
122 "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
124 "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
126 "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
128 "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
130 "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
132 TMass_ = ibooker.
book1D(
"TMASS",
"Transverse mass [GeV]", 300, 0., 300.);
149 for (
size_t i = 0;
i < tracks->size(); ++
i) {
151 double elemPt = elem.
pt();
154 double elemVx = elem.
vx();
155 double elemVy = elem.
vy();
156 double elemD0 =
sqrt(elemVx * elemVx + elemVy * elemVy);
157 if (elemD0 > 0.2)
continue;
158 double dz = fabs(elem.
vz() - tk.
vz());
159 if (dz > 0.1)
continue;
164 if ((dR < 0.01) || (dR > 0.3))
continue;
170 it != calotower->
end(); ++it) {
173 if ((dR < 0.1) || (dR > 0.3))
continue;
174 ptSum += it->emEnergy();
175 ptSum += it->hadEnergy();
183 const reco::Muon&
mu,
const std::vector<reco::Particle>& HLTMu,
double DR,
185 size_t dim = HLTMu.size();
187 if (dim == 0)
return false;
188 for (
size_t k = 0;
k < dim;
k++) {
189 if ((
deltaR(HLTMu[
k], mu) < DR) &&
190 (fabs(HLTMu[k].
pt() - mu.
pt()) / HLTMu[k].
pt() < DPtRel)) {
199 LogVerbatim(
"") <<
"\n>>>>>> Z/W SELECTION SUMMARY BEGIN >>>>>>>>>>>>>>>";
200 LogVerbatim(
"") <<
"Total numer of events analyzed: " <<
nall <<
" [events]";
201 LogVerbatim(
"") <<
"Total numer of events selected: " <<
nsel <<
" [events]";
213 LogVerbatim(
"") <<
">>>>>> Z/W SELECTION SUMMARY END >>>>>>>>>>>>>>>\n";
218 bool hlt_sel =
false;
221 bool isMu1Iso =
false;
222 bool isMu2Iso =
false;
223 bool singleTrigFlag1 =
false;
224 bool singleTrigFlag2 =
false;
232 bool trigger_fired =
false;
256 string lowestMuonUnprescaledTrig =
"";
257 bool lowestMuonUnprescaledTrigFound =
false;
258 const std::vector<std::string>& triggerNames =
260 for (
size_t ts = 0; ts < triggerNames.size(); ts++) {
261 string trig = triggerNames[ts];
262 size_t f = trig.find(
"HLT_Mu");
263 if ((f != std::string::npos)) {
267 bool prescaled =
false;
269 for (
unsigned int ps = 0; ps < prescaleSize; ps++) {
270 const unsigned int prescaleValue =
272 if (prescaleValue != 1) prescaled =
true;
279 for (
unsigned int n = 9;
n < 100;
n++) {
280 string lowestTrig =
"HLT_Mu";
281 string lowestTrigv0 =
"copy";
282 std::stringstream
out;
285 lowestTrig.append(s);
286 lowestTrigv0 = lowestTrig;
287 for (
unsigned int v = 1;
v < 10;
v++) {
288 lowestTrig.append(
"_v");
289 std::stringstream oout;
292 lowestTrig.append(ss);
293 if (trig == lowestTrig) lowestMuonUnprescaledTrig = trig;
294 if (trig == lowestTrig) lowestMuonUnprescaledTrigFound =
true;
295 if (trig == lowestTrig)
break;
297 if (lowestMuonUnprescaledTrigFound)
break;
299 lowestTrig = lowestTrigv0;
300 if (trig == lowestTrig) lowestMuonUnprescaledTrig = trig;
304 if (trig == lowestTrig) lowestMuonUnprescaledTrigFound =
true;
305 if (trig == lowestTrig)
break;
307 if (lowestMuonUnprescaledTrigFound)
break;
313 unsigned int triggerIndex;
319 if (triggerIndex < triggerResults->
size())
320 trigger_fired = triggerResults->
accept(triggerIndex);
323 const std::vector<std::string>& moduleLabs =
330 size_t moduleLabsSizeMinus2 = moduleLabs.size() - 2;
334 L3FilterName_ = moduleLabs[moduleLabsSizeMinus2];
338 LogTrace(
"") <<
">>> Trigger bit: " << trigger_fired <<
" (" << hltPath_
348 std::vector<reco::Particle> HLTMuMatched;
349 for (
size_t ia = 0; ia < handleTriggerEvent->
sizeFilters(); ++ia) {
353 size_t p = fullname.find_first_of(
':');
354 if (p != std::string::npos) {
355 name = fullname.substr(0, p);
361 for (trigger::Keys::const_iterator ki = k.begin(); ki != k.end(); ++ki) {
364 if (name == L3FilterName_) {
368 HLTMuMatched.push_back(toc[*ki].particle());
391 std::vector<reco::Muon> highPtGlbMuons;
392 std::vector<reco::Muon> highPtStaMuons;
394 for (
size_t i = 0;
i < muons->size();
i++) {
402 if (fabs(dxy) >
dxyCut_)
continue;
403 highPtGlbMuons.push_back(mu);
411 size_t nHighPtGlbMu = highPtGlbMuons.size();
412 size_t nHighPtStaMu = highPtStaMuons.size();
413 if (hlt_sel && (nHighPtGlbMu > 0)) {
417 (nHighPtGlbMu > 10) ? nHighPtGlbMu = 10 : 1;
419 if (nHighPtGlbMu > 1) {
420 for (
unsigned int i = 0;
i < nHighPtGlbMu;
i++) {
424 for (
unsigned int j =
i + 1; j < nHighPtGlbMu; ++j) {
430 double mass = pair.M();
441 if ((singleTrigFlag1 && !singleTrigFlag2) ||
442 (!singleTrigFlag1 && singleTrigFlag2))
451 highPtGlbMuons.erase(highPtGlbMuons.begin() +
i);
452 highPtGlbMuons.erase(highPtGlbMuons.begin() + j);
454 nHighPtGlbMu = highPtGlbMuons.size();
456 if (isMu1Iso && isMu2Iso) {
491 if (((isMu1Iso && !isMu2Iso) || (!isMu1Iso && isMu2Iso)) &&
521 const MET&
met = metCollection->at(0);
523 for (
unsigned int i = 0;
i < nHighPtGlbMu;
i++) {
539 if (!isMu1Iso)
continue;
543 if (!singleTrigFlag1)
continue;
547 double met_px = met.
px();
548 double met_py = met.
py();
551 for (
unsigned int i = 0;
i < nHighPtGlbMu;
i++) {
553 met_px -= muon1.
px();
554 met_py -= muon1.
py();
557 double met_et = met.
pt();
558 LogTrace(
"") <<
">>> MET, MET_px, MET_py: " << met_et <<
", " << met_px
559 <<
", " << met_py <<
" [GeV]";
560 double w_et = met_et + muon1.
pt();
561 double w_px = met_px + muon1.
px();
562 double w_py = met_py + muon1.
py();
563 double massT = w_et * w_et - w_px * w_px - w_py * w_py;
564 massT = (massT > 0) ?
sqrt(massT) : 0;
567 double acop =
M_PI - fabs(deltaphi.value());
572 if (massT < mtMin_ || massT >
mtMax_)
continue;
584 for (
unsigned int i = 0;
i < nHighPtGlbMu; ++
i) {
591 if (!singleTrigFlag1)
continue;
594 iso1 =
muIso(glbMuon);
596 if (!isMu1Iso)
continue;
599 (nHighPtStaMu > 10) ? nHighPtStaMu = 10 : 1;
600 for (
unsigned int j = 0; j < nHighPtStaMu; ++j) {
606 double mass = pair.M();
607 iso2 =
muIso(staMuon);
609 LogTrace(
"") <<
"\t... isolation value" << iso1 <<
", isolated? " 611 LogTrace(
"") <<
"\t... isolation value" << iso2 <<
", isolated? " 645 size_t nTrk = tracks->size();
646 (nTrk > 5000) ? nTrk = 5000 : 1;
647 for (
unsigned int j = 0; j < nTrk; j++) {
650 double pt2 = tk.
pt();
657 tk.
px(), tk.
py(), tk.
pz(),
658 sqrt((tk.
p() * tk.
p()) + (0.10566 * 0.10566)));
660 double mass = pair.M();
662 iso2 =
tkIso(tk, tracks, calotower);
691 LogTrace(
"") <<
">>>> Event ACCEPTED";
693 LogTrace(
"") <<
">>>> Event REJECTED";
MonitorElement * highMass1HLT_
double p() const
momentum vector magnitude
double eta() const final
momentum pseudorapidity
bool isStandAloneMuon() const override
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
float sumPt
sum-pt of tracks
trigger::size_type sizeFilters() const
virtual TrackRef innerTrack() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
unsigned int nEvWithHighPtMu
double px() const final
x coordinate of momentum vector
bool accept() const
Has at least one path accepted the event?
const std::vector< std::string > & triggerNames() const
names of trigger paths
const Keys & filterKeys(trigger::size_type index) const
std::vector< Track > TrackCollection
collection of Tracks
std::vector< CaloTower >::const_iterator const_iterator
MonitorElement * highMassIsBothGlbTrkThanW_
double phi() const
azimuthal angle of momentum vector
double pt() const final
transverse momentum
MonitorElement * highMassGlbTrk_
int charge() const final
electric charge
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
MonitorElement * massNotIso_
double px() const
x coordinate of momentum vector
MonitorElement * highMassGlbSta_
EwkMuLumiMonitorDQM(const edm::ParameterSet &)
edm::EDGetTokenT< edm::TriggerResults > trigToken_
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
MonitorElement * mass1HLT_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void analyze(const edm::Event &, const edm::EventSetup &) override
unsigned int prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
double eta() const
pseudorapidity of momentum vector
MonitorElement * massIsBothGlbTrkThanW_
void setCurrentFolder(std::string const &fullpath)
MonitorElement * massGlbTrk_
bool IsMuMatchedToHLTMu(const reco::Muon &, const std::vector< reco::Particle > &, double, double)
double tkIso(const reco::Track &, edm::Handle< reco::TrackCollection >, edm::Handle< CaloTowerCollection >)
bool isGlobalMuon() const override
const TriggerObjectCollection & getObjects() const
double pt() const
track transverse momentum
edm::EDGetTokenT< CaloTowerCollection > caloTowerToken_
MonitorElement * book1D(Args &&...args)
MonitorElement * highMassNotIso_
const LorentzVector & p4() const final
four-momentum Lorentz vector
edm::EDGetTokenT< reco::TrackCollection > trackToken_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
static std::string const triggerResults
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
def elem(elemtype, innerHTML='', html_class='', kwargs)
double pz() const
z coordinate of momentum vector
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
const_iterator end() const
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
double vz() const
z coordinate of the reference point on track
const edm::InputTag filterTag(trigger::size_type index) const
double outerEta() const
pseudorapidity of the momentum vector at the outermost hit position
MonitorElement * massGlbSta_
double muIso(const reco::Muon &)
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
void endRun(const edm::Run &, const edm::EventSetup &) override
double py() const final
y coordinate of momentum vector
HLTConfigProvider hltConfigProvider_
double vy() const
y coordinate of the reference point on track
MonitorElement * mass2HLT_
edm::EDGetTokenT< trigger::TriggerEvent > trigEvToken_
unsigned int prescaleSize() const
MonitorElement * highMass2HLT_
int charge() const
track electric charge
const Point & position() const
position
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
double phi() const final
momentum azimuthal angle
double outerPhi() const
azimuthal angle of the momentum vector at the outermost hit position
const_iterator begin() const
double py() const
y coordinate of momentum vector
const MuonIsolation & isolationR03() const
double vx() const
x coordinate of the reference point on track