16 dirName.append(dqmSubDirectory);
21 : dqmDirectory_(cfg.getParameter<std::string>(
"dqmDirectory")),
25 edm::LogError (
"EwkTauDQM") <<
" Failed to access dqmStore --> histograms will NEITHER be booked NOR filled !!";
37 std::string dqmSubDirectoryElecTauChannel = cfgElecTauChannel.
getParameter<std::string>(
"dqmSubDirectory");
43 std::string dqmSubDirectoryMuTauChannel = cfgMuTauChannel.
getParameter<std::string>(
"dqmSubDirectory");
115 : dqmStore_(dqmStore),
116 dqmDirectory_(cfg.getParameter<std::string>(
"dqmDirectory")),
117 numEventsAnalyzed_(0),
118 numEventsSelected_(0),
120 numWarningsTriggerResults_(0),
121 numWarningsHLTpath_(0),
122 numWarningsVertex_(0),
123 numWarningsBeamSpot_(0),
124 numWarningsElectron_(0),
125 numWarningsTauJet_(0),
126 numWarningsTauDiscrByLeadTrackFinding_(0),
127 numWarningsTauDiscrByLeadTrackPtCut_(0),
128 numWarningsTauDiscrByTrackIso_(0),
129 numWarningsTauDiscrByEcalIso_(0),
130 numWarningsTauDiscrAgainstElectrons_(0),
131 numWarningsTauDiscrAgainstMuons_(0),
132 numWarningsCaloMEt_(0),
156 std::string electronIsoMode_string = cfg.
getParameter<std::string>(
"electronIsoMode");
231 bool readError =
false;
236 readError,
"Failed to access Trigger results");
237 if ( readError )
return;
241 bool isTriggered =
false;
242 for ( vstring::const_iterator hltPath =
hltPaths_.begin();
243 hltPath !=
hltPaths_.end(); ++hltPath ) {
245 if ( index < triggerNames.
size() ) {
246 if ( hltDecision->accept(index) ) isTriggered =
true;
249 edm::LogWarning (
"EwkElecTauHistManager") <<
" Undefined HLT path = " << (*hltPath) <<
" !!";
260 readError,
"Failed to access Vertex collection");
261 if ( readError )
return;
263 const reco::Vertex* theEventVertex = ( vertexCollection->size() > 0 ) ? &(vertexCollection->at(0)) : 0;
268 readError,
"Failed to access Beam-spot");
269 if ( readError )
return;
274 readError,
"Failed to access Electron collection");
275 if ( readError )
return;
279 double theElectronTrackIsoPt = 1.e+3;
280 double theElectronEcalIsoPt = 1.e+3;
281 double theElectronHcalIsoPt = 1.e+3;
283 theElectronTrackIsoPt = theElectron->
dr03TkSumPt();
288 theElectronTrackIsoPt /= theElectron->
pt();
289 theElectronEcalIsoPt /= theElectron->
pt();
290 theElectronHcalIsoPt /= theElectron->
pt();
297 readError,
"Failed to access Tau-jet collection");
298 if ( readError )
return;
303 readError,
"Failed to access collection of pf. Tau discriminators by leading Track finding");
306 readError,
"Failed to access collection of pf. Tau discriminators by leading Track Pt cut");
309 readError,
"Failed to access collection of pf. Tau discriminators by Track isolation");
312 readError,
"Failed to access collection of pf. Tau discriminators by ECAL isolation");
315 readError,
"Failed to access collection of pf. Tau discriminators against Electrons");
318 readError,
"Failed to access collection of pf. Tau discriminators against Muons");
319 if ( readError )
return;
321 int theTauJetIndex = -1;
324 double theTauDiscrByLeadTrackFinding = -1.;
325 double theTauDiscrByLeadTrackPtCut = -1.;
326 double theTauDiscrByTrackIso = -1.;
327 double theTauDiscrByEcalIso = -1.;
328 double theTauDiscrAgainstElectrons = -1.;
329 double theTauDiscrAgainstMuons = -1.;
330 if ( theTauJetIndex != -1 ) {
332 theTauDiscrByLeadTrackFinding = (*tauDiscrByLeadTrackFinding)[theTauJetRef];
333 theTauDiscrByLeadTrackPtCut = (*tauDiscrByLeadTrackPtCut)[theTauJetRef];
334 theTauDiscrByTrackIso = (*tauDiscrByTrackIso)[theTauJetRef];
335 theTauDiscrByEcalIso = (*tauDiscrByEcalIso)[theTauJetRef];
336 theTauDiscrAgainstElectrons = (*tauDiscrAgainstElectrons)[theTauJetRef];
337 theTauDiscrAgainstMuons = (*tauDiscrAgainstMuons)[theTauJetRef];
344 readError,
"Failed to access calo. MET collection");
345 if ( readError )
return;
351 readError,
"Failed to access pf. MET collection");
352 if ( readError )
return;
356 if ( !(theElectron && theTauJet && theTauJetIndex != -1) )
return;
364 double mElecTau = (theElectron->
p4() + theTauJet->
p4()).M();
367 double mtElecPFMEt =
calcMt(theElectron->
px(), theElectron->
py(), pfMEt.
px(), pfMEt.
py());
377 unsigned numIdElectrons = 0;
378 for ( reco::GsfElectronCollection::const_iterator
electron = electrons->begin();
389 bool isSelected =
false;
390 bool fullSelect =
false;
391 int cutFlowStatus = -1;
437 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut ) {
462 if ( theEventVertex ) {
481 <<
"Filter-Statistics Summary:" << std::endl
487 <<
"Overall efficiency = " << std::setprecision(4) << eff*100.
488 <<
" +/- " << std::setprecision(4) << TMath::Sqrt(eff*(1 - eff)/
numEventsAnalyzed_)*100. <<
")%";
528 : dqmStore_(dqmStore),
529 dqmDirectory_(cfg.getParameter<std::string>(
"dqmDirectory")),
530 numEventsAnalyzed_(0),
531 numEventsSelected_(0),
533 numWarningsTriggerResults_(0),
534 numWarningsHLTpath_(0),
535 numWarningsVertex_(0),
536 numWarningsBeamSpot_(0),
538 numWarningsTauJet_(0),
539 numWarningsTauDiscrByLeadTrackFinding_(0),
540 numWarningsTauDiscrByLeadTrackPtCut_(0),
541 numWarningsTauDiscrByTrackIso_(0),
542 numWarningsTauDiscrByEcalIso_(0),
543 numWarningsTauDiscrAgainstMuons_(0),
544 numWarningsCaloMEt_(0),
568 std::string muonIsoMode_string = cfg.
getParameter<std::string>(
"muonIsoMode");
646 bool readError =
false;
651 readError,
"Failed to access Trigger results");
652 if ( readError )
return;
656 bool isTriggered =
false;
657 for ( vstring::const_iterator hltPath =
hltPaths_.begin();
658 hltPath !=
hltPaths_.end(); ++hltPath ) {
660 if ( index < triggerNames.
size() ) {
661 if ( hltDecision->accept(index) ) isTriggered =
true;
664 edm::LogWarning (
"EwkMuTauHistManager") <<
" Undefined HLT path = " << (*hltPath) <<
" !!";
675 readError,
"Failed to access Vertex collection");
676 if ( readError )
return;
678 const reco::Vertex* theEventVertex = ( vertexCollection->size() > 0 ) ? &(vertexCollection->at(0)) : 0;
683 readError,
"Failed to access Beam-spot");
684 if ( readError )
return;
689 readError,
"Failed to access Muon collection");
690 if ( readError )
return;
694 double theMuonTrackIsoPt = 1.e+3;
695 double theMuonEcalIsoPt = 1.e+3;
696 double theMuonCombIsoPt = 1.e+3;
704 theMuonTrackIsoPt /= theMuon->
pt();
705 theMuonEcalIsoPt /= theMuon->
pt();
714 readError,
"Failed to access Tau-jet collection");
715 if ( readError )
return;
720 readError,
"Failed to access collection of pf. Tau discriminators by leading Track finding");
723 readError,
"Failed to access collection of pf. Tau discriminators by leading Track Pt cut");
726 readError,
"Failed to access collection of pf. Tau discriminators by Track isolation");
729 readError,
"Failed to access collection of pf. Tau discriminators by ECAL isolation");
732 readError,
"Failed to access collection of pf. Tau discriminators against Muons");
733 if ( readError )
return;
735 int theTauJetIndex = -1;
738 double theTauDiscrByLeadTrackFinding = -1.;
739 double theTauDiscrByLeadTrackPtCut = -1.;
740 double theTauDiscrByTrackIso = -1.;
741 double theTauDiscrByEcalIso = -1.;
742 double theTauDiscrAgainstMuons = -1.;
743 if ( theTauJetIndex != -1 ) {
745 theTauDiscrByLeadTrackFinding = (*tauDiscrByLeadTrackFinding)[theTauJetRef];
746 theTauDiscrByLeadTrackPtCut = (*tauDiscrByLeadTrackPtCut)[theTauJetRef];
747 theTauDiscrByTrackIso = (*tauDiscrByTrackIso)[theTauJetRef];
748 theTauDiscrByEcalIso = (*tauDiscrByEcalIso)[theTauJetRef];
749 theTauDiscrAgainstMuons = (*tauDiscrAgainstMuons)[theTauJetRef];
756 readError,
"Failed to access calo. MET collection");
757 if ( readError )
return;
763 readError,
"Failed to access pf. MET collection");
764 if ( readError )
return;
768 if ( !(theMuon && theTauJet && theTauJetIndex != -1) )
return;
776 double dRMuTau = fabs(ROOT::Math::VectorUtil::DeltaR(theMuon->
p4(),theTauJet->
p4()));
777 double mMuTau = (theMuon->
p4() + theTauJet->
p4()).M();
780 double mtMuPFMEt =
calcMt(theMuon->
px(), theMuon->
px(), pfMEt.
px(), pfMEt.
py());
790 unsigned numGlobalMuons = 0;
791 for ( reco::MuonCollection::const_iterator
muon = muons->begin();
793 if (
muon->isGlobalMuon() ) {
802 bool isSelected =
false;
803 int cutFlowStatus = -1;
856 if ( theEventVertex ) {
902 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut ) {
913 for (
int iCut = 1; iCut <= cutFlowStatus; ++iCut ) {
934 <<
"Filter-Statistics Summary:" << std::endl
940 <<
"Overall efficiency = " << std::setprecision(4) << eff*100.
941 <<
" +/- " << std::setprecision(4) << TMath::Sqrt(eff*(1 - eff)/
numEventsAnalyzed_)*100. <<
")%";
956 if ( isoMode_string ==
"absoluteIso" ) {
958 }
else if ( isoMode_string ==
"relativeIso" ) {
961 edm::LogError (
"getIsoMode") <<
" Failed to decode isoMode string = " << isoMode_string <<
" !!";
976 if ( deltaPhi < 0. ) deltaPhi = -
deltaPhi;
983 double calcMt(
double px1,
double py1,
double px2,
double py2)
985 double pt1 = TMath::Sqrt(px1*px1 + py1*py1);
986 double pt2 = TMath::Sqrt(px2*px2 + py2*py2);
988 double p1Dotp2 = px1*px2 + py1*py2;
989 double cosAlpha = p1Dotp2/(pt1*pt2);
991 return TMath::Sqrt(2*pt1*pt2*(1 - cosAlpha));
996 double cosPhi1 =
cos(p1.phi());
997 double sinPhi1 =
sin(p1.phi());
998 double cosPhi2 =
cos(p2.phi());
999 double sinPhi2 =
sin(p2.phi());
1000 double zetaX = cosPhi1 + cosPhi2;
1001 double zetaY = sinPhi1 + sinPhi2;
1002 double zetaR = TMath::Sqrt(zetaX*zetaX + zetaY*zetaY);
1008 double pxVis = p1.px() + p2.px();
1009 double pyVis = p1.py() + p2.py();
1010 double pZetaVis = pxVis*zetaX + pyVis*zetaY;
1012 double px = pxVis + pxMEt;
1013 double py = pyVis + pyMEt;
1014 double pZeta = px*zetaX + py*zetaY;
1016 return pZeta - 1.5*pZetaVis;
1025 if ( (TMath::Abs(electron.
eta()) < 1.479 || TMath::Abs(electron.
eta()) > 1.566) &&
1038 ((TMath::Abs(electron.
eta()) > 1.566 &&
1042 (TMath::Abs(electron.
eta()) < 1.479 &&
1060 for ( reco::GsfElectronCollection::const_iterator
electron = electrons.begin();
1063 if ( theElectron == 0 ||
electron->pt() > theElectron->
pt() ) theElectron = &(*
electron);
1077 for ( reco::MuonCollection::const_iterator
muon = muons.begin();
1079 if ( TMath::Abs(
muon->eta()) < muonEtaCut &&
muon->pt() > muonPtCut ) {
1080 if ( theMuon == 0 ||
muon->pt() > theMuon->
pt() ) theMuon = &(*
muon);
1090 theTauJetIndex = -1;
1092 int numTauJets = tauJets.
size();
1093 for (
int iTauJet = 0; iTauJet < numTauJets; ++iTauJet ) {
1096 if ( fabs(tauJet.
eta()) < tauJetEtaCut && tauJet.
pt() > tauJetPtCut ) {
1097 if ( theTauJet == 0 || tauJet.
pt() > theTauJet->
pt() ) {
1098 theTauJet = &tauJet;
1099 theTauJetIndex = iTauJet;
1113 double dX = vertex.
x() - beamSpot.
x0();
1114 double dY = vertex.
y() - beamSpot.
y0();
1115 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
edm::InputTag tauDiscrByLeadTrackPtCut_
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_
double deltaPhi(float phi1, float phi2)
long numWarningsTauDiscrByEcalIso_
double getVertexD0(const reco::Vertex &vertex, const reco::BeamSpot &beamSpot)
virtual const reco::TrackRefVector & isolationTracks() const
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_
virtual double eta() const
momentum pseudorapidity
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_
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_
virtual double pt() const
transverse momentum
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 double phi() const
momentum azimuthal angle
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