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());
59 trigProcess_(ps.getUntrackedParameter<
string>(
"trigProcess")),
61 triggerPath_(ps.getUntrackedParameter < vector<
std::
string> > (
"triggerNames")),
62 histFolder_(ps.getParameter <
std::
string > (
"histFolder")),
63 efficiencyFolder_(histFolder_ +
"/efficiency_raw"),
65 tauEfficiencyThresholds_(ps.getParameter <
std::vector<
int> > (
"tauEfficiencyThresholds")),
66 tauEfficiencyBins_(ps.getParameter <
std::vector<double> > (
"tauEfficiencyBins"))
68 edm::LogInfo(
"L1TTauOffline") <<
"Constructor " <<
"L1TTauOffline::L1TTauOffline " << std::endl;
76 edm::LogInfo(
"L1TTauOffline") <<
"Destructor L1TTauOffline::~L1TTauOffline " << std::endl;
88 edm::LogInfo(
"L1TTauOffline") <<
"L1TTauOffline::beginRun" << std::endl;
96 edm::LogInfo(
"L1TTauOffline") <<
"L1TTauOffline::bookHistograms" << std::endl;
105 std::size_t found0 = tNameTmp.find(
"*");
106 if(found0!=std::string::npos) tNamePattern = tNameTmp.substr(0,tNameTmp.size()-1);
107 else tNamePattern = tNameTmp;
115 std::size_t
found=tmpName.find(tNamePattern);
116 if (found!=std::string::npos){
128 edm::LogInfo(
"L1TTauOffline") <<
"L1TTauOffline::beginLuminosityBlock" << std::endl;
219 vector<l1t::Tau> l1tContainer;
220 l1tContainer.reserve(l1tCands->
size()+1);
223 l1tContainer.push_back(*
tau);
228 float eta = tauL1tPairsIt->eta();
229 float phi = tauL1tPairsIt->phi();
230 float pt = tauL1tPairsIt->pt();
233 float l1tPt = tauL1tPairsIt->l1tPt();
241 bool l1tAboveCut = (l1tPt >= l1tPtCut);
243 stringstream ptCutToTag; ptCutToTag << l1tPtCut;
244 string ptTag = ptCutToTag.str();
284 if(tauL1tPairsIt->l1tIso()>0.5) {
300 edm::LogInfo(
"L1TTauOffline") <<
"L1TTauOffline::endLuminosityBlock" << std::endl;
308 edm::LogInfo(
"L1TTauOffline") <<
"L1TTauOffline::endRun" << std::endl;
318 h_nVertex_ = ibooker.
book1D(
"nVertex",
"Number of event vertices in collection", 40, -0.5, 39.5);
322 "L1 Tau E_{T} vs PFTau E_{T} (EB); PFTau E_{T} (GeV); L1 Tau E_{T} (GeV)", 300, 0, 300, 300,
325 "L1 Tau E_{T} vs PFTau E_{T} (EE); PFTau E_{T} (GeV); L1 Tau E_{T} (GeV)", 300, 0, 300, 300,
328 "L1 Tau E_{T} vs PFTau E_{T} (EB+EE); PFTau E_{T} (GeV); L1 Tau E_{T} (GeV)", 300, 0, 300,
332 "#phi_{tau}^{L1} vs #phi_{tau}^{offline} (EB); #phi_{tau}^{offline}; #phi_{tau}^{L1}", 100,
335 "#phi_{tau}^{L1} vs #phi_{tau}^{offline} (EE); #phi_{tau}^{offline}; #phi_{tau}^{L1}", 100,
338 "#phi_{tau}^{L1} vs #phi_{tau}^{offline} (EB+EE); #phi_{tau}^{offline}; #phi_{tau}^{L1}", 100,
342 "L1 Tau #eta vs PFTau #eta; PFTau #eta; L1 Tau #eta", 100, -3, 3, 100, -3, 3);
346 "tau ET resolution (EB); (L1 Tau E_{T} - PFTau E_{T})/PFTau E_{T}; events", 50, -1, 1.5);
348 "tau ET resolution (EE); (L1 Tau E_{T} - PFTau E_{T})/PFTau E_{T}; events", 50, -1, 1.5);
350 "tau ET resolution (EB+EE); (L1 Tau E_{T} - PFTau E_{T})/PFTau E_{T}; events", 50, -1, 1.5);
353 ibooker.
book1D(
"resolutionTauPhi_EB",
354 "#phi_{tau} resolution (EB); #phi_{tau}^{L1} - #phi_{tau}^{offline}; events",
357 ibooker.
book1D(
"resolutionTauPhi_EE",
358 "tau #phi resolution (EE); #phi_{tau}^{L1} - #phi_{tau}^{offline}; events",
361 ibooker.
book1D(
"resolutionTauPhi_EB_EE",
362 "tau #phi resolution (EB+EE); #phi_{tau}^{L1} - #phi_{tau}^{offline}; events",
366 "tau #eta resolution (EB); L1 Tau #eta - PFTau #eta; events", 120, -0.3, 0.3);
371 int nBins = tauBins.size() - 1;
372 float* tauBinArray = &(tauBins[0]);
377 "efficiencyIsoTauET_EB_threshold_" + str_threshold +
"_Num",
378 "iso tau efficiency (EB); PFTau E_{T} (GeV); events", nBins, tauBinArray);
380 "efficiencyIsoTauET_EE_threshold_" + str_threshold +
"_Num",
381 "iso tau efficiency (EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
383 "efficiencyIsoTauET_EB_EE_threshold_" + str_threshold +
"_Num",
384 "iso tau efficiency (EB+EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
387 "efficiencyIsoTauET_EB_threshold_" + str_threshold +
"_Den",
388 "iso tau efficiency (EB); PFTau E_{T} (GeV); events", nBins, tauBinArray);
390 "efficiencyIsoTauET_EE_threshold_" + str_threshold +
"_Den",
391 "iso tau efficiency (EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
393 "efficiencyIsoTauET_EB_EE_threshold_" + str_threshold +
"_Den",
394 "iso tau efficiency (EB+EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
399 "efficiencyNonIsoTauET_EB_threshold_" + str_threshold +
"_Num",
400 "inclusive tau efficiency (EB); PFTau E_{T} (GeV); events", nBins, tauBinArray);
402 "efficiencyNonIsoTauET_EE_threshold_" + str_threshold +
"_Num",
403 "inclusive tau efficiency (EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
405 "efficiencyNonIsoTauET_EB_EE_threshold_" + str_threshold +
"_Num",
406 "inclusive tau efficiency (EB+EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
409 "efficiencyNonIsoTauET_EB_threshold_" + str_threshold +
"_Den",
410 "inclusive tau efficiency (EB); PFTau E_{T} (GeV); events", nBins, tauBinArray);
412 "efficiencyNonIsoTauET_EE_threshold_" + str_threshold +
"_Den",
413 "inclusive tau efficiency (EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
415 "efficiencyNonIsoTauET_EB_EE_threshold_" + str_threshold +
"_Den",
416 "inclusive tau efficiency (EB+EE); PFTau E_{T} (GeV); events", nBins, tauBinArray);
431 bool hasPrimaryVertex =
false;
435 for (
auto vertexIt=vertex->begin();vertexIt!=vertex->end();++vertexIt)
437 if (vertexIt->isValid() &&
441 errVtx = vertexIt->error();
442 hasPrimaryVertex =
true;
448 if ( !hasPrimaryVertex ) {
452 errVtx(2,2) = beamSpot->
sigmaZ();
463 double matchDeltaR = 9999;
474 if (hltFilterIndex < triggerEvent->sizeFilters()) {
476 const Vids triggerVids(triggerEvent->
filterIds(hltFilterIndex));
478 const unsigned nTriggers = triggerVids.size();
479 for (
size_t iTrig = 0; iTrig < nTriggers; ++iTrig) {
480 const TriggerObject trigObject = trigObjs[triggerKeys[iTrig]];
482 double dRtmp =
deltaR((*muon),trigObject);
483 if (dRtmp < matchDeltaR) matchDeltaR = dRtmp;
496 vector<l1t::Tau> l1tContainer;
497 l1tContainer.reserve(l1tCands->
size()+1);
500 l1tContainer.push_back(*
tau);
507 for(
auto l1tIt = l1tContainer.begin() ; l1tIt!=l1tContainer.end(); ++l1tIt) {
509 TauL1TPair pairTmpCand((*probeTauIt),&(*l1tIt));
512 pairBestCand = pairTmpCand;
527 pfmet=&(mets->front());
531 for(
auto muonIt2 = muons->begin(); muonIt2!=muons->end(); ++muonIt2) {
532 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) {
536 bool foundTightMu=
false;
537 for(
auto muonIt = muons->begin(); muonIt!=muons->end(); ++muonIt) {
538 if (!
matchHlt(trigEvent,&(*muonIt)))
continue;
539 float muiso=(muonIt->pfIsolationR04().sumChargedHadronPt+
max(muonIt->pfIsolationR04().sumNeutralHadronEt+muonIt->pfIsolationR04().sumPhotonEt-0.5*muonIt->pfIsolationR04().sumPUPt,0.0))/muonIt->
pt();
541 if (muiso<0.1 && nb_mu<2 && !foundTightMu && fabs(muonIt->eta())< 2.1 && muonIt->pt()>24 &&
muon::isLooseMuon((*muonIt))) {
542 float mt=
sqrt(
pow(muonIt->pt() + pfmet->
pt(), 2) -
pow(muonIt->px() + pfmet->
px(),2) -
pow(muonIt->py() + pfmet->
py(), 2));
591 for(
auto tauIt = taus->begin(); tauIt!=taus->end(); ++tauIt,++iTau) {
593 TLorentzVector mytau;
594 mytau.SetPtEtaPhiE(tauIt->pt(),tauIt->eta(),tauIt->phi(),tauIt->energy());
596 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) {
597 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
const_iterator end(int bx) const
virtual double pt() const final
transverse momentum
edm::EDGetTokenT< reco::VertexCollection > VtxInputTag_
std::vector< std::string > triggerPath_
std::vector< PFTau > PFTauCollection
collection of PFTau objects
unsigned size(int bx) const
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
void analyze(edm::Event const &e, edm::EventSetup const &eSetup)
#define DEFINE_FWK_MODULE(type)
MonitorElement * h_L1TauPhivsTauPhi_EB_
void bookTauHistos(DQMStore::IBooker &)
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)
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
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
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
virtual double px() const final
x coordinate of momentum vector
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)
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)
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
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_
void endRun(edm::Run const &run, edm::EventSetup const &eSetup)
static std::atomic< unsigned int > counter
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup)
bool matchHlt(edm::Handle< trigger::TriggerEvent > const &triggerEvent, const reco::Muon *muon)
const Point & position() const
position
edm::EDGetTokenT< reco::PFTauCollection > theTauCollection_
MonitorElement * h_L1TauETvsTauET_EB_EE_
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup)
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_
virtual double py() const final
y coordinate of momentum vector
MonitorElement * h_L1TauETvsTauET_EB_
Power< A, B >::type pow(const A &a, const B &b)
std::map< double, MonitorElement * > h_efficiencyNonIsoTauET_EE_pass_