14 if (!dirName.empty() && dirName.find_last_of(
dqmSeparator) != (dirName.length() - 1))
16 dirName.append(dqmSubDirectory);
26 std::string dqmSubDirectoryElecTauChannel = cfgElecTauChannel.getParameter<
std::string>(
"dqmSubDirectory");
27 cfgElecTauChannel.addParameter<
std::string>(
"dqmDirectory",
92 : dqmDirectory_(cfg.getParameter<std::
string>(
"dqmDirectory")),
93 numEventsAnalyzed_(0),
94 numEventsSelected_(0),
96 numWarningsTriggerResults_(0),
97 numWarningsHLTpath_(0),
98 numWarningsVertex_(0),
99 numWarningsBeamSpot_(0),
100 numWarningsElectron_(0),
101 numWarningsTauJet_(0),
102 numWarningsTauDiscrByLeadTrackFinding_(0),
103 numWarningsTauDiscrByLeadTrackPtCut_(0),
104 numWarningsTauDiscrByTrackIso_(0),
105 numWarningsTauDiscrByEcalIso_(0),
106 numWarningsTauDiscrAgainstElectrons_(0),
107 numWarningsTauDiscrAgainstMuons_(0),
108 numWarningsCaloMEt_(0),
109 numWarningsPFMEt_(0) {
151 hVisMass_ = iBooker.
book1D(
"VisMass",
"e + #tau-Jet visible Mass", 20, 20., 120.);
152 hMtElecPFMEt_ = iBooker.
book1D(
"MtElecPFMEt",
"e + E_{T}^{miss} (PF) transverse Mass", 20, 20., 120.);
156 hVertexZ_ = iBooker.
book1D(
"VertexZ",
"Event Vertex z-Position", 20, -25., +25.);
158 hPFMEtPt_ = iBooker.
book1D(
"PFMEtPt",
"E_{T}^{miss} (PF)", 20, 0., 100.);
181 bool readError =
false;
191 "Failed to access Trigger results");
197 bool isTriggered =
false;
198 for (vstring::const_iterator hltPath =
hltPaths_.begin(); hltPath !=
hltPaths_.end(); ++hltPath) {
200 if (index < triggerNames.
size()) {
201 if (hltDecision->accept(index))
205 edm::LogWarning(
"EwkElecTauHistManager") <<
" Undefined HLT path = " << (*hltPath) <<
" !!";
222 "Failed to access Vertex collection");
226 const reco::Vertex* theEventVertex = (!vertexCollection->empty()) ? &(vertexCollection->at(0)) :
nullptr;
243 "Failed to access Electron collection");
249 double theElectronTrackIsoPt = 1.e+3;
250 double theElectronEcalIsoPt = 1.e+3;
251 double theElectronHcalIsoPt = 1.e+3;
253 theElectronTrackIsoPt = theElectron->
dr03TkSumPt();
258 theElectronTrackIsoPt /= theElectron->
pt();
259 theElectronEcalIsoPt /= theElectron->
pt();
260 theElectronHcalIsoPt /= theElectron->
pt();
272 "Failed to access Tau-jet collection");
280 tauDiscrByLeadTrackFinding,
284 "Failed to access collection of pf. Tau discriminators by "
285 "leading Track finding");
289 tauDiscrByLeadTrackPtCut,
293 "Failed to access collection of pf. Tau discriminators by "
294 "leading Track Pt cut");
302 "Failed to access collection of pf. Tau discriminators by "
311 "Failed to access collection of pf. Tau discriminators by ECAL "
316 tauDiscrAgainstElectrons,
320 "Failed to access collection of pf. Tau discriminators against "
325 tauDiscrAgainstMuons,
329 "Failed to access collection of pf. Tau discriminators against Muons");
333 int theTauJetIndex = -1;
336 double theTauDiscrByLeadTrackFinding = -1.;
337 double theTauDiscrByLeadTrackPtCut = -1.;
338 double theTauDiscrByTrackIso = -1.;
339 double theTauDiscrByEcalIso = -1.;
340 double theTauDiscrAgainstElectrons = -1.;
341 double theTauDiscrAgainstMuons = -1.;
342 if (theTauJetIndex != -1) {
344 theTauDiscrByLeadTrackFinding = (*tauDiscrByLeadTrackFinding)[theTauJetRef];
345 theTauDiscrByLeadTrackPtCut = (*tauDiscrByLeadTrackPtCut)[theTauJetRef];
346 theTauDiscrByTrackIso = (*tauDiscrByTrackIso)[theTauJetRef];
347 theTauDiscrByEcalIso = (*tauDiscrByEcalIso)[theTauJetRef];
348 theTauDiscrAgainstElectrons = (*tauDiscrAgainstElectrons)[theTauJetRef];
349 theTauDiscrAgainstMuons = (*tauDiscrAgainstMuons)[theTauJetRef];
361 "Failed to access calo. MET collection");
374 "Failed to access pf. MET collection");
380 if (!(theElectron && theTauJet && theTauJetIndex != -1))
389 double mElecTau = (theElectron->
p4() + theTauJet->
p4()).M();
393 double mtElecPFMEt =
calcMt(theElectron->
px(), theElectron->
py(), pfMEt.
px(), pfMEt.
py());
405 unsigned numIdElectrons = 0;
406 for (reco::GsfElectronCollection::const_iterator
electron = electrons->begin();
electron != electrons->end();
418 bool fullSelect =
false;
419 int cutFlowStatus = -1;
465 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
494 if (theEventVertex) {
512 edm::LogInfo(
"EwkElecTauHistManager") <<
"Filter-Statistics Summary:" << std::endl
517 edm::LogInfo(
"") <<
"Overall efficiency = " << std::setprecision(4) << eff * 100. <<
" +/- " << std::setprecision(4)
554 : dqmDirectory_(cfg.getParameter<std::
string>(
"dqmDirectory")),
555 numEventsAnalyzed_(0),
556 numEventsSelected_(0),
558 numWarningsTriggerResults_(0),
559 numWarningsHLTpath_(0),
560 numWarningsVertex_(0),
561 numWarningsBeamSpot_(0),
563 numWarningsTauJet_(0),
564 numWarningsTauDiscrByLeadTrackFinding_(0),
565 numWarningsTauDiscrByLeadTrackPtCut_(0),
566 numWarningsTauDiscrByTrackIso_(0),
567 numWarningsTauDiscrByEcalIso_(0),
568 numWarningsTauDiscrAgainstMuons_(0),
569 numWarningsCaloMEt_(0),
570 numWarningsPFMEt_(0) {
624 hVisMass_ = iBooker.
book1D(
"VisMass",
"#mu + #tau-Jet visible Mass", 20, 0., 120.);
625 hVisMassFinal_ = iBooker.
book1D(
"VisMassFinal",
"#mu + #tau-Jet visible final Mass", 20, 0., 120.);
626 hMtMuPFMEt_ = iBooker.
book1D(
"MtMuPFMEt",
"#mu + E_{T}^{miss} (PF) transverse Mass", 20, 0., 120.);
630 hVertexZ_ = iBooker.
book1D(
"VertexZ",
"Event Vertex z-Position", 20, -25., +25.);
632 hPFMEtPt_ = iBooker.
book1D(
"PFMEtPt",
"E_{T}^{miss} (PF)", 20, 0., 100.);
655 bool readError =
false;
665 "Failed to access Trigger results");
671 bool isTriggered =
false;
672 for (vstring::const_iterator hltPath =
hltPaths_.begin(); hltPath !=
hltPaths_.end(); ++hltPath) {
674 if (index < triggerNames.
size()) {
675 if (hltDecision->accept(index))
679 edm::LogWarning(
"EwkMuTauHistManager") <<
" Undefined HLT path = " << (*hltPath) <<
" !!";
696 "Failed to access Vertex collection");
700 const reco::Vertex* theEventVertex = (!vertexCollection->empty()) ? &(vertexCollection->at(0)) :
nullptr;
718 double theMuonTrackIsoPt = 1.e+3;
719 double theMuonEcalIsoPt = 1.e+3;
720 double theMuonCombIsoPt = 1.e+3;
729 theMuonTrackIsoPt /= theMuon->
pt();
730 theMuonEcalIsoPt /= theMuon->
pt();
744 "Failed to access Tau-jet collection");
752 tauDiscrByLeadTrackFinding,
756 "Failed to access collection of pf. Tau discriminators by "
757 "leading Track finding");
761 tauDiscrByLeadTrackPtCut,
765 "Failed to access collection of pf. Tau discriminators by "
766 "leading Track Pt cut");
774 "Failed to access collection of pf. Tau discriminators by "
783 "Failed to access collection of pf. Tau discriminators by ECAL "
788 tauDiscrAgainstMuons,
792 "Failed to access collection of pf. Tau discriminators against Muons");
796 int theTauJetIndex = -1;
799 double theTauDiscrByLeadTrackFinding = -1.;
800 double theTauDiscrByLeadTrackPtCut = -1.;
801 double theTauDiscrByTrackIso = -1.;
802 double theTauDiscrByEcalIso = -1.;
803 double theTauDiscrAgainstMuons = -1.;
804 if (theTauJetIndex != -1) {
806 theTauDiscrByLeadTrackFinding = (*tauDiscrByLeadTrackFinding)[theTauJetRef];
807 theTauDiscrByLeadTrackPtCut = (*tauDiscrByLeadTrackPtCut)[theTauJetRef];
808 theTauDiscrByTrackIso = (*tauDiscrByTrackIso)[theTauJetRef];
809 theTauDiscrByEcalIso = (*tauDiscrByEcalIso)[theTauJetRef];
810 theTauDiscrAgainstMuons = (*tauDiscrAgainstMuons)[theTauJetRef];
822 "Failed to access calo. MET collection");
835 "Failed to access pf. MET collection");
841 if (!(theMuon && theTauJet && theTauJetIndex != -1))
851 double mMuTau = (theMuon->
p4() + theTauJet->
p4()).M();
855 double mtMuPFMEt =
calcMt(theMuon->
px(), theMuon->
px(), pfMEt.
px(), pfMEt.
py());
867 unsigned numGlobalMuons = 0;
868 for (reco::MuonCollection::const_iterator
muon = muons->begin();
muon != muons->end(); ++
muon) {
869 if (
muon->isGlobalMuon()) {
879 int cutFlowStatus = -1;
931 if (theEventVertex) {
977 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
981 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
994 edm::LogInfo(
"EwkMuTauHistManager") <<
"Filter-Statistics Summary:" << std::endl
999 edm::LogInfo(
"") <<
"Overall efficiency = " << std::setprecision(4) << eff * 100. <<
" +/- " << std::setprecision(4)
1014 if (isoMode_string ==
"absoluteIso") {
1016 }
else if (isoMode_string ==
"relativeIso") {
1019 edm::LogError(
"getIsoMode") <<
" Failed to decode isoMode string = " << isoMode_string <<
" !!";
1038 double calcMt(
double px1,
double py1,
double px2,
double py2) {
1039 double pt1 = TMath::Sqrt(px1 * px1 + py1 * py1);
1040 double pt2 = TMath::Sqrt(px2 * px2 + py2 * py2);
1042 double p1Dotp2 = px1 * px2 + py1 * py2;
1043 double cosAlpha = p1Dotp2 / (pt1 * pt2);
1045 return TMath::Sqrt(2 * pt1 * pt2 * (1 - cosAlpha));
1052 double cosPhi1 =
cos(p1.phi());
1053 double sinPhi1 =
sin(p1.phi());
1054 double cosPhi2 =
cos(p2.phi());
1055 double sinPhi2 =
sin(p2.phi());
1056 double zetaX = cosPhi1 + cosPhi2;
1057 double zetaY = sinPhi1 + sinPhi2;
1058 double zetaR = TMath::Sqrt(zetaX * zetaX + zetaY * zetaY);
1064 double pxVis = p1.px() + p2.px();
1065 double pyVis = p1.py() + p2.py();
1066 double pZetaVis = pxVis * zetaX + pyVis * zetaY;
1068 double px = pxVis + pxMEt;
1069 double py = pyVis + pyMEt;
1070 double pZeta = px * zetaX + py * zetaY;
1072 return pZeta - 1.5 * pZetaVis;
1103 double electronEtaCut,
1104 double electronPtCut) {
1107 for (reco::GsfElectronCollection::const_iterator
electron = electrons.begin();
electron != electrons.end();
1111 if (theElectron ==
nullptr ||
electron->pt() > theElectron->
pt())
1122 for (reco::MuonCollection::const_iterator
muon = muons.begin();
muon != muons.end(); ++
muon) {
1124 if (theMuon ==
nullptr ||
muon->pt() > theMuon->
pt())
1133 double tauJetEtaCut,
1135 int& theTauJetIndex) {
1137 theTauJetIndex = -1;
1139 int numTauJets = tauJets.
size();
1140 for (
int iTauJet = 0; iTauJet < numTauJets; ++iTauJet) {
1143 if (fabs(tauJet.
eta()) < tauJetEtaCut && tauJet.
pt() > tauJetPtCut) {
1144 if (theTauJet ==
nullptr || tauJet.
pt() > theTauJet->
pt()) {
1145 theTauJet = &tauJet;
1146 theTauJetIndex = iTauJet;
1155 double dX = vertex.
x() - beamSpot.
x0();
1156 double dY = vertex.
y() - beamSpot.
y0();
1157 return TMath::Sqrt(dX * dX + dY * dY);
MonitorElement * hCutFlowSummary_
edm::InputTag tauDiscrByEcalIso_
long numWarningsTauDiscrByEcalIso_
edm::InputTag beamSpotSource_
double calcDeltaPhi(double phi1, double phi2)
virtual reco::TrackRef leadTrack() const
MonitorElement * hPFMEtPt_
void bookHistograms(DQMStore::IBooker &)
double calcMt(double px1, double py1, double px2, double py2)
edm::InputTag tauDiscrByLeadTrackFinding_
float isolationPFGammaCandsEtSum() const
MonitorElement * hTauJetPhi_
edm::InputTag pfMEtSource_
edm::InputTag beamSpotSource_
std::vector< PFTau > PFTauCollection
collection of PFTau objects
EwkMuTauHistManager(const edm::ParameterSet &)
float sumPt
sum-pt of tracks
float isolationPFChargedHadrCandsPtSum() const
double pt() const final
transverse momentum
edm::InputTag tauDiscrByLeadTrackPtCut_
const LorentzVector & p4(P4Kind kind) const
MonitorElement * hElecTauAcoplanarity_
edm::InputTag electronSource_
virtual void setCurrentFolder(std::string const &fullpath)
int getIsoMode(const std::string &isoMode_string, int &error)
edm::InputTag tauDiscrByTrackIso_
long numWarningsTauDiscrAgainstMuons_
MonitorElement * hVisMass_
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::InputTag tauDiscrByLeadTrackFinding_
long numWarningsTauDiscrByEcalIso_
double getVertexD0(const reco::Vertex &vertex, const reco::BeamSpot &beamSpot)
virtual const reco::TrackRefVector & isolationTracks() const
long numWarningsTauDiscrByTrackIso_
double y() const
y coordinate
MonitorElement * hMuonPhi_
std::vector< std::string > vstring
MonitorElement * hElectronEcalIsoPt_
Sin< T >::type sin(const T &t)
MonitorElement * hTauEcalIsoPt_
std::string dqmDirectory_
long numWarningsTauDiscrByLeadTrackFinding_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
double electronEcalIsoCut_
unsigned int triggerIndex(std::string_view name) const
float dr03HcalTowerSumEt(int depth=0) const
unsigned numEventsSelected_
MonitorElement * hPFMEtPt_
unsigned numEventsSelected_
std::string dqmDirectory_
edm::InputTag tauDiscrByLeadTrackPtCut_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Log< level::Error, false > LogError
std::string dqmDirectoryName(const std::string &dqmRootDirectory, const std::string &dqmSubDirectory)
const MuonIsolation & isolationR05() const
MonitorElement * hCutFlowSummary_
long numWarningsTauDiscrByLeadTrackPtCut_
void finalizeHistograms()
edm::InputTag caloMEtSource_
double electronTrackIsoCut_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
edm::InputTag tauDiscrAgainstMuons_
MonitorElement * hVertexZ_
void fillHistograms(const edm::Event &, const edm::EventSetup &)
MonitorElement * hTauDiscrAgainstMuons_
long numWarningsBeamSpot_
std::vector< Muon > MuonCollection
collection of Muon objects
bool isTrackerMuon() const override
MonitorElement * hMuonEcalIsoPt_
void fillHistograms(const edm::Event &, const edm::EventSetup &)
long numWarningsTauDiscrByTrackIso_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
MonitorElement * hElecTauCharge_
edm::InputTag vertexSource_
const reco::GsfElectron * getTheElectron(const reco::GsfElectronCollection &electrons, double electronEtaCut, double electronPtCut)
MonitorElement * hElectronTrackIsoPt_
MonitorElement * hTauJetNumSignalTracks_
double px() const final
x coordinate of momentum vector
float deltaEtaSuperClusterTrackAtVtx() const
edm::InputTag tauJetSource_
MonitorElement * hMuonEta_
float sigmaIetaIeta() const
void dqmEndRun(const edm::Run &, const edm::EventSetup &) override
bool passesElectronId(const reco::GsfElectron &electron)
MonitorElement * hVisMassFinal_
MonitorElement * hTauLeadTrackPt_
EwkElecTauHistManager * elecTauHistManager_
MonitorElement * hElectronEta_
float deltaPhiSuperClusterTrackAtVtx() const
void addParameter(std::string const &name, T const &value)
Cos< T >::type cos(const T &t)
edm::InputTag caloMEtSource_
long numWarningsTriggerResults_
std::string dqmDirectory_
long numWarningsTauDiscrAgainstMuons_
float dr03TkSumPt() const
MonitorElement * hMtMuPFMEt_
MonitorElement * hCaloMEtPt_
double z() const
z coordinate
MonitorElement * hTauJetPt_
const reco::Muon * getTheMuon(const reco::MuonCollection &muons, double muonEtaCut, double muonPtCut)
edm::InputTag tauDiscrByEcalIso_
MonitorElement * hVertexZ_
const reco::PFTau * getTheTauJet(const reco::PFTauCollection &tauJets, double tauJetEtaCut, double tauJetPtCut, int &theTauJetIndex)
virtual const reco::TrackRefVector & signalTracks() const
MonitorElement * hTauJetPt_
double py() const final
y coordinate of momentum vector
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void finalizeHistograms()
MonitorElement * hTauTrackIsoPt_
MonitorElement * hElectronPhi_
double calcPzeta(const reco::Candidate::LorentzVector &p1, const reco::Candidate::LorentzVector &p2, double pxMEt, double pyMEt)
edm::InputTag tauDiscrAgainstElectrons_
MonitorElement * hCaloMEtPt_
long numWarningsTauDiscrByLeadTrackFinding_
MonitorElement * hMuonPt_
long numWarningsElectron_
Log< level::Info, false > LogInfo
edm::InputTag tauDiscrByTrackIso_
double x() const
x coordinate
MonitorElement * hMuTauDeltaR_
long numWarningsTriggerResults_
edm::InputTag muonSource_
EwkElecTauHistManager(const edm::ParameterSet &)
MonitorElement * hMuTauAcoplanarity_
MonitorElement * hTauJetNumIsoTracks_
MonitorElement * hMuonCombIsoPt_
T getParameter(std::string const &) const
bool isSelected(const std::vector< L1HPSPFTauQualityCut > &qualityCuts, const l1t::PFCandidate &pfCand, float_t primaryVertexZ)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
edm::InputTag vertexSource_
float dr03EcalRecHitSumEt() const
bool passesElectronPreId(const reco::GsfElectron &electron)
edm::InputTag pfMEtSource_
long numWarningsBeamSpot_
EwkMuTauHistManager * muTauHistManager_
std::vector< std::string > vstring
void readEventData(const edm::Event &evt, const edm::InputTag &src, edm::Handle< T > &handle, long &numWarnings, int maxNumWarnings, bool &error, const char *errorMessage)
void bookHistograms(DQMStore::IBooker &)
MonitorElement * hTauJetEta_
edm::InputTag tauJetSource_
edm::InputTag triggerResultsSource_
float hcalOverEcal(const ShowerShape &ss, int depth) const
unsigned numEventsAnalyzed_
double y0() const
y coordinate
size_type size() const
Size of the RefVector.
edm::InputTag triggerResultsSource_
MonitorElement * hTauJetEta_
edm::InputTag tauDiscrAgainstMuons_
const std::string dqmRootDirectory
const std::string dqmSeparator
MonitorElement * hVisMass_
MonitorElement * hMuonTrackIsoPt_
Log< level::Warning, false > LogWarning
unsigned numEventsAnalyzed_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
long numWarningsTauDiscrAgainstElectrons_
double phi() const final
momentum azimuthal angle
EwkTauDQM(const edm::ParameterSet &)
MonitorElement * hElectronPt_
bool isGlobalMuon() const override
MonitorElement * hMtElecPFMEt_
int charge() const final
electric charge
float sigmaEtaEta() const
long numWarningsTauDiscrByLeadTrackPtCut_
double x0() const
x coordinate
double eta() const final
momentum pseudorapidity