CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

L25TauAnalyzer Class Reference

#include <HLTriggerOffline/L25TauAnalyzer/src/L25TauAnalyzer.cc>

Inheritance diagram for L25TauAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

List of all members.

Public Member Functions

 L25TauAnalyzer (const edm::ParameterSet &)
 ~L25TauAnalyzer ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
void clearVectors ()
virtual void endJob ()
void initializeVectors ()
reco::PFTau match (const reco::Jet &, const reco::PFTauCollection &)
reco::CaloJet matchedToPFTau (const reco::PFTau &, const reco::L2TauInfoAssociation &)
void printInfo (const reco::PFTau &thePFTau, const reco::IsolatedTauTagInfo &theTauTagInfo)

Private Attributes

float _isolationCone
float _l25Dz
float _l25JetLeadTkMacthingCone
edm::InputTag _l25JetSource
float _l25LeadTkPtMin
float _l2l25MatchingCone
edm::InputTag _l2TauInfoAssoc
float _minTrackPt
int _nTrkIso
edm::InputTag _pfTauIsoSource
edm::InputTag _pfTauMuonDiscSource
edm::InputTag _pfTauSource
edm::InputTag _pVtxSource
float _signalCone
bool hasLeadTrk
bool l25Disc_JetDir
bool l25Disc_LeadTkDir
bool l25Disc_Trk5_IsoPtMin2_NTrk0
std::vector< float > * l25IsoTrkChi2
std::vector< float > * l25IsoTrkChi2NdF
std::vector< float > * l25IsoTrkDxy
std::vector< float > * l25IsoTrkDz
std::vector< float > * l25IsoTrkEta
std::vector< int > * l25IsoTrkNLostHits
std::vector< int > * l25IsoTrkNRecHits
std::vector< int > * l25IsoTrkNValidHits
std::vector< int > * l25IsoTrkNValidPixelHits
std::vector< float > * l25IsoTrkPhi
std::vector< float > * l25IsoTrkPt
float l25JetEt
float l25JetEta
float l25JetPhi
bool L25MatchedToL2
bool l25MatchedToPFTau
std::vector< float > * l25SignalTrkChi2
std::vector< float > * l25SignalTrkChi2NdF
std::vector< float > * l25SignalTrkDxy
std::vector< float > * l25SignalTrkDz
std::vector< float > * l25SignalTrkEta
std::vector< int > * l25SignalTrkNLostHits
std::vector< int > * l25SignalTrkNRecHits
std::vector< int > * l25SignalTrkNValidHits
std::vector< int > * l25SignalTrkNValidPixelHits
std::vector< float > * l25SignalTrkPhi
std::vector< float > * l25SignalTrkPt
TTree * l25tree
std::vector< float > * l25TrkChi2
std::vector< float > * l25TrkChi2NdF
std::vector< float > * l25TrkDxy
std::vector< float > * l25TrkDz
std::vector< float > * l25TrkEta
std::vector< float > * l25TrkNRecHits
std::vector< float > * l25TrkNValidPixelHits
std::vector< float > * l25TrkPhi
std::vector< float > * l25TrkPt
float l2JetEt
float l2JetEta
float l2JetPhi
bool L2MatchedToPFtau
float leadIsoTrkDeltaR
float leadIsoTrkPtRes
float leadSignalTrackPt
float leadTrkDeltaR
float leadTrkJetDeltaR
float leadTrkPtRes
int myNtrkIso
int numPixTrkInJet
int numQPixTrkInAnnulus
int numQPixTrkInJet
int numQPixTrkInSignalCone
float pfTauElecDisc
float pfTauEt
float pfTauEta
float pfTauGammaIso
bool pfTauHasLeadTrk
bool pfTauInBounds
float pfTauIsoDisc
float pftauIsoTrkDeltaR
float pfTauIsoTrkPt
float pftauL25DeltaR
float pfTauLTPt
float pfTauMuonDisc
int pfTauNProngs
int pfTauNTrkIso
float pfTauPhi
float pfTauPt
float pftauSignalTrkDeltaR
float pfTauTrkIso
bool signal_
math::XYZPoint theVertexPosition

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 55 of file L25TauAnalyzer.h.


Constructor & Destructor Documentation

L25TauAnalyzer::L25TauAnalyzer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 31 of file L25TauAnalyzer.cc.

References edm::ParameterSet::getParameter().

                                                            {
   //now do what ever initialization is needed

  _l25JetSource = iConfig.getParameter<InputTag>("L25JetSource");
  _l2TauInfoAssoc = iConfig.getParameter<InputTag>("L2TauSource");
  _pfTauSource = iConfig.getParameter<InputTag>("PFTauSource");
  _pfTauIsoSource = iConfig.getParameter<InputTag>("PFTauIsoSource");
  _pfTauMuonDiscSource = iConfig.getParameter<InputTag>("PFTauMuonDiscSource");
  _pVtxSource = iConfig.getParameter<InputTag>("PrimaryVtxSource");
  _l2l25MatchingCone = iConfig.getParameter<double>("L2L25MatchingCone");
  
  _l25JetLeadTkMacthingCone =  iConfig.getParameter<double>("L25JetLeadTkMatchingCone");
  _minTrackPt = iConfig.getParameter<double>("MinTrackPt");
  _signalCone = iConfig.getParameter<double>("SignalCone");
  _isolationCone = iConfig.getParameter<double>("IsolationCone");
  _l25Dz = iConfig.getParameter<double>("L25DzCut");
  _nTrkIso = iConfig.getParameter<int>("NTrkIso");
  _l25LeadTkPtMin = iConfig.getParameter<double>("L25LeadTkMinPt");
  
     
  l25JetEt=0.;
  l25JetEta=10.;
  l25JetPhi=10.;
  hasLeadTrk=0;
  leadSignalTrackPt = 0.;
  leadTrkJetDeltaR = 0.;
  numPixTrkInJet = 0;
  numQPixTrkInJet = 0;
  numQPixTrkInSignalCone = 0;
  numQPixTrkInAnnulus = 10;
  
  pfTauPt = 0.;
  pfTauEt = 0.;
  pfTauEta = 10.;
  pfTauPhi = 10.;
  pfTauLTPt = 0.;
  pfTauTrkIso = 100.;
  pfTauGammaIso = 100.;
  
  l2JetEt = 0;
  l2JetEta = 10;
  l2JetPhi = 10;
  
  l25MatchedToPFTau = 0;
  L2MatchedToPFtau = 0;
  L25MatchedToL2 = 0;
  
  initializeVectors();
  edm::Service<TFileService> fs;
  l25tree = fs->make<TTree>("l25tree","Level 2.5 Tau Tree");
  
  l25tree->Branch("pfTauHasLeadTrk", &pfTauHasLeadTrk, "pfTauHasLeadTrk/B");
  l25tree->Branch("pfTauInBounds", &pfTauInBounds, "pfTauInBounds/B");
  l25tree->Branch("pfTauPt", &pfTauPt, "pfTauPt/F");
  l25tree->Branch("pfTauEt", &pfTauEt, "pfTauEt/F");
  l25tree->Branch("pfTauEta", &pfTauEta, "pfTauEta/F");
  l25tree->Branch("pfTauphi", &pfTauPhi, "pfTauPhi/F");
  l25tree->Branch("pfTauLTPt", &pfTauLTPt, "pfTauLTPt/F");
  l25tree->Branch("pfTauIsoDisc", &pfTauIsoDisc, "pfTauIsoDisc/F");
  l25tree->Branch("pfTauMuonDisc", &pfTauMuonDisc, "pfTauMuonDisc/F");
  l25tree->Branch("pfTauNProngs", &pfTauNProngs, "pfTauNProngs/I");
  l25tree->Branch("pfTauTrkIso", &pfTauTrkIso, "pfTauTrkIso/F");
  l25tree->Branch("pfTauNTrkIso", &pfTauNTrkIso, "pfTauNTrkIso/I");
  l25tree->Branch("pfTauIsoTrkPt", &pfTauIsoTrkPt, "pfTauIsoTrkPt/F");
  l25tree->Branch("pfTauGammaIso", &pfTauGammaIso, "pfTauGammaIso/F");
  
  l25tree->Branch("pftauL25DeltaR", &pftauL25DeltaR, "pftauL25DeltaR/F");
  l25tree->Branch("pftauSignalTrkDeltaR", &pftauSignalTrkDeltaR, "pftauSignalTrkDeltaR/F");
  l25tree->Branch("pftauIsoTrkDeltaR", &pftauIsoTrkDeltaR, "pftauIsoTrkDeltaR/F");
  l25tree->Branch("leadTrkPtRes", &leadTrkPtRes, "leadTrkPtRes/F");
  l25tree->Branch("leadTrkDeltaR", &leadTrkDeltaR, "leadTrkDeltaR/F");
  l25tree->Branch("leadIsoTrkPtRes", &leadIsoTrkPtRes, "leadIsoTrkPtRes/F");
  l25tree->Branch("leadIsoTrkDeltaR", &leadIsoTrkDeltaR, "leadIsoTrkDeltaR/F");
  l25tree->Branch("l25Disc_LeadTkDir", &l25Disc_LeadTkDir, "l25Disc_LeadTkDir/B");
  l25tree->Branch("l25Disc_JetDir", &l25Disc_JetDir, "l25Disc_JetDir/B");
 
  l25tree->Branch("l2JetEt", &l2JetEt, "l2JetEt/F");
  l25tree->Branch("l2JetEta", &l2JetEta, "l2JetEta/F");
  l25tree->Branch("l2JetPhi", &l2JetPhi, "l2JetPhi/F");
 
  l25tree->Branch("l25MatchedToPFTau", &l25MatchedToPFTau, "l25MatchedToPFTau/B");
  l25tree->Branch("L2MatchedToPFtau", &L2MatchedToPFtau, "L2MatchedToPFtau/B");
  l25tree->Branch("L25MatchedToL2", &L25MatchedToL2, "L25MatchedToL2/B");
  
  l25tree->Branch("l25JetEt", &l25JetEt, "l25JetEt/F");
  l25tree->Branch("l25JetEta", &l25JetEta, "l25JetEta/F");
  l25tree->Branch("l25JetPhi", &l25JetPhi, "l25JetPhi/F");
  l25tree->Branch("hasLeadTrack", &hasLeadTrk, "hasLeadTrack/B");
  l25tree->Branch("leadTrackPt", &leadSignalTrackPt, "leadTrackPt/F");
  l25tree->Branch("nTracks", &numPixTrkInJet, "nTracks/I");
  l25tree->Branch("nQTracks", &numQPixTrkInJet, "nQTracks/I");
  l25tree->Branch("nQTracksInSignal", &numQPixTrkInSignalCone, "nQTracksInSignal/I");
  l25tree->Branch("nQTracksInAnnulus", &numQPixTrkInAnnulus, "nQTracksInAnnulus/I");
  
  l25tree->Branch("l25TrkPt", &l25TrkPt);
  l25tree->Branch("l25TrkEta", &l25TrkEta);
  l25tree->Branch("l25TrkPhi", &l25TrkPhi);
  l25tree->Branch("l25TrkDz", &l25TrkDz);
  l25tree->Branch("l25TrkDxy", &l25TrkDxy);
  l25tree->Branch("l25TrkChi2", &l25TrkChi2);
  l25tree->Branch("l25TrkChi2NdF", &l25TrkChi2NdF);
  l25tree->Branch("l25TrkNRecHits", &l25TrkNRecHits);
  l25tree->Branch("l25TrkNValidPixelHits", &l25TrkNValidPixelHits);
  
  l25tree->Branch("l25SignalTrkPt", &l25SignalTrkPt);
  l25tree->Branch("l25SignalTrkEta", &l25SignalTrkEta);
  l25tree->Branch("l25SignalTrkPhi", &l25SignalTrkPhi);
  l25tree->Branch("l25SignalTrkDz", &l25SignalTrkDz);
  l25tree->Branch("l25SignalTrkDxy", &l25SignalTrkDxy);
  l25tree->Branch("l25SignalTrkChi2", &l25SignalTrkChi2);
  l25tree->Branch("l25SignalTrkChi2NdF", &l25SignalTrkChi2NdF);
  l25tree->Branch("l25SignalTrkNRecHits", &l25SignalTrkNRecHits);
  l25tree->Branch("l25SignalTrkNValidHits", &l25SignalTrkNValidHits);
  l25tree->Branch("l25SignalTrkNValidPixelHits", &l25SignalTrkNValidPixelHits);
  l25tree->Branch("l25SignalTrkNLostHits", &l25SignalTrkNLostHits);
  
  l25tree->Branch("l25IsoTrkPt", &l25IsoTrkPt);
  l25tree->Branch("l25IsoTrkEta", &l25IsoTrkEta);
  l25tree->Branch("l25IsoTrkPhi", &l25IsoTrkPhi);
  l25tree->Branch("l25IsoTrkDz", &l25IsoTrkDz);
  l25tree->Branch("l25IsoTrkDxy", &l25IsoTrkDxy);
  l25tree->Branch("l25IsoTrkChi2", &l25IsoTrkChi2);
  l25tree->Branch("l25IsoTrkChi2NdF", &l25IsoTrkChi2NdF);
  l25tree->Branch("l25IsoTrkNRecHits", &l25IsoTrkNRecHits);
  l25tree->Branch("l25IsoTrkNValidHits", &l25IsoTrkNValidHits);
  l25tree->Branch("l25IsoTrkNValidPixelHits", &l25IsoTrkNValidPixelHits);
  l25tree->Branch("l25IsoTrkNLostHits", &l25IsoTrkNLostHits);
  
  l25tree->Branch("myNtrkIso", &myNtrkIso, "myNtrkIso/I");
}
L25TauAnalyzer::~L25TauAnalyzer ( )

Definition at line 163 of file L25TauAnalyzer.cc.

                               {
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void L25TauAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 176 of file L25TauAnalyzer.cc.

References reco::IsolatedTauTagInfo::allTracks(), edm::RefVector< C, T, F >::at(), edm::RefVector< C, T, F >::begin(), gather_cfg::cout, delta, reco::IsolatedTauTagInfo::discriminator(), edm::RefVector< C, T, F >::end(), reco::LeafCandidate::et(), reco::LeafCandidate::eta(), edm::Event::getByLabel(), i, edm::Ref< C, T, F >::isNonnull(), reco::JTATagInfo::jet(), reco::IsolatedTauTagInfo::leadingSignalTrack(), reco::TrackBase::momentum(), reco::LeafCandidate::p4(), reco::LeafCandidate::phi(), reco::TrackBase::pt(), reco::IsolatedTauTagInfo::selectedTracks(), edm::RefVector< C, T, F >::size(), and reco::IsolatedTauTagInfo::tracksInCone().

                                                                               {
   using namespace edm;

  //get l2 jet; match to pftau
  Handle<PFTauCollection> thePFTaus;
  iEvent.getByLabel(_pfTauSource,thePFTaus);
  
  Handle<PFTauDiscriminator> thePFTauDiscriminatorByIsolation;
  iEvent.getByLabel(_pfTauIsoSource,thePFTauDiscriminatorByIsolation);  
  
  Handle<PFTauDiscriminator> thePFTauDiscriminatorAgainstMuon;
  iEvent.getByLabel(_pfTauMuonDiscSource, thePFTauDiscriminatorAgainstMuon); 
  
  Handle<VertexCollection> thePrimaryVertices;
  iEvent.getByLabel(_pVtxSource, thePrimaryVertices);
  const reco::Vertex& theHltPrimaryVertex = (*thePrimaryVertices->begin());
  theVertexPosition = math::XYZPoint(0.,0.,0.);
  if(thePrimaryVertices->size() > 0) theVertexPosition = math::XYZPoint(theHltPrimaryVertex.position().x(), 
                                                     theHltPrimaryVertex.position().y(),
                                                     theHltPrimaryVertex.position().z());  
  
  //Loop over PFtaus
  if(thePFTaus.isValid()){
    edm::LogInfo("L25Analysis")  << "Inside PFTau\n";
    for(unsigned int pfTauIt = 0; pfTauIt < thePFTaus->size(); ++pfTauIt){
      const PFTauRef thisTauRef(thePFTaus,pfTauIt);
      pfTauIsoDisc = 0;
      pfTauMuonDisc = 0;
      if(thePFTauDiscriminatorByIsolation.isValid()){
        const PFTauDiscriminator& disc = *(thePFTauDiscriminatorByIsolation.product());
        pfTauIsoDisc = disc[thisTauRef];
      }
      if(thePFTauDiscriminatorAgainstMuon.isValid()){
        const PFTauDiscriminator& disc = *(thePFTauDiscriminatorAgainstMuon.product());
        pfTauMuonDisc = disc[thisTauRef];
      }
      
      L2MatchedToPFtau = false;      
      pfTauHasLeadTrk = false;
      pfTauInBounds = true;
      
      pfTauPt = thePFTaus->at(pfTauIt).pt();                                                      
      pfTauEt = thePFTaus->at(pfTauIt).et();                                                      
      pfTauEta = thePFTaus->at(pfTauIt).eta();                                            
      pfTauPhi = thePFTaus->at(pfTauIt).eta(); 
      
      const PFCandidateRef& thePFTauLeadTrack = thePFTaus->at(pfTauIt).leadPFChargedHadrCand(); 
      if(thePFTauLeadTrack.isNonnull()){
        pfTauHasLeadTrk = true;
        pfTauNProngs = thePFTaus->at(pfTauIt).signalPFChargedHadrCands().size();                              
        pfTauLTPt = thePFTaus->at(pfTauIt).leadPFChargedHadrCand()->pt();
        pfTauTrkIso = thePFTaus->at(pfTauIt).isolationPFChargedHadrCandsPtSum();
        pfTauGammaIso = thePFTaus->at(pfTauIt).isolationPFGammaCandsEtSum();
      }
      
      const PFCandidateRefVector& theSignalCands = thePFTaus->at(pfTauIt).signalPFChargedHadrCands();
      for(PFCandidateRefVector::const_iterator vIt = theSignalCands.begin(); vIt != theSignalCands.end(); ++vIt){
        pftauSignalTrkDeltaR = ROOT::Math::VectorUtil::DeltaR((*vIt)->trackRef()->momentum(), thePFTauLeadTrack->momentum());
        if(pftauSignalTrkDeltaR > _signalCone) pfTauInBounds = false;
      }
    
      const PFCandidateRefVector& theIsoCands = thePFTaus->at(pfTauIt).isolationPFChargedHadrCands();
      pfTauNTrkIso = theIsoCands.size();
      float PFTauLeadIsoPt = 0.;
      Track thePFTauLeadIsoTrk;      
      for(PFCandidateRefVector::const_iterator vIt = theIsoCands.begin(); vIt != theIsoCands.end(); ++vIt){
        pftauIsoTrkDeltaR = ROOT::Math::VectorUtil::DeltaR((*vIt)->trackRef()->momentum(), thePFTauLeadTrack->momentum());
        if(pftauIsoTrkDeltaR < _isolationCone) pfTauInBounds = false;
        pfTauIsoTrkPt = (*vIt)->trackRef()->pt();                     
        if((*vIt)->trackRef()->pt() > PFTauLeadIsoPt){
          thePFTauLeadIsoTrk = *((*vIt)->trackRef());
          PFTauLeadIsoPt = (*vIt)->trackRef()->pt();
        }
      }
      
      // matched PFtau to l2 Jet with Et > 5 ... originially 15 but to strong for min bias
      Handle<L2TauInfoAssociation> l2TauInfoAssoc; //Handle to the input (L2 Tau Info Association) 
      iEvent.getByLabel(_l2TauInfoAssoc,l2TauInfoAssoc);                                           
      reco::CaloJet theMatchedL2Jet;
      IsolatedTauTagInfo theMatchedL25TauTagInfo;
      if(iEvent.getByLabel(_l2TauInfoAssoc,l2TauInfoAssoc) && l2TauInfoAssoc->size()>0){
        double matchDr = _l2l25MatchingCone;
        for(L2TauInfoAssociation::const_iterator it = l2TauInfoAssoc->begin(); it != l2TauInfoAssoc->end(); ++it){
          const reco::CaloJet& l2Jet =*(it->key);
          if(l2Jet.et() < 15.) continue;
          double delta = ROOT::Math::VectorUtil::DeltaR(thePFTaus->at(pfTauIt).p4(),l2Jet.p4());
          if(delta < matchDr){
            matchDr = delta;
            L2MatchedToPFtau = true;
            theMatchedL2Jet = l2Jet;
          }
        }
      }
      
      //if(L2MatchedToPFtau) match to l25 and fill l25 variables
      Handle<IsolatedTauTagInfoCollection> tauTagInfo;
      if(L2MatchedToPFtau){
        l2JetEt = theMatchedL2Jet.et();
        l2JetEta = theMatchedL2Jet.eta();
        l2JetPhi = theMatchedL2Jet.phi();
        if(iEvent.getByLabel(_l25JetSource, tauTagInfo) && tauTagInfo->size()>0){
          L25MatchedToL2 = false;                                                                              
          double minDeltaR = _l2l25MatchingCone;                                                                       
          //declare l25 tauTagInfo ...                                                                         
          //IsolatedTauTagInfo theMatchedL25TauTagInfo;                                                        
          for(IsolatedTauTagInfoCollection::const_iterator i = tauTagInfo->begin();i!=tauTagInfo->end();++i){ 
            double delta = ROOT::Math::VectorUtil::DeltaR(theMatchedL2Jet.p4(), i->jet()->p4());               
            if(delta < minDeltaR){                                                                             
              minDeltaR = delta;                                                                               
              L25MatchedToL2 = true;                                                                           
              theMatchedL25TauTagInfo = *i;
            }                                                                                                  
          }                                                                                                    
        }
        
        pftauL25DeltaR = ROOT::Math::VectorUtil::DeltaR(thePFTaus->at(pfTauIt).p4(), theMatchedL25TauTagInfo.jet()->p4());
        if(pftauL25DeltaR < _l2l25MatchingCone)l25MatchedToPFTau = true;
        
        const TrackRefVector theTauTagTracks = theMatchedL25TauTagInfo.allTracks();
        
        l25JetEt = theMatchedL25TauTagInfo.jet()->et();                                                                                                              
        l25JetEta = theMatchedL25TauTagInfo.jet()->eta();
        l25JetPhi = theMatchedL25TauTagInfo.jet()->phi();
        numPixTrkInJet = theTauTagTracks.size();                                                                                             
        numQPixTrkInJet = theMatchedL25TauTagInfo.selectedTracks().size();
        //get info for all tracks in tauTagInfo
        for(TrackRefVector::const_iterator trkIt = theTauTagTracks.begin(); trkIt != theTauTagTracks.end(); ++trkIt){
          l25TrkPt->push_back((*trkIt)->pt());
          l25TrkEta->push_back((*trkIt)->eta());
          l25TrkPhi->push_back((*trkIt)->phi());
          l25TrkDz->push_back((*trkIt)->dz(theVertexPosition));
          l25TrkDxy->push_back((*trkIt)->dxy(theVertexPosition));
          l25TrkChi2->push_back((*trkIt)->chi2());
          l25TrkChi2NdF->push_back((*trkIt)->normalizedChi2());
          l25TrkNRecHits->push_back((*trkIt)->recHitsSize());
          l25TrkNValidPixelHits->push_back((*trkIt)->hitPattern().numberOfValidPixelHits());
        }
        const TrackRef leadTk = theMatchedL25TauTagInfo.leadingSignalTrack(_l25JetLeadTkMacthingCone, _minTrackPt);                                                                      
        if(!leadTk){                                                                                                                                
          hasLeadTrk=false;                                                                                                                 
          numQPixTrkInSignalCone=0;                                                                                                         
          numQPixTrkInAnnulus=0;                                                                                                            
          leadSignalTrackPt=0;                                                                                                              
          leadTrkJetDeltaR=10;
          leadTrkDeltaR=10;                                                                                                         
        }                                                                                                                                   
        else{                                                                                                                               
          hasLeadTrk=true;                                                                                                                
          leadTrkJetDeltaR = ROOT::Math::VectorUtil::DeltaR(theMatchedL25TauTagInfo.jet()->p4().Vect(), leadTk->momentum());
          leadSignalTrackPt=leadTk->pt();
          if(pfTauLTPt != 0)leadTrkPtRes = (leadTk->pt() - pfTauLTPt) / pfTauLTPt;
          leadTrkDeltaR = ROOT::Math::VectorUtil::DeltaR(thePFTauLeadTrack->momentum(), leadTk->momentum());
          
          //print info in the case where the pftau is isolated but the tauTag is not
          bool l25IsoDisc = theMatchedL25TauTagInfo.discriminator(0.2,0.15,0.5,5.,1.,0,0.2);
          if(pfTauTrkIso <= 1. && l25MatchedToPFTau && !l25IsoDisc) printInfo(thePFTaus->at(pfTauIt), theMatchedL25TauTagInfo);
          
          const TrackRefVector theSignalTracks = theMatchedL25TauTagInfo.tracksInCone(leadTk->momentum(), _signalCone, _minTrackPt);
          const TrackRefVector theIsoTracks = theMatchedL25TauTagInfo.tracksInCone(leadTk->momentum(), _isolationCone, _minTrackPt);
          numQPixTrkInSignalCone = theSignalTracks.size();                                
          if(numQPixTrkInSignalCone > 0) numQPixTrkInAnnulus = theIsoTracks.size() - theSignalTracks.size();
          //get the lead track in isolation 
          float l25LeadIsoPt = 0.;
          Track theL25LeadIsoTrk;
          
          myNtrkIso = 0;
          for(TrackRefVector::const_iterator isoIt = theIsoTracks.begin(); isoIt != theIsoTracks.end(); ++isoIt){
            if(ROOT::Math::VectorUtil::DeltaR(leadTk->momentum(), (*isoIt)->momentum()) <= _signalCone){
          
              l25SignalTrkPt->push_back((*isoIt)->pt());
              l25SignalTrkEta->push_back((*isoIt)->eta());
              l25SignalTrkPhi->push_back((*isoIt)->phi());
              l25SignalTrkDz->push_back((*isoIt)->dz(theVertexPosition));
              l25SignalTrkDxy->push_back((*isoIt)->dxy(theVertexPosition));
              l25SignalTrkChi2->push_back((*isoIt)->chi2());
              l25SignalTrkChi2NdF->push_back((*isoIt)->normalizedChi2());
              l25SignalTrkNRecHits->push_back((*isoIt)->recHitsSize());
              l25SignalTrkNValidHits->push_back((*isoIt)->numberOfValidHits());
              l25SignalTrkNValidPixelHits->push_back((*isoIt)->hitPattern().numberOfValidPixelHits());
              l25SignalTrkNLostHits->push_back((*isoIt)->lost());

            }
            else{
              myNtrkIso++;

              l25IsoTrkPt->push_back((*isoIt)->pt());
              l25IsoTrkChi2NdF->push_back((*isoIt)->normalizedChi2());
              l25IsoTrkChi2->push_back((*isoIt)->chi2());
              l25IsoTrkNValidHits->push_back((*isoIt)->numberOfValidHits());
              l25IsoTrkNRecHits->push_back((*isoIt)->recHitsSize());
              l25IsoTrkNValidPixelHits->push_back((*isoIt)->hitPattern().numberOfValidPixelHits());
              l25IsoTrkNLostHits->push_back((*isoIt)->lost());
              l25IsoTrkDxy->push_back((*isoIt)->dxy(theVertexPosition));
              l25IsoTrkDz->push_back((*isoIt)->dz(theVertexPosition));
              l25IsoTrkEta->push_back((*isoIt)->eta());
              l25IsoTrkPhi->push_back((*isoIt)->phi());
              if((*isoIt)->pt() > l25LeadIsoPt){
                theL25LeadIsoTrk = **isoIt;
                l25LeadIsoPt = (*isoIt)->pt();
              }
            }
          }
          //if((nIsoTraks > numQPixTrkInAnnulus) ? std::cout << "FUCK \n" : std::cout << "GREAT\n" );
          if(thePFTauLeadIsoTrk.pt() != 0) leadIsoTrkPtRes = (theL25LeadIsoTrk.pt() - thePFTauLeadIsoTrk.pt()) /thePFTauLeadIsoTrk.pt();
          leadIsoTrkDeltaR = ROOT::Math::VectorUtil::DeltaR(theL25LeadIsoTrk.momentum(), thePFTauLeadIsoTrk.momentum());
          l25Disc_LeadTkDir = theMatchedL25TauTagInfo.discriminator(leadTk->momentum(), _l25JetLeadTkMacthingCone, _signalCone, _isolationCone, _l25LeadTkPtMin, _minTrackPt, _nTrkIso, _l25Dz);
          l25Disc_JetDir = theMatchedL25TauTagInfo.discriminator(theMatchedL25TauTagInfo.jet()->momentum(), _l25JetLeadTkMacthingCone, _signalCone, _isolationCone, _l25LeadTkPtMin, _minTrackPt, _nTrkIso, _l25Dz);
        }
      }
      //Fill here per pfTau ...
     l25tree->Fill();
     clearVectors();
    }
  }
  else std::cout << "Invalid PFTau Collection\n"; 
}
void L25TauAnalyzer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 550 of file L25TauAnalyzer.cc.

                             {
}
void L25TauAnalyzer::clearVectors ( ) [private]

Definition at line 477 of file L25TauAnalyzer.cc.

                                 {
 l25TrkPt->clear();
 l25TrkEta->clear();
 l25TrkPhi->clear();
 l25TrkDz->clear();
 l25TrkDxy->clear();
 l25TrkChi2->clear();
 l25TrkChi2NdF->clear();
 l25TrkNRecHits->clear();
 l25TrkNValidPixelHits->clear();
 
 l25SignalTrkPt->clear();
 l25SignalTrkEta->clear();
 l25SignalTrkPhi->clear();
 l25SignalTrkDz->clear();
 l25SignalTrkDxy->clear();
 l25SignalTrkChi2NdF->clear();
 l25SignalTrkChi2->clear();
 l25SignalTrkNRecHits->clear();
 l25SignalTrkNValidHits->clear();
 l25SignalTrkNValidPixelHits->clear();
 l25SignalTrkNLostHits->clear();
 
 l25IsoTrkPt->clear();
 l25IsoTrkEta->clear();
 l25IsoTrkPhi->clear();
 l25IsoTrkDz->clear();
 l25IsoTrkDxy->clear();
 l25IsoTrkChi2->clear();
 l25IsoTrkChi2NdF->clear();
 l25IsoTrkNRecHits->clear();
 l25IsoTrkNValidHits->clear();
 l25IsoTrkNValidPixelHits->clear();
 l25IsoTrkNLostHits->clear();
}
void L25TauAnalyzer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 554 of file L25TauAnalyzer.cc.

                            {
}
void L25TauAnalyzer::initializeVectors ( ) [private]
reco::PFTau L25TauAnalyzer::match ( const reco::Jet jet,
const reco::PFTauCollection thePFTauColl 
) [private]

Definition at line 395 of file L25TauAnalyzer.cc.

References delta, and reco::LeafCandidate::p4().

                                                                                          {

  //Loop On the Collection and see if your tau jet is matched to one there
  //Also find the nearest Matched MC Particle to your Jet (to be complete)
  // switch reference collection to pftau;  match to this.
 
 reco::PFTau theMatchedPFTau;
 double matchDr=0.3;
 
 if(thePFTauColl.size()>0)
  for(reco::PFTauCollection::const_iterator it = thePFTauColl.begin(); it != thePFTauColl.end(); ++it){
    double delta = ROOT::Math::VectorUtil::DeltaR(jet.p4(),(*it).p4());          
    if(delta<matchDr){
      matchDr = delta;
      theMatchedPFTau = *it;                                                          
    }                                                                    
  }
  return theMatchedPFTau;
}
reco::CaloJet L25TauAnalyzer::matchedToPFTau ( const reco::PFTau thePFTau,
const reco::L2TauInfoAssociation theL2Info 
) [private]

Definition at line 415 of file L25TauAnalyzer.cc.

References edm::AssociationMap< Tag >::begin(), delta, edm::AssociationMap< Tag >::end(), reco::LeafCandidate::et(), and reco::LeafCandidate::p4().

                                                                                                          {
  double matchDr = 0.5;
  reco::CaloJet theMatchedJet;
  for(L2TauInfoAssociation::const_iterator it = theL2Info.begin(); it != theL2Info.end(); ++it){
    const reco::CaloJet& l2Jet =*(it->key);
    if(l2Jet.et() < 15.) continue;
    double delta = ROOT::Math::VectorUtil::DeltaR(thePFTau.p4(),l2Jet.p4());
    if(delta < matchDr){
      matchDr = delta;
      theMatchedJet = l2Jet;
    }
  }
  return theMatchedJet;
}
void L25TauAnalyzer::printInfo ( const reco::PFTau thePFTau,
const reco::IsolatedTauTagInfo theTauTagInfo 
) [private]

Definition at line 430 of file L25TauAnalyzer.cc.

References edm::RefVector< C, T, F >::begin(), gather_cfg::cout, deltaR(), edm::RefVector< C, T, F >::end(), reco::LeafCandidate::et(), reco::LeafCandidate::eta(), reco::PFTau::isolationPFChargedHadrCands(), reco::JTATagInfo::jet(), reco::IsolatedTauTagInfo::leadingSignalTrack(), reco::PFTau::leadPFChargedHadrCand(), reco::LeafCandidate::phi(), edm::RefVector< C, T, F >::size(), and reco::IsolatedTauTagInfo::tracksInCone().

                                                                                                    {
  const TrackRef theLeadTrack = theTauTagInfo.leadingSignalTrack(_l25JetLeadTkMacthingCone, _minTrackPt);
  const TrackRefVector theSignalTracks = theTauTagInfo.tracksInCone(theLeadTrack->momentum(), _signalCone, _minTrackPt);
  const TrackRefVector theIsoTracks = theTauTagInfo.tracksInCone(theLeadTrack->momentum(), _isolationCone, _minTrackPt);
  
  std::cout << " Isolated PFTau Matched to Non-Isolated L25 Object( PFTau:L25)"
  << "\n Et\t" << thePFTau.et() << "\t" << theTauTagInfo.jet()->et()
  << "\n Eta\t" << thePFTau.eta() << "\t" << theTauTagInfo.jet()->eta()
  << "\n Phi\t" << thePFTau.phi() << "\t" << theTauTagInfo.jet()->phi()
  << "\n LTPt\t" << thePFTau.leadPFChargedHadrCand()->pt() << "\t" << theLeadTrack->pt()
  << "\n LTEta\t" << thePFTau.leadPFChargedHadrCand()->eta() << "\t" << theLeadTrack->eta()
  << "\n LTPhi\t" << thePFTau.leadPFChargedHadrCand()->phi() << "\t" << theLeadTrack->phi()
  << "\n NIso\t" << thePFTau.isolationPFChargedHadrCands().size() << "\t" << theIsoTracks.size() - theSignalTracks.size()
  <<"\n";

  unsigned int nIsoTrk = 0;
  std::cout << " Tracks in L2.5 Iso: (Pt:Eta:Phi:DR:Chi2:Chi2/NdF:PxlHits:dxy:dz)\n";
  for(TrackRefVector::const_iterator isoIt = theIsoTracks.begin(); isoIt != theIsoTracks.end(); ++isoIt){
    double isoTrackLeadTrkDeltaR = deltaR(theLeadTrack->eta(), theLeadTrack->phi(), (*isoIt)->eta(), (*isoIt)->phi());
    if(isoTrackLeadTrkDeltaR > _signalCone){
      nIsoTrk++;
      cout << nIsoTrk 
           << "\t" << (*isoIt)->pt() 
           << "\t" << (*isoIt)->eta() 
           << "\t" << (*isoIt)->phi()
           << "\t" << isoTrackLeadTrkDeltaR 
           << "\t" << (*isoIt)->chi2()
           << "\t" << (*isoIt)->normalizedChi2()
           << "\t" << (*isoIt)->hitPattern().numberOfValidPixelHits()
           << "\t" << (*isoIt)->dxy(theVertexPosition)
           << "\t" << (*isoIt)->dz(theVertexPosition)
           << "\t" << theVertexPosition
           << "\n";
    }
  }
  nIsoTrk = 0;
  std::cout << "Tracks in PFTau Iso: (Pt:Eta:Phi)\n";
  for(PFCandidateRefVector::const_iterator isoIt = thePFTau.isolationPFChargedHadrCands().begin(); 
     isoIt != thePFTau.isolationPFChargedHadrCands().end(); ++isoIt){
    nIsoTrk++;
    cout << nIsoTrk << "\t" 
         << (*isoIt)->pt() << "\t" 
         << (*isoIt)->eta() << "\t" 
         << (*isoIt)->phi() << "\n";
  }
}

Member Data Documentation

Definition at line 82 of file L25TauAnalyzer.h.

float L25TauAnalyzer::_l25Dz [private]

Definition at line 85 of file L25TauAnalyzer.h.

Definition at line 84 of file L25TauAnalyzer.h.

Definition at line 71 of file L25TauAnalyzer.h.

Definition at line 86 of file L25TauAnalyzer.h.

Definition at line 83 of file L25TauAnalyzer.h.

Definition at line 72 of file L25TauAnalyzer.h.

float L25TauAnalyzer::_minTrackPt [private]

Definition at line 80 of file L25TauAnalyzer.h.

int L25TauAnalyzer::_nTrkIso [private]

Definition at line 87 of file L25TauAnalyzer.h.

Definition at line 75 of file L25TauAnalyzer.h.

Definition at line 76 of file L25TauAnalyzer.h.

Definition at line 73 of file L25TauAnalyzer.h.

Definition at line 74 of file L25TauAnalyzer.h.

float L25TauAnalyzer::_signalCone [private]

Definition at line 81 of file L25TauAnalyzer.h.

Definition at line 135 of file L25TauAnalyzer.h.

Definition at line 171 of file L25TauAnalyzer.h.

Definition at line 170 of file L25TauAnalyzer.h.

Definition at line 172 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25IsoTrkChi2 [private]

Definition at line 125 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25IsoTrkChi2NdF [private]

Definition at line 124 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25IsoTrkDxy [private]

Definition at line 126 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25IsoTrkDz [private]

Definition at line 127 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25IsoTrkEta [private]

Definition at line 128 of file L25TauAnalyzer.h.

std::vector<int>* L25TauAnalyzer::l25IsoTrkNLostHits [private]

Definition at line 133 of file L25TauAnalyzer.h.

std::vector<int>* L25TauAnalyzer::l25IsoTrkNRecHits [private]

Definition at line 131 of file L25TauAnalyzer.h.

std::vector<int>* L25TauAnalyzer::l25IsoTrkNValidHits [private]

Definition at line 130 of file L25TauAnalyzer.h.

std::vector<int>* L25TauAnalyzer::l25IsoTrkNValidPixelHits [private]

Definition at line 132 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25IsoTrkPhi [private]

Definition at line 129 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25IsoTrkPt [private]

Definition at line 123 of file L25TauAnalyzer.h.

float L25TauAnalyzer::l25JetEt [private]

Definition at line 97 of file L25TauAnalyzer.h.

float L25TauAnalyzer::l25JetEta [private]

Definition at line 98 of file L25TauAnalyzer.h.

float L25TauAnalyzer::l25JetPhi [private]

Definition at line 99 of file L25TauAnalyzer.h.

Definition at line 168 of file L25TauAnalyzer.h.

Definition at line 166 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25SignalTrkChi2 [private]

Definition at line 113 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25SignalTrkChi2NdF [private]

Definition at line 112 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25SignalTrkDxy [private]

Definition at line 114 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25SignalTrkDz [private]

Definition at line 115 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25SignalTrkEta [private]

Definition at line 116 of file L25TauAnalyzer.h.

std::vector<int>* L25TauAnalyzer::l25SignalTrkNLostHits [private]

Definition at line 121 of file L25TauAnalyzer.h.

std::vector<int>* L25TauAnalyzer::l25SignalTrkNRecHits [private]

Definition at line 119 of file L25TauAnalyzer.h.

std::vector<int>* L25TauAnalyzer::l25SignalTrkNValidHits [private]

Definition at line 118 of file L25TauAnalyzer.h.

std::vector<int>* L25TauAnalyzer::l25SignalTrkNValidPixelHits [private]

Definition at line 120 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25SignalTrkPhi [private]

Definition at line 117 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25SignalTrkPt [private]

Definition at line 111 of file L25TauAnalyzer.h.

TTree* L25TauAnalyzer::l25tree [private]

Definition at line 89 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25TrkChi2 [private]

Definition at line 106 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25TrkChi2NdF [private]

Definition at line 107 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25TrkDxy [private]

Definition at line 105 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25TrkDz [private]

Definition at line 104 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25TrkEta [private]

Definition at line 102 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25TrkNRecHits [private]

Definition at line 108 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25TrkNValidPixelHits [private]

Definition at line 109 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25TrkPhi [private]

Definition at line 103 of file L25TauAnalyzer.h.

std::vector<float>* L25TauAnalyzer::l25TrkPt [private]

Definition at line 101 of file L25TauAnalyzer.h.

float L25TauAnalyzer::l2JetEt [private]

Definition at line 162 of file L25TauAnalyzer.h.

float L25TauAnalyzer::l2JetEta [private]

Definition at line 163 of file L25TauAnalyzer.h.

float L25TauAnalyzer::l2JetPhi [private]

Definition at line 164 of file L25TauAnalyzer.h.

Definition at line 167 of file L25TauAnalyzer.h.

Definition at line 158 of file L25TauAnalyzer.h.

Definition at line 157 of file L25TauAnalyzer.h.

Definition at line 136 of file L25TauAnalyzer.h.

Definition at line 156 of file L25TauAnalyzer.h.

Definition at line 137 of file L25TauAnalyzer.h.

Definition at line 155 of file L25TauAnalyzer.h.

Definition at line 95 of file L25TauAnalyzer.h.

Definition at line 91 of file L25TauAnalyzer.h.

Definition at line 94 of file L25TauAnalyzer.h.

Definition at line 92 of file L25TauAnalyzer.h.

Definition at line 93 of file L25TauAnalyzer.h.

Definition at line 144 of file L25TauAnalyzer.h.

float L25TauAnalyzer::pfTauEt [private]

Definition at line 145 of file L25TauAnalyzer.h.

float L25TauAnalyzer::pfTauEta [private]

Definition at line 147 of file L25TauAnalyzer.h.

Definition at line 152 of file L25TauAnalyzer.h.

Definition at line 140 of file L25TauAnalyzer.h.

Definition at line 141 of file L25TauAnalyzer.h.

Definition at line 142 of file L25TauAnalyzer.h.

Definition at line 160 of file L25TauAnalyzer.h.

Definition at line 154 of file L25TauAnalyzer.h.

Definition at line 138 of file L25TauAnalyzer.h.

float L25TauAnalyzer::pfTauLTPt [private]

Definition at line 149 of file L25TauAnalyzer.h.

Definition at line 143 of file L25TauAnalyzer.h.

Definition at line 150 of file L25TauAnalyzer.h.

Definition at line 153 of file L25TauAnalyzer.h.

float L25TauAnalyzer::pfTauPhi [private]

Definition at line 148 of file L25TauAnalyzer.h.

float L25TauAnalyzer::pfTauPt [private]

Definition at line 146 of file L25TauAnalyzer.h.

Definition at line 159 of file L25TauAnalyzer.h.

float L25TauAnalyzer::pfTauTrkIso [private]

Definition at line 151 of file L25TauAnalyzer.h.

bool L25TauAnalyzer::signal_ [private]

Definition at line 79 of file L25TauAnalyzer.h.

Definition at line 77 of file L25TauAnalyzer.h.