312 using namespace l1extra;
318 for( L1JetParticleCollection::const_iterator itr = l1TauHandle->begin() ;
319 itr != l1TauHandle->end() ; ++itr ) {
320 TLorentzVector
p(itr->px(),itr->py(),itr->pz(),itr->energy());
328 for( L1JetParticleCollection::const_iterator itr = l1CenJetHandle->begin() ;
329 itr != l1CenJetHandle->end() ; ++itr ) {
330 TLorentzVector
p(itr->px(),itr->py(),itr->pz(),itr->energy());
338 for( L1JetParticleCollection::const_iterator itr = l1ForJetHandle->begin() ;
339 itr != l1ForJetHandle->end() ; ++itr ) {
340 TLorentzVector
p(itr->px(),itr->py(),itr->pz(),itr->energy());
348 for( L1EmParticleCollection::const_iterator itr = l1IsoEgammaHandle->begin() ;
349 itr != l1IsoEgammaHandle->end() ; ++itr ) {
350 TLorentzVector
p(itr->px(),itr->py(),itr->pz(),itr->energy());
358 for( L1EmParticleCollection::const_iterator itr = l1NonIsoEgammaHandle->begin() ;
359 itr != l1NonIsoEgammaHandle->end() ; ++itr ) {
360 TLorentzVector
p(itr->px(),itr->py(),itr->pz(),itr->energy());
369 for( L1MuonParticleCollection::const_iterator itr = l1MuonHandle->begin() ;
370 itr != l1MuonHandle->end() ; ++itr ) {
371 TLorentzVector
p(itr->px(),itr->py(),itr->pz(),itr->energy());
381 for( L1EtMissParticleCollection::const_iterator itr = l1MetHandle->begin() ;
382 itr != l1MetHandle->end() ; ++itr ) {
383 TLorentzVector
p(itr->px(),itr->py(),itr->pz(),itr->energy());
392 using namespace reco;
400 PFTauRef thePFTau(thePFTauHandle,iPFTau);
401 if ((*thePFTauDiscriminatorByIsolation)[thePFTau] == 1) {
402 TLorentzVector pftau((*thePFTau).px(),(*thePFTau).py(),(*thePFTau).pz(),(*thePFTau).energy());
411 using namespace HepMC;
417 GenEvent * generated_event =
new GenEvent(*(evt->GetEvent()));
424 unsigned int nTauHads = 0;
int nTauMuons = 0;
int nTauElecs = 0;
425 unsigned int nfidTauHads = 0;
int nfidTauMuons = 0;
int nfidTauElecs = 0;
426 TLorentzVector taunu,tauelec,taumuon;
427 GenEvent::particle_iterator
p;
429 for (
p = generated_event->particles_begin();
p != generated_event->particles_end(); ++
p) {
430 if(
abs((*p)->pdg_id()) ==
_BosonPID && (*p)->end_vertex()) {
431 HepMC::GenVertex::particle_iterator
z = (*p)->end_vertex()->particles_begin(HepMC::descendants);
432 for(; z != (*p)->end_vertex()->particles_end(HepMC::descendants); z++) {
433 if(
abs((*z)->pdg_id()) == 15 && (*z)->status()==2) {
434 bool lept_decay =
false;
435 TLorentzVector
tau((*z)->momentum().px(),(*z)->momentum().py(),(*z)->momentum().pz(),(*z)->momentum().e());
436 HepMC::GenVertex::particle_iterator
t = (*z)->end_vertex()->particles_begin(HepMC::descendants);
437 for(; t != (*z)->end_vertex()->particles_end(HepMC::descendants); t++) {
438 if(
abs((*t)->pdg_id()) == 11 ||
abs((*t)->pdg_id()) == 13) lept_decay=
true;
439 if(
abs((*t)->pdg_id()) == 11) {
440 tauelec.SetPxPyPzE((*t)->momentum().px(),(*t)->momentum().py(),(*t)->momentum().pz(),(*t)->momentum().e());
446 if(
abs((*t)->pdg_id()) == 13) {
447 taumuon.SetPxPyPzE((*t)->momentum().px(),(*t)->momentum().py(),(*t)->momentum().pz(),(*t)->momentum().e());
453 if(
abs((*t)->pdg_id()) == 16)
454 taunu.SetPxPyPzE((*t)->momentum().px(),(*t)->momentum().py(),(*t)->momentum().pz(),(*t)->momentum().e());
456 if(lept_decay==
false) {
457 TLorentzVector jetMom=
tau-taunu;
467 delete generated_event;
550 const vector<L1GlobalTriggerObjectMap>& objMapVec = L1GTOMRec.
gtObjectMap();
551 for (vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin();
552 itMap != objMapVec.end(); ++itMap) {
553 int iBit = (*itMap).algoBitNumber();
554 l1BitName =
string( (*itMap).algoName() );
555 l1Accept = gtDecisionWord[iBit];
578 bool singleTauPassed =
false;
579 bool doubleTauPassed =
false;
580 bool muTauPassed =
false;
581 bool isoEgTauPassed =
false;
582 bool singleTauMETPassed =
false;
592 singleTauPassed =
true;
597 doubleTauPassed =
true;
602 singleTauMETPassed =
true;
613 for (
int i=0;
i<nL1Taus;
i++) {
614 for (
int j=0;
j<nL1IsoEgammas;
j++) {
621 if (deltaPhi>0.348 && deltaEta>0.348) {
622 isoEgTauPassed =
true;
639 bool singleTauPassed =
false;
640 bool doubleTauPassed =
false;
641 bool muTauPassed =
false;
642 bool isoEgTauPassed =
false;
643 bool singleTauMETPassed =
false;
645 bool singleMatch =
false;
646 bool doubleMatch =
false;
650 for (
unsigned int i = 0;
i<
_L1Taus.size();
i++) {
665 if (singleMatch && !doubleMatch)
685 if (singleMatch && iSingle>=0) {
688 singleTauPassed =
true;
701 singleTauMETPassed =
true;
726 if (deltaPhi>0.348 && deltaEta>0.348) {
730 isoEgTauPassed =
true;
739 if (doubleMatch && iDouble>=0) {
742 doubleTauPassed =
true;
749 if (deltaPhi>0.348 && deltaEta>0.348) {
753 isoEgTauPassed =
true;
772 bool singleTauPassed =
false;
773 bool doubleTauPassed =
false;
774 bool muTauPassed =
false;
775 bool isoEgTauPassed =
false;
776 bool singleTauMETPassed =
false;
778 bool singleMatch =
false;
779 bool doubleMatch =
false;
783 unsigned int nPFMatchGenTauHad = 0;
785 std::vector<TLorentzVector> PFMatchedGenTauHads;
786 PFMatchedGenTauHads.clear();
788 for (
unsigned int k = 0;
k<
_PFTaus.size();
k++) {
810 for (
unsigned int i = 0;
i<
_L1Taus.size();
i++) {
811 for (
unsigned int j = 0;
j<PFMatchedGenTauHads.size();
j++) {
812 double deltaR = ROOT::Math::VectorUtil::DeltaR(
_L1Taus[
i],PFMatchedGenTauHads[
j]);
820 if (singleMatch && !doubleMatch)
835 if (singleMatch && iSingle>=0) {
838 singleTauPassed =
true;
851 singleTauMETPassed =
true;
875 if (deltaPhi>0.348 && deltaEta>0.348) {
879 isoEgTauPassed =
true;
887 if (doubleMatch && iDouble>=0) {
890 doubleTauPassed =
true;
898 if (deltaPhi>0.348 && deltaEta>0.348) {
902 isoEgTauPassed =
true;
911 unsigned int nfidMCGenTauMuon = 0;
912 unsigned int nfidMCGenTauElec = 0;
945 int nbins = histo->GetNbinsX();
946 double integral = histo->GetBinContent(nbins+1);
948 std::cerr <<
"***** L1TauAnalyzer::convertToIntegratedEff() Error: nGenerated = " << nGenerated << std::endl;
951 for(
int i = nbins;
i >= 1;
i--)
953 double thisBin = histo->GetBinContent(
i);
956 double integralError;
957 integralEff = (integral / nGenerated);
958 histo->SetBinContent(
i, integralEff);
960 integralError = (
sqrt(integral) / nGenerated);
961 histo->SetBinError(
i, integralError);
969 cout<<
"****************************************"<<endl;
970 cout<<
"* L1extra Efficiency Report"<<endl;
971 cout<<
"****************************************"<<endl;
973 cout<<
"---------------------------------------------------------------------------------------------"<<endl;
974 cout<<
" #PassL1 GlobEff GlEff/BR(fid.) MCMatchEff PFMCMatchEff BR(fid.) BR"<<endl;
975 cout<<
"---------------------------------------------------------------------------------------------"<<endl;
1024 cout<<
"****************************************"<<endl;
1025 cout<<
"* L1 GT Efficiency Report"<<endl;
1026 cout<<
"****************************************"<<endl;
1028 cout<<
"---------------------------------------------------------------------------------------"<<endl;
1029 cout<<
" #PassL1 GlobEff GlobEff/BR(fid.) BR(fid.) BR"<<endl;
1030 cout<<
"---------------------------------------------------------------------------------------"<<endl;
TH1 * h_L1MCMatchedTauEta
TH1 * h_L1DoubleTauEffPFMCMatchEt
T getParameter(std::string const &) const
void evalL1Decisions(const edm::Event &iEvent)
int _nfidEventsDoubleGenTauHads
int _nEventsL1GTIsoEgTauPassed
int _nEventsPFMatchGenTauElecTauHad
edm::EDGetTokenT< l1extra::L1EmParticleCollection > _L1extraNonIsoEgammaSource
int _nEventsL1IsoEgTauPassedMCMatched
double _SingleTauThreshold
std::vector< double > _MuTauThresholds
TH1 * h_L1MCPFMatchedTauEt
int _nEventsL1GTDoubleTauPassed
std::vector< TLorentzVector > _GenTauElecs
void calcL1MCPFTauMatching()
TH1 * h_L1DoubleTauEffMCMatchEt
virtual void analyze(const edm::Event &, const edm::EventSetup &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< TLorentzVector > _L1ForJets
void getL1extraObjects(const edm::Event &, const edm::EventSetup &)
std::string _L1SingleTauName
TH1 * h_L1MCPFMatchedTauPhi
int _nEventsL1SingleTauPassedPFMCMatched
std::vector< TLorentzVector > _GenTauMuons
int _nEventsPFMatchGenTauHad
edm::EDGetTokenT< reco::PFTauCollection > _PFTauSource
edm::EDGetTokenT< l1extra::L1JetParticleCollection > _L1extraCenJetSource
std::vector< TLorentzVector > _PFTaus
TH1 * h_L1MCPFMatchedTauEta
int _nEventsGenTauMuonTauHad
const std::vector< L1GlobalTriggerObjectMap > & gtObjectMap() const
get / set the vector of object maps
TH1 * h_L1MCMatchedTauPhi
int _nEventsL1SingleTauPassed
std::vector< TLorentzVector > _L1IsoEgammas
int _nEventsL1GTSingleTauPassed
std::vector< TLorentzVector > _GenTauHads
std::vector< TLorentzVector > _L1CenJets
edm::EDGetTokenT< l1extra::L1EmParticleCollection > _L1extraIsoEgammaSource
int _nEventsL1GTSingleTauMETPassed
std::vector< bool > DecisionWord
typedefs
TH1 * h_L1minusMCoverMCTauEt
void convertToIntegratedEff(TH1 *, double)
std::vector< int > _L1MuQuals
int _nEventsL1IsoEgTauPassedPFMCMatched
void fillPFTauHistograms()
double _MCTauHadMaxAbsEta
int _nEventsL1SingleTauMETPassedPFMCMatched
std::vector< TLorentzVector > _L1METs
int _nEventsL1IsoEgTauPassed
Abs< T >::type abs(const T &t)
int _nEventsGenTauElecTauHad
TH1 * h_L1SingleTauEffPFMCMatchEt
std::vector< TLorentzVector > _L1Muons
int _nfidEventsGenTauElecTauHad
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > _L1GtReadoutRecord
int _nEventsL1DoubleTauPassedMCMatched
int _nEventsL1DoubleTauPassed
T * make(const Args &...args) const
make new ROOT object
int _nEventsL1MuonTauPassedPFMCMatched
Integral< F, X >::type integral(const F &f)
void getPFTauObjects(const edm::Event &, const edm::EventSetup &)
std::vector< double > _IsoEgTauThresholds
int _nEventsL1SingleTauMETPassed
double deltaR(double eta1, double eta2, double phi1, double phi2)
void getGenObjects(const edm::Event &, const edm::EventSetup &)
std::vector< TLorentzVector > _L1NonIsoEgammas
int _nEventsPFMatchGenTauMuonTauHad
unsigned int quality() const
get quality
std::vector< TLorentzVector > _L1Taus
edm::EDGetTokenT< l1extra::L1JetParticleCollection > _L1extraForJetSource
std::string _L1TauMETName
int _nEventsL1SingleTauMETPassedMCMatched
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > _L1GtObjectMap
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > _L1extraMuonSource
int _nEventsL1DoubleTauPassedPFMCMatched
std::string _L1MuonTauName
std::string _L1IsoEgTauName
int _nEventsL1MuonTauPassedMCMatched
edm::EDGetTokenT< l1extra::L1JetParticleCollection > _L1extraTauJetSource
edm::EDGetTokenT< edm::HepMCProduct > _GenParticleSource
int _nfidEventsGenTauMuonTauHad
int _nEventsDoubleGenTauHads
double _DoubleTauThreshold
int _nEventsL1MuonTauPassed
L1TauAnalyzer(const edm::ParameterSet &)
int _nEventsPFMatchDoubleGenTauHads
int _nEventsL1SingleTauPassedMCMatched
std::string _L1DoubleTauName
std::vector< double > _SingleTauMETThresholds
void calcL1MCTauMatching()
void evalL1extraDecisions()
TH1 * h_L1SingleTauEffMCMatchEt
int _nEventsL1GTMuonTauPassed
edm::EDGetTokenT< reco::PFTauDiscriminatorByIsolation > _PFTauDiscriminatorSource
edm::EDGetTokenT< l1extra::L1EtMissParticleCollection > _L1extraMETSource