34 using namespace isodeposit;
39 trigTag_(cfg.getUntrackedParameter<edm::
InputTag>(
40 "TrigTag", edm::
InputTag(
"TriggerResults::HLT"))),
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")) {
81 theDbe->setCurrentFolder(
"Physics/EwkMuLumiMonitorDQM");
101 bool isConfigChanged =
false;
115 theDbe->book1D(
"Z_2HLT_MASS",
"Z mass [GeV/c^{2}]", 200, 0., 200.);
117 theDbe->book1D(
"Z_1HLT_MASS",
"Z mass [GeV/c^{2}]", 200, 0., 200.);
119 theDbe->book1D(
"Z_NOTISO_MASS",
"Z mass [GeV/c^{2}]", 200, 0., 200.);
121 theDbe->book1D(
"Z_GLBSTA_MASS",
"Z mass [GeV/c^{2}]", 200, 0., 200.);
123 theDbe->book1D(
"Z_GLBTRK_MASS",
"Z mass [GeV/c^{2}]", 200, 0., 200.);
125 "Z mass [GeV/c^{2}]", 200, 0., 200.);
132 "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
134 "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
136 "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
138 theDbe->book1D(
"Z_ISBOTHGLBTRKTHANW_HIGHMASS",
"Z high mass [GeV/c^{2}]",
165 TMass_ =
theDbe->book1D(
"TMASS",
"Transverse mass [GeV]", 300, 0., 300.);
182 for (
size_t i = 0;
i < tracks->size(); ++
i) {
184 double elemPt = elem.
pt();
187 double elemVx = elem.
vx();
188 double elemVy = elem.
vy();
189 double elemD0 =
sqrt(elemVx * elemVx + elemVy * elemVy);
190 if (elemD0 > 0.2)
continue;
191 double dz = fabs(elem.
vz() - tk.
vz());
192 if (dz > 0.1)
continue;
197 if ((dR < 0.01) || (dR > 0.3))
continue;
203 it != calotower->end(); ++it) {
206 if ((dR < 0.1) || (dR > 0.3))
continue;
207 ptSum += it->emEnergy();
208 ptSum += it->hadEnergy();
216 const reco::Muon&
mu,
const std::vector<reco::Particle>& HLTMu,
double DR,
218 size_t dim = HLTMu.size();
220 if (dim == 0)
return false;
221 for (
size_t k = 0;
k < dim;
k++) {
222 if ((
deltaR(HLTMu[
k], mu) < DR) &&
223 (fabs(HLTMu[k].
pt() - mu.
pt()) / HLTMu[k].
pt() < DPtRel)) {
234 LogVerbatim(
"") <<
"\n>>>>>> Z/W SELECTION SUMMARY BEGIN >>>>>>>>>>>>>>>";
235 LogVerbatim(
"") <<
"Total numer of events analyzed: " <<
nall <<
" [events]";
236 LogVerbatim(
"") <<
"Total numer of events selected: " <<
nsel <<
" [events]";
248 LogVerbatim(
"") <<
">>>>>> Z/W SELECTION SUMMARY END >>>>>>>>>>>>>>>\n";
253 bool hlt_sel =
false;
256 bool isMu1Iso =
false;
257 bool isMu2Iso =
false;
258 bool singleTrigFlag1 =
false;
259 bool singleTrigFlag2 =
false;
267 bool trigger_fired =
false;
291 string lowestMuonUnprescaledTrig =
"";
292 bool lowestMuonUnprescaledTrigFound =
false;
293 const std::vector<std::string>& triggerNames =
295 for (
size_t ts = 0; ts < triggerNames.size(); ts++) {
296 string trig = triggerNames[ts];
297 size_t f = trig.find(
"HLT_Mu");
298 if ((f != std::string::npos)) {
302 bool prescaled =
false;
304 for (
unsigned int ps = 0; ps < prescaleSize; ps++) {
305 const unsigned int prescaleValue =
307 if (prescaleValue != 1) prescaled =
true;
314 for (
unsigned int n = 9;
n < 100;
n++) {
315 string lowestTrig =
"HLT_Mu";
316 string lowestTrigv0 =
"copy";
317 std::stringstream
out;
320 lowestTrig.append(s);
321 lowestTrigv0 = lowestTrig;
322 for (
unsigned int v = 1;
v < 10;
v++) {
323 lowestTrig.append(
"_v");
324 std::stringstream oout;
327 lowestTrig.append(ss);
328 if (trig == lowestTrig) lowestMuonUnprescaledTrig = trig;
329 if (trig == lowestTrig) lowestMuonUnprescaledTrigFound =
true;
330 if (trig == lowestTrig)
break;
332 if (lowestMuonUnprescaledTrigFound)
break;
334 lowestTrig = lowestTrigv0;
335 if (trig == lowestTrig) lowestMuonUnprescaledTrig = trig;
339 if (trig == lowestTrig) lowestMuonUnprescaledTrigFound =
true;
340 if (trig == lowestTrig)
break;
342 if (lowestMuonUnprescaledTrigFound)
break;
348 unsigned int triggerIndex;
354 if (triggerIndex < triggerResults->
size())
355 trigger_fired = triggerResults->accept(triggerIndex);
358 const std::vector<std::string>& moduleLabs =
365 size_t moduleLabsSizeMinus2 = moduleLabs.size() - 2;
369 L3FilterName_ = moduleLabs[moduleLabsSizeMinus2];
373 LogTrace(
"") <<
">>> Trigger bit: " << trigger_fired <<
" (" << hltPath_
383 std::vector<reco::Particle> HLTMuMatched;
384 for (
size_t ia = 0; ia < handleTriggerEvent->sizeFilters(); ++ia) {
385 std::string fullname = handleTriggerEvent->filterTag(ia).encode();
388 size_t p = fullname.find_first_of(
':');
389 if (p != std::string::npos) {
390 name = fullname.substr(0, p);
396 for (trigger::Keys::const_iterator ki = k.begin(); ki != k.end(); ++ki) {
399 if (name == L3FilterName_) {
403 HLTMuMatched.push_back(toc[*ki].particle());
426 std::vector<reco::Muon> highPtGlbMuons;
427 std::vector<reco::Muon> highPtStaMuons;
429 for (
size_t i = 0;
i < muons->size();
i++) {
436 double dxy = mu.
innerTrack()->dxy(beamSpotHandle->position());
437 if (fabs(dxy) >
dxyCut_)
continue;
438 highPtGlbMuons.push_back(mu);
446 size_t nHighPtGlbMu = highPtGlbMuons.size();
447 size_t nHighPtStaMu = highPtStaMuons.size();
448 if (hlt_sel && (nHighPtGlbMu > 0)) {
452 (nHighPtGlbMu > 10) ? nHighPtGlbMu = 10 : 1;
454 if (nHighPtGlbMu > 1) {
455 for (
unsigned int i = 0;
i < nHighPtGlbMu;
i++) {
459 for (
unsigned int j =
i + 1;
j < nHighPtGlbMu; ++
j) {
465 double mass = pair.M();
476 if ((singleTrigFlag1 && !singleTrigFlag2) ||
477 (!singleTrigFlag1 && singleTrigFlag2))
486 highPtGlbMuons.erase(highPtGlbMuons.begin() +
i);
487 highPtGlbMuons.erase(highPtGlbMuons.begin() +
j);
489 nHighPtGlbMu = highPtGlbMuons.size();
491 if (isMu1Iso && isMu2Iso) {
526 if (((isMu1Iso && !isMu2Iso) || (!isMu1Iso && isMu2Iso)) &&
556 const MET&
met = metCollection->at(0);
558 for (
unsigned int i = 0;
i < nHighPtGlbMu;
i++) {
574 if (!isMu1Iso)
continue;
578 if (!singleTrigFlag1)
continue;
582 double met_px = met.
px();
583 double met_py = met.
py();
586 for (
unsigned int i = 0;
i < nHighPtGlbMu;
i++) {
588 met_px -= muon1.
px();
589 met_py -= muon1.
py();
592 double met_et = met.
pt();
593 LogTrace(
"") <<
">>> MET, MET_px, MET_py: " << met_et <<
", " << met_px
594 <<
", " << met_py <<
" [GeV]";
595 double w_et = met_et + muon1.
pt();
596 double w_px = met_px + muon1.
px();
597 double w_py = met_py + muon1.
py();
598 double massT = w_et * w_et - w_px * w_px - w_py * w_py;
599 massT = (massT > 0) ?
sqrt(massT) : 0;
602 double acop =
M_PI - fabs(deltaphi.value());
607 if (massT < mtMin_ || massT >
mtMax_)
continue;
619 for (
unsigned int i = 0;
i < nHighPtGlbMu; ++
i) {
626 if (!singleTrigFlag1)
continue;
629 iso1 =
muIso(glbMuon);
631 if (!isMu1Iso)
continue;
634 (nHighPtStaMu > 10) ? nHighPtStaMu = 10 : 1;
635 for (
unsigned int j = 0;
j < nHighPtStaMu; ++
j) {
641 double mass = pair.M();
642 iso2 =
muIso(staMuon);
644 LogTrace(
"") <<
"\t... isolation value" << iso1 <<
", isolated? "
646 LogTrace(
"") <<
"\t... isolation value" << iso2 <<
", isolated? "
680 size_t nTrk = tracks->size();
681 (nTrk > 5000) ? nTrk = 5000 : 1;
682 for (
unsigned int j = 0;
j < nTrk;
j++) {
685 double pt2 = tk.
pt();
687 double dxy = tk.
dxy(beamSpotHandle->position());
692 tk.
px(), tk.
py(), tk.
pz(),
693 sqrt((tk.
p() * tk.
p()) + (0.10566 * 0.10566)));
695 double mass = pair.M();
697 iso2 =
tkIso(tk, tracks, calotower);
726 LogTrace(
"") <<
">>>> Event ACCEPTED";
728 LogTrace(
"") <<
">>>> Event REJECTED";
MonitorElement * highMass1HLT_
double p() const
momentum vector magnitude
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
float sumPt
sum-pt of tracks
virtual float pt() const
transverse momentum
virtual TrackRef innerTrack() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void endRun(const edm::Run &, const edm::EventSetup &)
virtual float phi() const
momentum azimuthal angle
unsigned int nEvWithHighPtMu
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::vector< Track > TrackCollection
collection of Tracks
std::vector< CaloTower >::const_iterator const_iterator
MonitorElement * highMassIsBothGlbTrkThanW_
bool isGlobalMuon() const
double phi() const
azimuthal angle of momentum vector
MonitorElement * highMassGlbTrk_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
MonitorElement * massNotIso_
double px() const
x coordinate of momentum vector
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
bool isStandAloneMuon() const
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.
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_
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 >)
virtual float eta() const
momentum pseudorapidity
double pt() const
track transverse momentum
virtual int charge() const
electric charge
edm::EDGetTokenT< CaloTowerCollection > caloTowerToken_
MonitorElement * highMassNotIso_
edm::EDGetTokenT< reco::TrackCollection > trackToken_
static std::string const triggerResults
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
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
double deltaR(double eta1, double eta2, double phi1, double phi2)
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
double outerEta() const
pseudorapidity of the momentum vector at the outermost hit position
MonitorElement * massGlbSta_
virtual double px() const
x coordinate of momentum vector
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
HLTConfigProvider hltConfigProvider_
double vy() const
y coordinate of the reference point on track
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * mass2HLT_
edm::EDGetTokenT< trigger::TriggerEvent > trigEvToken_
unsigned int prescaleSize() const
MonitorElement * highMass2HLT_
int charge() const
track electric charge
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
double outerPhi() const
azimuthal angle of the momentum vector at the outermost hit position
tuple size
Write out results.
virtual double py() const
y coordinate of momentum vector
double py() const
y coordinate of momentum vector
const MuonIsolation & isolationR03() const
double vx() const
x coordinate of the reference point on track