15 #include "TLorentzVector.h" 31 m_tau = tauL1tPair.
m_tau;
34 m_eta = tauL1tPair.
m_eta;
41 return deltaR(m_regTau->eta(),m_regTau->phi(),
eta(),phi());
45 {
"nVertex", PlotConfig::nVertex},
46 {
"ETvsET", PlotConfig::ETvsET},
47 {
"PHIvsPHI", PlotConfig::PHIvsPHI}
64 trigProcess_(ps.getUntrackedParameter<
string>(
"trigProcess")),
66 triggerPath_(ps.getUntrackedParameter < vector<
std::
string> > (
"triggerNames")),
67 histFolder_(ps.getParameter <
std::
string > (
"histFolder")),
68 efficiencyFolder_(histFolder_ +
"/efficiency_raw"),
70 tauEfficiencyThresholds_(ps.getParameter <
std::vector<
int> > (
"tauEfficiencyThresholds")),
71 tauEfficiencyBins_(ps.getParameter <
std::vector<double> > (
"tauEfficiencyBins")),
74 edm::LogInfo(
"L1TTauOffline") <<
"Constructor " <<
"L1TTauOffline::L1TTauOffline " << std::endl;
82 edm::LogInfo(
"L1TTauOffline") <<
"Destructor L1TTauOffline::~L1TTauOffline " << std::endl;
94 edm::LogInfo(
"L1TTauOffline") <<
"L1TTauOffline::beginRun" << std::endl;
102 edm::LogInfo(
"L1TTauOffline") <<
"L1TTauOffline::bookHistograms" << std::endl;
111 std::size_t found0 = tNameTmp.find(
"*");
112 if(found0!=std::string::npos) tNamePattern = tNameTmp.substr(0,tNameTmp.size()-1);
113 else tNamePattern = tNameTmp;
121 std::size_t
found=tmpName.find(tNamePattern);
122 if (found!=std::string::npos){
134 edm::LogInfo(
"L1TTauOffline") <<
"L1TTauOffline::beginLuminosityBlock" << std::endl;
152 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: reco::PFTauCollection " << std::endl;
161 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: reco::MuonCollection " << std::endl;
170 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: reco::BeamSpot " << std::endl;
179 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: reco::VertexCollection " << std::endl;
188 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: l1t::TauBxCollection " << std::endl;
197 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: edm::TriggerResults " << std::endl;
206 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: trigger::TriggerEvent " << std::endl;
214 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: reco::PFMETCollection " << std::endl;
225 vector<l1t::Tau> l1tContainer;
226 l1tContainer.reserve(l1tCands->
size()+1);
229 l1tContainer.push_back(*
tau);
234 float eta = tauL1tPairsIt->eta();
235 float phi = tauL1tPairsIt->phi();
236 float pt = tauL1tPairsIt->pt();
239 float l1tPt = tauL1tPairsIt->l1tPt();
247 bool l1tAboveCut = (l1tPt >= l1tPtCut);
249 stringstream ptCutToTag; ptCutToTag << l1tPtCut;
250 string ptTag = ptCutToTag.str();
290 if(tauL1tPairsIt->l1tIso()>0.5) {
306 edm::LogInfo(
"L1TTauOffline") <<
"L1TTauOffline::endLuminosityBlock" << std::endl;
314 edm::LogInfo(
"L1TTauOffline") <<
"L1TTauOffline::endRun" << std::endl;
332 "L1 Tau E_{T} vs PFTau E_{T} (EB); PFTau E_{T} (GeV); L1 Tau E_{T} (GeV)",
335 "L1 Tau E_{T} vs PFTau E_{T} (EE); PFTau E_{T} (GeV); L1 Tau E_{T} (GeV)",
338 "L1 Tau E_{T} vs PFTau E_{T} (EB+EE); PFTau E_{T} (GeV); L1 Tau E_{T} (GeV)",
343 "#phi_{tau}^{L1} vs #phi_{tau}^{offline} (EB); #phi_{tau}^{offline}; #phi_{tau}^{L1}",
344 templatePHIvsPHI.
nbinsX, templatePHIvsPHI.
xmin, templatePHIvsPHI.
xmax,
345 templatePHIvsPHI.
nbinsY, templatePHIvsPHI.
ymin, templatePHIvsPHI.
ymax);
347 "#phi_{tau}^{L1} vs #phi_{tau}^{offline} (EE); #phi_{tau}^{offline}; #phi_{tau}^{L1}",
348 templatePHIvsPHI.
nbinsX, templatePHIvsPHI.
xmin, templatePHIvsPHI.
xmax,
349 templatePHIvsPHI.
nbinsY, templatePHIvsPHI.
ymin, templatePHIvsPHI.
ymax);
351 "#phi_{tau}^{L1} vs #phi_{tau}^{offline} (EB+EE); #phi_{tau}^{offline}; #phi_{tau}^{L1}",
352 templatePHIvsPHI.
nbinsX, templatePHIvsPHI.
xmin, templatePHIvsPHI.
xmax,
353 templatePHIvsPHI.
nbinsY, templatePHIvsPHI.
ymin, templatePHIvsPHI.
ymax);
356 "L1 Tau #eta vs PFTau #eta; PFTau #eta; L1 Tau #eta", 100, -3, 3, 100, -3, 3);
360 "tau ET resolution (EB); (L1 Tau E_{T} - PFTau E_{T})/PFTau E_{T}; events", 50, -1, 1.5);
362 "tau ET resolution (EE); (L1 Tau E_{T} - PFTau E_{T})/PFTau E_{T}; events", 50, -1, 1.5);
364 "tau ET resolution (EB+EE); (L1 Tau E_{T} - PFTau E_{T})/PFTau E_{T}; events", 50, -1, 1.5);
367 ibooker.
book1D(
"resolutionTauPhi_EB",
368 "#phi_{tau} resolution (EB); #phi_{tau}^{L1} - #phi_{tau}^{offline}; events",
371 ibooker.
book1D(
"resolutionTauPhi_EE",
372 "tau #phi resolution (EE); #phi_{tau}^{L1} - #phi_{tau}^{offline}; events",
375 ibooker.
book1D(
"resolutionTauPhi_EB_EE",
376 "tau #phi resolution (EB+EE); #phi_{tau}^{L1} - #phi_{tau}^{offline}; events",
380 "tau #eta resolution (EB); L1 Tau #eta - PFTau #eta; events", 120, -0.3, 0.3);
385 int nBins = tauBins.size() - 1;
386 float* tauBinArray = &(tauBins[0]);
391 "efficiencyIsoTauET_EB_threshold_" + str_threshold +
"_Num",
392 "iso tau efficiency (EB); PFTau E_{T} (GeV); events", nBins, tauBinArray);
394 "efficiencyIsoTauET_EE_threshold_" + str_threshold +
"_Num",
395 "iso tau efficiency (EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
397 "efficiencyIsoTauET_EB_EE_threshold_" + str_threshold +
"_Num",
398 "iso tau efficiency (EB+EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
401 "efficiencyIsoTauET_EB_threshold_" + str_threshold +
"_Den",
402 "iso tau efficiency (EB); PFTau E_{T} (GeV); events", nBins, tauBinArray);
404 "efficiencyIsoTauET_EE_threshold_" + str_threshold +
"_Den",
405 "iso tau efficiency (EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
407 "efficiencyIsoTauET_EB_EE_threshold_" + str_threshold +
"_Den",
408 "iso tau efficiency (EB+EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
413 "efficiencyNonIsoTauET_EB_threshold_" + str_threshold +
"_Num",
414 "inclusive tau efficiency (EB); PFTau E_{T} (GeV); events", nBins, tauBinArray);
416 "efficiencyNonIsoTauET_EE_threshold_" + str_threshold +
"_Num",
417 "inclusive tau efficiency (EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
419 "efficiencyNonIsoTauET_EB_EE_threshold_" + str_threshold +
"_Num",
420 "inclusive tau efficiency (EB+EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
423 "efficiencyNonIsoTauET_EB_threshold_" + str_threshold +
"_Den",
424 "inclusive tau efficiency (EB); PFTau E_{T} (GeV); events", nBins, tauBinArray);
426 "efficiencyNonIsoTauET_EE_threshold_" + str_threshold +
"_Den",
427 "inclusive tau efficiency (EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
429 "efficiencyNonIsoTauET_EB_EE_threshold_" + str_threshold +
"_Den",
430 "inclusive tau efficiency (EB+EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
445 bool hasPrimaryVertex =
false;
449 for (
auto vertexIt=vertex->begin();vertexIt!=vertex->end();++vertexIt)
451 if (vertexIt->isValid() &&
455 errVtx = vertexIt->error();
456 hasPrimaryVertex =
true;
462 if ( !hasPrimaryVertex ) {
466 errVtx(2,2) = beamSpot->
sigmaZ();
477 double matchDeltaR = 9999;
488 if (hltFilterIndex < triggerEvent->sizeFilters()) {
490 const Vids triggerVids(triggerEvent->
filterIds(hltFilterIndex));
492 const unsigned nTriggers = triggerVids.size();
493 for (
size_t iTrig = 0; iTrig < nTriggers; ++iTrig) {
494 const TriggerObject trigObject = trigObjs[triggerKeys[iTrig]];
496 double dRtmp =
deltaR((*muon),trigObject);
497 if (dRtmp < matchDeltaR) matchDeltaR = dRtmp;
510 vector<l1t::Tau> l1tContainer;
511 l1tContainer.reserve(l1tCands->
size()+1);
514 l1tContainer.push_back(*
tau);
519 TauL1TPair pairBestCand((*probeTauIt),
nullptr);
521 for(
auto l1tIt = l1tContainer.begin() ; l1tIt!=l1tContainer.end(); ++l1tIt) {
523 TauL1TPair pairTmpCand((*probeTauIt),&(*l1tIt));
526 pairBestCand = pairTmpCand;
541 pfmet=&(mets->front());
545 for(
auto muonIt2 = muons->begin(); muonIt2!=muons->end(); ++muonIt2) {
546 if (fabs(muonIt2->eta())< 2.4 && muonIt2->pt()>10 &&
muon::isLooseMuon((*muonIt2)) && (muonIt2->pfIsolationR04().sumChargedHadronPt+
max(muonIt2->pfIsolationR04().sumNeutralHadronEt+muonIt2->pfIsolationR04().sumPhotonEt-0.5*muonIt2->pfIsolationR04().sumPUPt,0.0))/muonIt2->pt()<0.3) {
550 bool foundTightMu=
false;
551 for(
auto muonIt = muons->begin(); muonIt!=muons->end(); ++muonIt) {
552 if (!
matchHlt(trigEvent,&(*muonIt)))
continue;
553 float muiso=(muonIt->pfIsolationR04().sumChargedHadronPt+
max(muonIt->pfIsolationR04().sumNeutralHadronEt+muonIt->pfIsolationR04().sumPhotonEt-0.5*muonIt->pfIsolationR04().sumPUPt,0.0))/muonIt->
pt();
555 if (muiso<0.1 && nb_mu<2 && !foundTightMu && fabs(muonIt->eta())< 2.1 && muonIt->pt()>24 &&
muon::isLooseMuon((*muonIt))) {
556 float mt=
sqrt(
pow(muonIt->pt() + pfmet->
pt(), 2) -
pow(muonIt->px() + pfmet->
px(),2) -
pow(muonIt->py() + pfmet->
py(), 2));
573 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: reco::PFTauDiscriminator " << std::endl;
581 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: reco::PFTauDiscriminator " << std::endl;
589 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: reco::PFTauDiscriminator " << std::endl;
597 edm::LogWarning(
"L1TTauOffline") <<
"invalid collection: reco::PFTauDiscriminator " << std::endl;
605 for(
auto tauIt = taus->begin(); tauIt!=taus->end(); ++tauIt,++iTau) {
607 TLorentzVector mytau;
608 mytau.SetPtEtaPhiE(tauIt->pt(),tauIt->eta(),tauIt->phi(),tauIt->energy());
610 if (fabs(tauIt->charge())==1 && fabs(tauIt->eta())< 2.1 && tauIt->pt()>20 && (*antimu)[tauCandidate] > 0.5 && (*antiele)[tauCandidate] > 0.5 && (*dmf)[tauCandidate] > 0.5 && (*comb3T)[tauCandidate] > 0.5) {
611 if (mymu.DeltaR(mytau)>0.5 && (mymu+mytau).M()>40 && (mymu+mytau).M()<80 &&
m_TightMuons[0]->charge()*tauIt->charge()<0){
unsigned int size() const
number of trigger paths in trigger table
std::vector< float > binsX
const_iterator end(int bx) const
edm::EDGetTokenT< reco::VertexCollection > VtxInputTag_
std::vector< std::string > triggerPath_
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
std::vector< PFTau > PFTauCollection
collection of PFTau objects
unsigned size(int bx) const
~L1TTauOffline() override
The single EDProduct to be saved for each event (AOD case)
const std::string & triggerName(unsigned int triggerIndex) const
std::map< double, MonitorElement * > h_efficiencyIsoTauET_EB_pass_
std::vector< int > m_trigIndices
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< TauL1TPair > m_TauL1tPairs
#define DEFINE_FWK_MODULE(type)
MonitorElement * h_L1TauPhivsTauPhi_EB_
void bookTauHistos(DQMStore::IBooker &)
ParameterSet const & getParameterSet(ParameterSetID const &id)
double px() const final
x coordinate of momentum vector
edm::ESHandle< MagneticField > m_BField
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
const Keys & filterKeys(trigger::size_type index) const
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
edm::EDGetTokenT< reco::PFTauDiscriminator > comb3TInputTag_
math::Error< dimension >::type Error
covariance error matrix (3x3)
double pt() const final
transverse momentum
static const std::map< std::string, unsigned int > PlotConfigNames
std::vector< Vertex > VertexCollection
collection of Vertex objects
std::vector< double > tauEfficiencyBins_
std::map< double, MonitorElement * > h_efficiencyNonIsoTauET_EB_EE_pass_
MonitorElement * h_nVertex_
std::map< double, MonitorElement * > h_efficiencyIsoTauET_EE_pass_
std::map< double, MonitorElement * > h_efficiencyNonIsoTauET_EB_total_
std::map< double, MonitorElement * > h_efficiencyNonIsoTauET_EB_pass_
std::string efficiencyFolder_
void getProbeTaus(const edm::Event &e, edm::Handle< reco::PFTauCollection > const &taus, edm::Handle< reco::MuonCollection > const &muons, const reco::Vertex &vertex)
BXVector< Tau > TauBxCollection
const Point & position() const
position
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
std::map< double, MonitorElement * > h_efficiencyNonIsoTauET_EB_EE_total_
std::vector< Muon > MuonCollection
collection of Muon objects
MonitorElement * h_resolutionTauPhi_EB_
bool isLooseMuon(const reco::Muon &)
L1TTauOffline(const edm::ParameterSet &ps)
MonitorElement * h_L1TauPhivsTauPhi_EE_
std::vector< int > tauEfficiencyThresholds_
HLTConfigProvider m_hltConfig
const Vids & filterIds(trigger::size_type index) const
std::vector< const reco::PFTau * > m_ProbeTaus
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
MonitorElement * h_resolutionTauPhi_EB_EE_
const reco::Vertex getPrimaryVertex(edm::Handle< reco::VertexCollection > const &vertex, edm::Handle< reco::BeamSpot > const &beamSpot)
const TriggerObjectCollection & getObjects() const
const l1t::Tau * m_regTau
MonitorElement * book1D(Args &&...args)
std::map< double, MonitorElement * > h_efficiencyIsoTauET_EB_total_
MonitorElement * h_resolutionTauPhi_EE_
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
math::XYZPoint Point
point in the space
std::map< double, MonitorElement * > h_efficiencyIsoTauET_EB_EE_pass_
MonitorElement * h_L1TauEtavsTauEta_
double BeamWidthX() const
beam width X
edm::EDGetTokenT< l1t::TauBxCollection > stage2CaloLayer2TauToken_
std::map< double, MonitorElement * > h_efficiencyIsoTauET_EB_EE_total_
edm::EDGetTokenT< reco::PFTauDiscriminator > AntiMuInputTag_
MonitorElement * h_resolutionTauEta_
std::map< double, MonitorElement * > h_efficiencyNonIsoTauET_EE_total_
edm::EDGetTokenT< reco::BeamSpot > BsInputTag_
edm::EDGetTokenT< reco::PFMETCollection > MetInputTag_
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)
MonitorElement * h_resolutionTauET_EB_EE_
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
HistDefinitions readHistDefinitions(const edm::ParameterSet &ps, const std::map< std::string, unsigned int > &mapping)
std::vector< const reco::Muon * > m_TightMuons
MonitorElement * h_resolutionTauET_EE_
std::map< double, MonitorElement * > h_efficiencyIsoTauET_EE_total_
const reco::PFTau * m_tau
edm::EDGetTokenT< reco::MuonCollection > MuonInputTag_
void setCurrentFolder(const std::string &fullpath)
std::vector< float > binsY
edm::EDGetTokenT< reco::PFTauDiscriminator > DecayModeFindingInputTag_
MonitorElement * book2D(Args &&...args)
MonitorElement * h_tagAndProbeMass_
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
double sigmaZ() const
sigma z
double BeamWidthY() const
beam width Y
double py() const final
y coordinate of momentum vector
void getTauL1tPairs(edm::Handle< l1t::TauBxCollection > const &l1tCands)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
TauL1TPair(const reco::PFTau *tau, const l1t::Tau *regTau)
edm::EDGetTokenT< trigger::TriggerEvent > triggerEvent_
edm::EDGetTokenT< reco::PFTauDiscriminator > AntiEleInputTag_
static std::atomic< unsigned int > counter
bool matchHlt(edm::Handle< trigger::TriggerEvent > const &triggerEvent, const reco::Muon *muon)
dqmoffline::l1t::HistDefinitions histDefinitions_
const Point & position() const
position
edm::EDGetTokenT< reco::PFTauCollection > theTauCollection_
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
MonitorElement * h_L1TauETvsTauET_EB_EE_
MonitorElement * h_L1TauETvsTauET_EE_
MonitorElement * h_L1TauPhivsTauPhi_EB_EE_
void getTightMuons(edm::Handle< reco::MuonCollection > const &muons, edm::Handle< reco::PFMETCollection > const &mets, const reco::Vertex &vertex, edm::Handle< trigger::TriggerEvent > const &trigEvent)
const_iterator begin(int bx) const
MonitorElement * h_resolutionTauET_EB_
MonitorElement * h_L1TauETvsTauET_EB_
Power< A, B >::type pow(const A &a, const B &b)
std::map< double, MonitorElement * > h_efficiencyNonIsoTauET_EE_pass_