16 dirName.find_last_of(
dqmSeparator) != (dirName.length() - 1))
18 dirName.append(dqmSubDirectory);
23 : dqmDirectory_(cfg.getParameter<std::
string>(
"dqmDirectory")),
26 edm::LogError(
"EwkTauDQM") <<
" Failed to access dqmStore --> histograms "
27 "will NEITHER be booked NOR filled !!";
44 cfgElecTauChannel.getParameter<
std::string>(
"dqmSubDirectory");
122 : dqmStore_(dqmStore),
123 dqmDirectory_(cfg.getParameter<std::
string>(
"dqmDirectory")),
124 numEventsAnalyzed_(0),
125 numEventsSelected_(0),
127 numWarningsTriggerResults_(0),
128 numWarningsHLTpath_(0),
129 numWarningsVertex_(0),
130 numWarningsBeamSpot_(0),
131 numWarningsElectron_(0),
132 numWarningsTauJet_(0),
133 numWarningsTauDiscrByLeadTrackFinding_(0),
134 numWarningsTauDiscrByLeadTrackPtCut_(0),
135 numWarningsTauDiscrByTrackIso_(0),
136 numWarningsTauDiscrByEcalIso_(0),
137 numWarningsTauDiscrAgainstElectrons_(0),
138 numWarningsTauDiscrAgainstMuons_(0),
139 numWarningsCaloMEt_(0),
140 numWarningsPFMEt_(0) {
191 "ElectronTrackIsoPt",
"Electron Track Iso.", 20, -0.01, 0.5);
193 "Electron Ecal Iso.", 20, -0.01, 0.5);
220 dqmStore_->
book1D(
"VisMass",
"e + #tau-Jet visible Mass", 20, 20., 120.);
224 "MtElecPFMEt",
"e + E_{T}^{miss} (PF) transverse Mass", 20, 20., 120.);
230 dqmStore_->
book1D(
"ElecTauAcoplanarity",
"#Delta #phi_{e #tau-Jet}", 20,
238 dqmStore_->
book1D(
"VertexZ",
"Event Vertex z-Position", 20, -25., +25.);
252 dqmStore_->
book1D(
"CutFlowSummary",
"Cut-flow Summary", 11, 0.5, 11.5);
260 "#tau lead. Track P_{T}");
262 "#tau anti-e Discr.");
264 "#tau anti-#mu Discr.");
277 bool readError =
false;
283 "Failed to access Trigger results");
284 if (readError)
return;
288 bool isTriggered =
false;
289 for (vstring::const_iterator hltPath =
hltPaths_.begin();
292 if (index < triggerNames.
size()) {
293 if (hltDecision->accept(index)) isTriggered =
true;
297 <<
" Undefined HLT path = " << (*hltPath) <<
" !!";
310 "Failed to access Vertex collection");
311 if (readError)
return;
314 (vertexCollection->size() > 0) ? &(vertexCollection->at(0)) : 0;
320 if (readError)
return;
326 "Failed to access Electron collection");
327 if (readError)
return;
332 double theElectronTrackIsoPt = 1.e+3;
333 double theElectronEcalIsoPt = 1.e+3;
334 double theElectronHcalIsoPt = 1.e+3;
336 theElectronTrackIsoPt = theElectron->
dr03TkSumPt();
341 theElectronTrackIsoPt /= theElectron->
pt();
342 theElectronEcalIsoPt /= theElectron->
pt();
343 theElectronHcalIsoPt /= theElectron->
pt();
351 "Failed to access Tau-jet collection");
352 if (readError)
return;
359 "Failed to access collection of pf. Tau discriminators by "
360 "leading Track finding");
365 "Failed to access collection of pf. Tau discriminators by "
366 "leading Track Pt cut");
370 "Failed to access collection of pf. Tau discriminators by "
375 "Failed to access collection of pf. Tau discriminators by ECAL "
381 "Failed to access collection of pf. Tau discriminators against "
387 "Failed to access collection of pf. Tau discriminators against Muons");
388 if (readError)
return;
390 int theTauJetIndex = -1;
394 double theTauDiscrByLeadTrackFinding = -1.;
395 double theTauDiscrByLeadTrackPtCut = -1.;
396 double theTauDiscrByTrackIso = -1.;
397 double theTauDiscrByEcalIso = -1.;
398 double theTauDiscrAgainstElectrons = -1.;
399 double theTauDiscrAgainstMuons = -1.;
400 if (theTauJetIndex != -1) {
402 theTauDiscrByLeadTrackFinding = (*tauDiscrByLeadTrackFinding)[theTauJetRef];
403 theTauDiscrByLeadTrackPtCut = (*tauDiscrByLeadTrackPtCut)[theTauJetRef];
404 theTauDiscrByTrackIso = (*tauDiscrByTrackIso)[theTauJetRef];
405 theTauDiscrByEcalIso = (*tauDiscrByEcalIso)[theTauJetRef];
406 theTauDiscrAgainstElectrons = (*tauDiscrAgainstElectrons)[theTauJetRef];
407 theTauDiscrAgainstMuons = (*tauDiscrAgainstMuons)[theTauJetRef];
415 "Failed to access calo. MET collection");
416 if (readError)
return;
423 "Failed to access pf. MET collection");
424 if (readError)
return;
428 if (!(theElectron && theTauJet && theTauJetIndex != -1))
return;
436 double mElecTau = (theElectron->
p4() + theTauJet->
p4()).M();
441 calcMt(theElectron->
px(), theElectron->
py(), pfMEt.
px(), pfMEt.
py());
453 unsigned numIdElectrons = 0;
454 for (reco::GsfElectronCollection::const_iterator
electron =
466 bool isSelected =
false;
467 bool fullSelect =
false;
468 int cutFlowStatus = -1;
474 (isTriggered ||
hltPaths_.size() == 0)) {
491 theTauDiscrByLeadTrackFinding > 0.5) {
497 theTauDiscrByLeadTrackPtCut > 0.5) {
502 theTauDiscrAgainstElectrons > 0.5) {
507 theTauDiscrAgainstMuons > 0.5) {
512 theTauDiscrByTrackIso > 0.5) {
522 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
551 if (theEventVertex) {
568 edm::LogInfo(
"EwkElecTauHistManager") <<
"Filter-Statistics Summary:"
569 << std::endl <<
" Events analyzed = "
571 <<
" Events selected = "
575 edm::LogInfo(
"") <<
"Overall efficiency = " << std::setprecision(4)
576 << eff * 100. <<
" +/- " << std::setprecision(4)
616 : dqmStore_(dqmStore),
617 dqmDirectory_(cfg.getParameter<std::
string>(
"dqmDirectory")),
618 numEventsAnalyzed_(0),
619 numEventsSelected_(0),
621 numWarningsTriggerResults_(0),
622 numWarningsHLTpath_(0),
623 numWarningsVertex_(0),
624 numWarningsBeamSpot_(0),
626 numWarningsTauJet_(0),
627 numWarningsTauDiscrByLeadTrackFinding_(0),
628 numWarningsTauDiscrByLeadTrackPtCut_(0),
629 numWarningsTauDiscrByTrackIso_(0),
630 numWarningsTauDiscrByEcalIso_(0),
631 numWarningsTauDiscrAgainstMuons_(0),
632 numWarningsCaloMEt_(0),
633 numWarningsPFMEt_(0) {
683 dqmStore_->
book1D(
"MuonTrackIsoPt",
"Muon Track Iso.", 20, -0.01, 10.);
695 "P_{T}^{#tau-Jetldg trk}", 20, 0., 50.);
701 "TauDiscrAgainstMuons",
"Tau Discr. against Muons", 2, -0.5, +1.5);
705 "TauJetNumSignalTracks",
"Num. Tau signal Cone Tracks", 20, -0.5, +19.5);
707 "TauJetNumIsoTracks",
"Num. Tau isolation Cone Tracks", 20, -0.5, +19.5);
710 dqmStore_->
book1D(
"VisMass",
"#mu + #tau-Jet visible Mass", 20, 0., 120.);
712 "VisMassFinal",
"#mu + #tau-Jet visible final Mass", 20, 0., 120.);
716 "MtMuPFMEt",
"#mu + E_{T}^{miss} (PF) transverse Mass", 20, 0., 120.);
722 dqmStore_->
book1D(
"MuTauAcoplanarity",
"#Delta #phi_{#mu #tau-Jet}", 20,
731 dqmStore_->
book1D(
"VertexZ",
"Event Vertex z-Position", 20, -25., +25.);
745 dqmStore_->
book1D(
"CutFlowSummary",
"Cut-flow Summary", 11, 0.5, 11.5);
753 "#tau lead. Track P_{T}");
757 "#tau anti-#mu Discr.");
771 bool readError =
false;
777 "Failed to access Trigger results");
778 if (readError)
return;
782 bool isTriggered =
false;
783 for (vstring::const_iterator hltPath =
hltPaths_.begin();
786 if (index < triggerNames.
size()) {
787 if (hltDecision->accept(index)) isTriggered =
true;
791 <<
" Undefined HLT path = " << (*hltPath) <<
" !!";
804 "Failed to access Vertex collection");
805 if (readError)
return;
808 (vertexCollection->size() > 0) ? &(vertexCollection->at(0)) : 0;
814 if (readError)
return;
819 readError,
"Failed to access Muon collection");
820 if (readError)
return;
824 double theMuonTrackIsoPt = 1.e+3;
825 double theMuonEcalIsoPt = 1.e+3;
826 double theMuonCombIsoPt = 1.e+3;
835 theMuonTrackIsoPt /= theMuon->
pt();
836 theMuonEcalIsoPt /= theMuon->
pt();
848 "Failed to access Tau-jet collection");
849 if (readError)
return;
856 "Failed to access collection of pf. Tau discriminators by "
857 "leading Track finding");
862 "Failed to access collection of pf. Tau discriminators by "
863 "leading Track Pt cut");
867 "Failed to access collection of pf. Tau discriminators by "
872 "Failed to access collection of pf. Tau discriminators by ECAL "
878 "Failed to access collection of pf. Tau discriminators against Muons");
879 if (readError)
return;
881 int theTauJetIndex = -1;
885 double theTauDiscrByLeadTrackFinding = -1.;
886 double theTauDiscrByLeadTrackPtCut = -1.;
887 double theTauDiscrByTrackIso = -1.;
888 double theTauDiscrByEcalIso = -1.;
889 double theTauDiscrAgainstMuons = -1.;
890 if (theTauJetIndex != -1) {
892 theTauDiscrByLeadTrackFinding = (*tauDiscrByLeadTrackFinding)[theTauJetRef];
893 theTauDiscrByLeadTrackPtCut = (*tauDiscrByLeadTrackPtCut)[theTauJetRef];
894 theTauDiscrByTrackIso = (*tauDiscrByTrackIso)[theTauJetRef];
895 theTauDiscrByEcalIso = (*tauDiscrByEcalIso)[theTauJetRef];
896 theTauDiscrAgainstMuons = (*tauDiscrAgainstMuons)[theTauJetRef];
904 "Failed to access calo. MET collection");
905 if (readError)
return;
912 "Failed to access pf. MET collection");
913 if (readError)
return;
917 if (!(theMuon && theTauJet && theTauJetIndex != -1))
return;
926 fabs(ROOT::Math::VectorUtil::DeltaR(theMuon->
p4(), theTauJet->
p4()));
927 double mMuTau = (theMuon->
p4() + theTauJet->
p4()).M();
944 unsigned numGlobalMuons = 0;
945 for (reco::MuonCollection::const_iterator
muon = muons->begin();
947 if (
muon->isGlobalMuon()) {
956 bool isSelected =
false;
957 int cutFlowStatus = -1;
964 (isTriggered ||
hltPaths_.size() == 0)) {
972 if (cutFlowStatus ==
kPassedMuonId && (theTauDiscrByLeadTrackFinding > 0.5) &&
977 theTauDiscrByLeadTrackPtCut > 0.5) {
1012 if (theEventVertex) {
1062 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
1066 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
1079 edm::LogInfo(
"EwkMuTauHistManager") <<
"Filter-Statistics Summary:"
1080 << std::endl <<
" Events analyzed = "
1082 <<
" Events selected = "
1086 edm::LogInfo(
"") <<
"Overall efficiency = " << std::setprecision(4)
1087 << eff * 100. <<
" +/- " << std::setprecision(4)
1103 if (isoMode_string ==
"absoluteIso") {
1105 }
else if (isoMode_string ==
"relativeIso") {
1108 edm::LogError(
"getIsoMode") <<
" Failed to decode isoMode string = "
1109 << isoMode_string <<
" !!";
1123 if (deltaPhi < 0.) deltaPhi = -
deltaPhi;
1130 double calcMt(
double px1,
double py1,
double px2,
double py2) {
1131 double pt1 = TMath::Sqrt(px1 * px1 + py1 * py1);
1132 double pt2 = TMath::Sqrt(px2 * px2 + py2 * py2);
1134 double p1Dotp2 = px1 * px2 + py1 * py2;
1135 double cosAlpha = p1Dotp2 / (pt1 * pt2);
1137 return TMath::Sqrt(2 * pt1 * pt2 * (1 - cosAlpha));
1143 double cosPhi1 =
cos(p1.phi());
1144 double sinPhi1 =
sin(p1.phi());
1145 double cosPhi2 =
cos(p2.phi());
1146 double sinPhi2 =
sin(p2.phi());
1147 double zetaX = cosPhi1 + cosPhi2;
1148 double zetaY = sinPhi1 + sinPhi2;
1149 double zetaR = TMath::Sqrt(zetaX * zetaX + zetaY * zetaY);
1155 double pxVis = p1.px() + p2.px();
1156 double pyVis = p1.py() + p2.py();
1157 double pZetaVis = pxVis * zetaX + pyVis * zetaY;
1159 double px = pxVis + pxMEt;
1160 double py = pyVis + pyMEt;
1161 double pZeta = px * zetaX + py * zetaY;
1163 return pZeta - 1.5 * pZetaVis;
1206 double electronPtCut) {
1209 for (reco::GsfElectronCollection::const_iterator
electron = electrons.begin();
1213 if (theElectron == 0 ||
electron->pt() > theElectron->
pt())
1222 double muonEtaCut,
double muonPtCut) {
1225 for (reco::MuonCollection::const_iterator
muon = muons.begin();
1228 if (theMuon == 0 ||
muon->pt() > theMuon->
pt()) theMuon = &(*
muon);
1236 double tauJetEtaCut,
double tauJetPtCut,
1237 int& theTauJetIndex) {
1239 theTauJetIndex = -1;
1241 int numTauJets = tauJets.
size();
1242 for (
int iTauJet = 0; iTauJet < numTauJets; ++iTauJet) {
1245 if (fabs(tauJet.
eta()) < tauJetEtaCut && tauJet.
pt() > tauJetPtCut) {
1246 if (theTauJet == 0 || tauJet.
pt() > theTauJet->
pt()) {
1247 theTauJet = &tauJet;
1248 theTauJetIndex = iTauJet;
1261 double dX = vertex.
x() - beamSpot.
x0();
1262 double dY = vertex.
y() - beamSpot.
y0();
1263 return TMath::Sqrt(dX * dX + dY * dY);
MonitorElement * hCutFlowSummary_
edm::InputTag tauDiscrByEcalIso_
long numWarningsTauDiscrByEcalIso_
void analyze(const edm::Event &, const edm::EventSetup &)
edm::InputTag beamSpotSource_
T getParameter(std::string const &) const
double calcDeltaPhi(double phi1, double phi2)
virtual reco::TrackRef leadTrack() const
MonitorElement * hPFMEtPt_
double calcMt(double px1, double py1, double px2, double py2)
edm::InputTag tauDiscrByLeadTrackFinding_
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
float isolationPFGammaCandsEtSum() const
MonitorElement * hTauJetPhi_
edm::InputTag pfMEtSource_
edm::InputTag beamSpotSource_
std::vector< PFTau > PFTauCollection
collection of PFTau objects
float sumPt
sum-pt of tracks
float isolationPFChargedHadrCandsPtSum() const
virtual float pt() const
transverse momentum
edm::InputTag tauDiscrByLeadTrackPtCut_
const LorentzVector & p4(P4Kind kind) const
MonitorElement * hElecTauAcoplanarity_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
edm::InputTag electronSource_
int getIsoMode(const std::string &isoMode_string, int &error)
edm::InputTag tauDiscrByTrackIso_
long numWarningsTauDiscrAgainstMuons_
MonitorElement * hVisMass_
EwkMuTauHistManager(const edm::ParameterSet &, DQMStore *)
edm::InputTag tauDiscrByLeadTrackFinding_
long numWarningsTauDiscrByEcalIso_
double getVertexD0(const reco::Vertex &vertex, const reco::BeamSpot &beamSpot)
virtual const reco::TrackRefVector & isolationTracks() const
virtual float phi() const
momentum azimuthal angle
bool isTrackerMuon() 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_
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_
bool isGlobalMuon() const
MonitorElement * hPFMEtPt_
unsigned numEventsSelected_
std::string dqmDirectory_
Strings::size_type size() const
edm::InputTag tauDiscrByLeadTrackPtCut_
std::string dqmDirectoryName(const std::string &dqmRootDirectory, const std::string &dqmSubDirectory)
const MuonIsolation & isolationR05() const
MonitorElement * hCutFlowSummary_
long numWarningsTauDiscrByLeadTrackPtCut_
void finalizeHistograms()
edm::InputTag caloMEtSource_
EwkElecTauHistManager(const edm::ParameterSet &, DQMStore *)
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_
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_
EwkElecTauHistManager * elecTauHistManager_
MonitorElement * hElectronEta_
virtual float eta() const
momentum pseudorapidity
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_
virtual int charge() const
electric charge
float hcalOverEcal() const
long numWarningsTauDiscrAgainstMuons_
float dr03TkSumPt() const
MonitorElement * hMtMuPFMEt_
MonitorElement * hCaloMEtPt_
double z() const
y 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_
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_
virtual double px() const
x coordinate of momentum vector
edm::InputTag muonSource_
MonitorElement * hMuTauAcoplanarity_
MonitorElement * hTauJetNumIsoTracks_
MonitorElement * hMuonCombIsoPt_
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)
MonitorElement * hTauJetEta_
edm::InputTag tauJetSource_
edm::InputTag triggerResultsSource_
unsigned numEventsAnalyzed_
double y0() const
y coordinate
size_type size() const
Size of the RefVector.
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_
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
EwkTauDQM(const edm::ParameterSet &)
MonitorElement * hElectronPt_
virtual double py() const
y coordinate of momentum vector
void setCurrentFolder(const std::string &fullpath)
MonitorElement * hMtElecPFMEt_
float sigmaEtaEta() const
long numWarningsTauDiscrByLeadTrackPtCut_
double x0() const
x coordinate