16 dirName.find_last_of(
dqmSeparator) != (dirName.length() - 1))
18 dirName.append(dqmSubDirectory);
23 : dqmDirectory_(cfg.getParameter<
std::
string>(
"dqmDirectory")) {
34 cfgElecTauChannel.getParameter<
std::string>(
"dqmSubDirectory");
108 numEventsAnalyzed_(0),
109 numEventsSelected_(0),
111 numWarningsTriggerResults_(0),
112 numWarningsHLTpath_(0),
113 numWarningsVertex_(0),
114 numWarningsBeamSpot_(0),
115 numWarningsElectron_(0),
116 numWarningsTauJet_(0),
117 numWarningsTauDiscrByLeadTrackFinding_(0),
118 numWarningsTauDiscrByLeadTrackPtCut_(0),
119 numWarningsTauDiscrByTrackIso_(0),
120 numWarningsTauDiscrByEcalIso_(0),
121 numWarningsTauDiscrAgainstElectrons_(0),
122 numWarningsTauDiscrAgainstMuons_(0),
123 numWarningsCaloMEt_(0),
124 numWarningsPFMEt_(0) {
172 "ElectronTrackIsoPt",
"Electron Track Iso.", 20, -0.01, 0.5);
174 "Electron Ecal Iso.", 20, -0.01, 0.5);
177 iBooker.
book1D(
"TauJetEta",
"#eta_{#tau-Jet}", 20, -4.0, +4.0);
179 iBooker.
book1D(
"VisMass",
"e + #tau-Jet visible Mass", 20, 20., 120.);
181 "MtElecPFMEt",
"e + E_{T}^{miss} (PF) transverse Mass", 20, 20., 120.);
183 iBooker.
book1D(
"ElecTauAcoplanarity",
"#Delta #phi_{e #tau-Jet}", 20,
186 iBooker.
book1D(
"ElecTauCharge",
"Q_{e * #tau-Jet}", 5, -2.5, +2.5);
188 iBooker.
book1D(
"VertexZ",
"Event Vertex z-Position", 20, -25., +25.);
190 iBooker.
book1D(
"CaloMEtPt",
"E_{T}^{miss} (Calo)", 20, 0., 100.);
191 hPFMEtPt_ = iBooker.
book1D(
"PFMEtPt",
"E_{T}^{miss} (PF)", 20, 0., 100.);
193 iBooker.
book1D(
"CutFlowSummary",
"Cut-flow Summary", 11, 0.5, 11.5);
201 "#tau lead. Track P_{T}");
203 "#tau anti-e Discr.");
205 "#tau anti-#mu Discr.");
218 bool readError =
false;
224 "Failed to access Trigger results");
225 if (readError)
return;
229 bool isTriggered =
false;
233 if (index < triggerNames.
size()) {
234 if (hltDecision->
accept(index)) isTriggered =
true;
238 <<
" Undefined HLT path = " << (*hltPath) <<
" !!";
251 "Failed to access Vertex collection");
252 if (readError)
return;
255 (!vertexCollection->empty()) ? &(vertexCollection->at(0)) :
nullptr;
261 if (readError)
return;
267 "Failed to access Electron collection");
268 if (readError)
return;
273 double theElectronTrackIsoPt = 1.e+3;
274 double theElectronEcalIsoPt = 1.e+3;
275 double theElectronHcalIsoPt = 1.e+3;
277 theElectronTrackIsoPt = theElectron->
dr03TkSumPt();
282 theElectronTrackIsoPt /= theElectron->
pt();
283 theElectronEcalIsoPt /= theElectron->
pt();
284 theElectronHcalIsoPt /= theElectron->
pt();
292 "Failed to access Tau-jet collection");
293 if (readError)
return;
300 "Failed to access collection of pf. Tau discriminators by " 301 "leading Track finding");
306 "Failed to access collection of pf. Tau discriminators by " 307 "leading Track Pt cut");
311 "Failed to access collection of pf. Tau discriminators by " 316 "Failed to access collection of pf. Tau discriminators by ECAL " 322 "Failed to access collection of pf. Tau discriminators against " 328 "Failed to access collection of pf. Tau discriminators against Muons");
329 if (readError)
return;
331 int theTauJetIndex = -1;
335 double theTauDiscrByLeadTrackFinding = -1.;
336 double theTauDiscrByLeadTrackPtCut = -1.;
337 double theTauDiscrByTrackIso = -1.;
338 double theTauDiscrByEcalIso = -1.;
339 double theTauDiscrAgainstElectrons = -1.;
340 double theTauDiscrAgainstMuons = -1.;
341 if (theTauJetIndex != -1) {
343 theTauDiscrByLeadTrackFinding = (*tauDiscrByLeadTrackFinding)[theTauJetRef];
344 theTauDiscrByLeadTrackPtCut = (*tauDiscrByLeadTrackPtCut)[theTauJetRef];
345 theTauDiscrByTrackIso = (*tauDiscrByTrackIso)[theTauJetRef];
346 theTauDiscrByEcalIso = (*tauDiscrByEcalIso)[theTauJetRef];
347 theTauDiscrAgainstElectrons = (*tauDiscrAgainstElectrons)[theTauJetRef];
348 theTauDiscrAgainstMuons = (*tauDiscrAgainstMuons)[theTauJetRef];
356 "Failed to access calo. MET collection");
357 if (readError)
return;
364 "Failed to access pf. MET collection");
365 if (readError)
return;
369 if (!(theElectron && theTauJet && theTauJetIndex != -1))
return;
377 double mElecTau = (theElectron->
p4() + theTauJet->
p4()).M();
382 calcMt(theElectron->
px(), theElectron->
py(), pfMEt.
px(), pfMEt.
py());
394 unsigned numIdElectrons = 0;
395 for (reco::GsfElectronCollection::const_iterator
electron =
407 bool isSelected =
false;
408 bool fullSelect =
false;
409 int cutFlowStatus = -1;
432 theTauDiscrByLeadTrackFinding > 0.5) {
438 theTauDiscrByLeadTrackPtCut > 0.5) {
443 theTauDiscrAgainstElectrons > 0.5) {
448 theTauDiscrAgainstMuons > 0.5) {
453 theTauDiscrByTrackIso > 0.5) {
463 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
492 if (theEventVertex) {
510 <<
"Filter-Statistics Summary:" << std::endl
515 edm::LogInfo(
"") <<
"Overall efficiency = " << std::setprecision(4)
516 << eff * 100. <<
" +/- " << std::setprecision(4)
619 iBooker.
book1D(
"MuonTrackIsoPt",
"Muon Track Iso.", 20, -0.01, 10.);
621 iBooker.
book1D(
"MuonEcalIsoPt",
"Muon Ecal Iso.", 20, -0.01, 10.);
623 iBooker.
book1D(
"MuonCombIsoPt",
"Muon Comb Iso.", 20, -0.01, 1.);
627 iBooker.
book1D(
"TauJetEta",
"#eta_{#tau-Jet}", 20, -4.0, +4.0);
631 "P_{T}^{#tau-Jetldg trk}", 20, 0., 50.);
633 iBooker.
book1D(
"TauTrackIsoPt",
"Tau Track Iso.", 20, -0.01, 40.);
635 iBooker.
book1D(
"TauEcalIsoPt",
"Tau Ecal Iso.", 10, -0.01, 10.);
637 "TauDiscrAgainstMuons",
"Tau Discr. against Muons", 2, -0.5, +1.5);
639 "TauJetNumSignalTracks",
"Num. Tau signal Cone Tracks", 20, -0.5, +19.5);
641 "TauJetNumIsoTracks",
"Num. Tau isolation Cone Tracks", 20, -0.5, +19.5);
644 iBooker.
book1D(
"VisMass",
"#mu + #tau-Jet visible Mass", 20, 0., 120.);
646 "VisMassFinal",
"#mu + #tau-Jet visible final Mass", 20, 0., 120.);
648 "MtMuPFMEt",
"#mu + E_{T}^{miss} (PF) transverse Mass", 20, 0., 120.);
650 iBooker.
book1D(
"MuTauAcoplanarity",
"#Delta #phi_{#mu #tau-Jet}", 20,
653 iBooker.
book1D(
"MuTauDeltaR",
"#Delta R_{#mu #tau-Jet}", 20, 0, 5);
655 iBooker.
book1D(
"VertexZ",
"Event Vertex z-Position", 20, -25., +25.);
657 iBooker.
book1D(
"CaloMEtPt",
"E_{T}^{miss} (Calo)", 20, 0., 100.);
658 hPFMEtPt_ = iBooker.
book1D(
"PFMEtPt",
"E_{T}^{miss} (PF)", 20, 0., 100.);
660 iBooker.
book1D(
"CutFlowSummary",
"Cut-flow Summary", 11, 0.5, 11.5);
668 "#tau lead. Track P_{T}");
672 "#tau anti-#mu Discr.");
684 bool readError =
false;
690 "Failed to access Trigger results");
691 if (readError)
return;
695 bool isTriggered =
false;
699 if (index < triggerNames.
size()) {
700 if (hltDecision->
accept(index)) isTriggered =
true;
704 <<
" Undefined HLT path = " << (*hltPath) <<
" !!";
717 "Failed to access Vertex collection");
718 if (readError)
return;
721 (!vertexCollection->empty()) ? &(vertexCollection->at(0)) :
nullptr;
727 if (readError)
return;
732 readError,
"Failed to access Muon collection");
733 if (readError)
return;
737 double theMuonTrackIsoPt = 1.e+3;
738 double theMuonEcalIsoPt = 1.e+3;
739 double theMuonCombIsoPt = 1.e+3;
748 theMuonTrackIsoPt /= theMuon->
pt();
749 theMuonEcalIsoPt /= theMuon->
pt();
761 "Failed to access Tau-jet collection");
762 if (readError)
return;
769 "Failed to access collection of pf. Tau discriminators by " 770 "leading Track finding");
775 "Failed to access collection of pf. Tau discriminators by " 776 "leading Track Pt cut");
780 "Failed to access collection of pf. Tau discriminators by " 785 "Failed to access collection of pf. Tau discriminators by ECAL " 791 "Failed to access collection of pf. Tau discriminators against Muons");
792 if (readError)
return;
794 int theTauJetIndex = -1;
798 double theTauDiscrByLeadTrackFinding = -1.;
799 double theTauDiscrByLeadTrackPtCut = -1.;
800 double theTauDiscrByTrackIso = -1.;
801 double theTauDiscrByEcalIso = -1.;
802 double theTauDiscrAgainstMuons = -1.;
803 if (theTauJetIndex != -1) {
805 theTauDiscrByLeadTrackFinding = (*tauDiscrByLeadTrackFinding)[theTauJetRef];
806 theTauDiscrByLeadTrackPtCut = (*tauDiscrByLeadTrackPtCut)[theTauJetRef];
807 theTauDiscrByTrackIso = (*tauDiscrByTrackIso)[theTauJetRef];
808 theTauDiscrByEcalIso = (*tauDiscrByEcalIso)[theTauJetRef];
809 theTauDiscrAgainstMuons = (*tauDiscrAgainstMuons)[theTauJetRef];
817 "Failed to access calo. MET collection");
818 if (readError)
return;
825 "Failed to access pf. MET collection");
826 if (readError)
return;
830 if (!(theMuon && theTauJet && theTauJetIndex != -1))
return;
840 double mMuTau = (theMuon->
p4() + theTauJet->
p4()).M();
857 unsigned numGlobalMuons = 0;
858 for (reco::MuonCollection::const_iterator
muon = muons->begin();
860 if (
muon->isGlobalMuon()) {
869 bool isSelected =
false;
870 int cutFlowStatus = -1;
885 if (cutFlowStatus ==
kPassedMuonId && (theTauDiscrByLeadTrackFinding > 0.5) &&
890 theTauDiscrByLeadTrackPtCut > 0.5) {
925 if (theEventVertex) {
975 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
979 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
993 <<
"Filter-Statistics Summary:" << std::endl
998 edm::LogInfo(
"") <<
"Overall efficiency = " << std::setprecision(4)
999 << eff * 100. <<
" +/- " << std::setprecision(4)
1015 if (isoMode_string ==
"absoluteIso") {
1017 }
else if (isoMode_string ==
"relativeIso") {
1021 <<
" Failed to decode isoMode string = " << isoMode_string <<
" !!";
1031 if (deltaPhi < 0.) deltaPhi = -
deltaPhi;
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));
1051 double cosPhi1 =
cos(p1.phi());
1052 double sinPhi1 =
sin(p1.phi());
1053 double cosPhi2 =
cos(p2.phi());
1054 double sinPhi2 =
sin(p2.phi());
1055 double zetaX = cosPhi1 + cosPhi2;
1056 double zetaY = sinPhi1 + sinPhi2;
1057 double zetaR = TMath::Sqrt(zetaX * zetaX + zetaY * zetaY);
1063 double pxVis = p1.px() + p2.px();
1064 double pyVis = p1.py() + p2.py();
1065 double pZetaVis = pxVis * zetaX + pyVis * zetaY;
1067 double px = pxVis + pxMEt;
1068 double py = pyVis + pyMEt;
1069 double pZeta = px * zetaX + py * zetaY;
1071 return pZeta - 1.5 * pZetaVis;
1106 double electronPtCut) {
1109 for (reco::GsfElectronCollection::const_iterator
electron = electrons.begin();
1113 if (theElectron ==
nullptr ||
electron->pt() > theElectron->
pt())
1125 for (reco::MuonCollection::const_iterator
muon = muons.begin();
1128 if (theMuon ==
nullptr ||
muon->pt() > theMuon->
pt()) theMuon = &(*
muon);
1136 double tauJetEtaCut,
double tauJetPtCut,
1137 int& theTauJetIndex) {
1139 theTauJetIndex = -1;
1141 int numTauJets = tauJets.
size();
1142 for (
int iTauJet = 0; iTauJet < numTauJets; ++iTauJet) {
1145 if (fabs(tauJet.
eta()) < tauJetEtaCut && tauJet.
pt() > tauJetPtCut) {
1146 if (theTauJet ==
nullptr || tauJet.
pt() > theTauJet->
pt()) {
1147 theTauJet = &tauJet;
1148 theTauJetIndex = iTauJet;
1157 double dX = vertex.
x() - beamSpot.
x0();
1158 double dY = vertex.
y() - beamSpot.
y0();
1159 return TMath::Sqrt(dX * dX + dY * dY);
MonitorElement * hCutFlowSummary_
edm::InputTag tauDiscrByEcalIso_
long numWarningsTauDiscrByEcalIso_
edm::InputTag beamSpotSource_
T getParameter(std::string const &) const
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
double eta() const final
momentum pseudorapidity
EwkMuTauHistManager(const edm::ParameterSet &)
float sumPt
sum-pt of tracks
float isolationPFChargedHadrCandsPtSum() const
edm::InputTag tauDiscrByLeadTrackPtCut_
const LorentzVector & p4(P4Kind kind) const
MonitorElement * hElecTauAcoplanarity_
edm::InputTag electronSource_
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_
double px() const final
x coordinate of momentum vector
Sin< T >::type sin(const T &t)
bool accept() const
Has at least one path accepted the event?
MonitorElement * hTauEcalIsoPt_
std::string dqmDirectory_
long numWarningsTauDiscrByLeadTrackFinding_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
double electronEcalIsoCut_
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)
unsigned numEventsSelected_
MonitorElement * hPFMEtPt_
double pt() const final
transverse momentum
int charge() const final
electric charge
unsigned numEventsSelected_
std::string dqmDirectory_
Strings::size_type size() const
edm::InputTag tauDiscrByLeadTrackPtCut_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
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
MonitorElement * hMuonEcalIsoPt_
void fillHistograms(const edm::Event &, const edm::EventSetup &)
long numWarningsTauDiscrByTrackIso_
bool isTrackerMuon() const override
MonitorElement * hElecTauCharge_
edm::InputTag vertexSource_
const reco::GsfElectron * getTheElectron(const reco::GsfElectronCollection &electrons, double electronEtaCut, double electronPtCut)
MonitorElement * hElectronTrackIsoPt_
MonitorElement * hTauJetNumSignalTracks_
float deltaEtaSuperClusterTrackAtVtx() const
edm::InputTag tauJetSource_
MonitorElement * hMuonEta_
float sigmaIetaIeta() const
unsigned int triggerIndex(std::string const &name) const
bool passesElectronId(const reco::GsfElectron &electron)
MonitorElement * hVisMassFinal_
MonitorElement * hTauLeadTrackPt_
bool isGlobalMuon() const override
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_
float hcalOverEcal() const
MonitorElement * book1D(Args &&...args)
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)
const LorentzVector & p4() const final
four-momentum Lorentz vector
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_
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_
edm::InputTag tauDiscrByTrackIso_
double x() const
x coordinate
MonitorElement * hMuTauDeltaR_
long numWarningsTriggerResults_
void setCurrentFolder(const std::string &fullpath)
edm::InputTag muonSource_
EwkElecTauHistManager(const edm::ParameterSet &)
MonitorElement * hMuTauAcoplanarity_
MonitorElement * hTauJetNumIsoTracks_
MonitorElement * hMuonCombIsoPt_
double py() const final
y coordinate of momentum vector
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_
unsigned numEventsAnalyzed_
double y0() const
y coordinate
size_type size() const
Size of the RefVector.
void endRun(const edm::Run &, const edm::EventSetup &) override
edm::InputTag triggerResultsSource_
float dr03HcalTowerSumEt() const
MonitorElement * hTauJetEta_
edm::InputTag tauDiscrAgainstMuons_
const std::string dqmRootDirectory
const std::string dqmSeparator
MonitorElement * hVisMass_
MonitorElement * hMuonTrackIsoPt_
unsigned numEventsAnalyzed_
long numWarningsTauDiscrAgainstElectrons_
double phi() const final
momentum azimuthal angle
EwkTauDQM(const edm::ParameterSet &)
MonitorElement * hElectronPt_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
MonitorElement * hMtElecPFMEt_
float sigmaEtaEta() const
long numWarningsTauDiscrByLeadTrackPtCut_
double x0() const
x coordinate