CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

HLTTauRefProducer Class Reference

#include <HLTTauRefProducer.h>

Inheritance diagram for HLTTauRefProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 HLTTauRefProducer (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~HLTTauRefProducer ()

Private Types

typedef math::XYZTLorentzVectorD LorentzVector
typedef std::vector
< LorentzVector
LorentzVectorCollection

Private Member Functions

void doElectrons (edm::Event &, const edm::EventSetup &)
void doElectronsFromZ (edm::Event &, const edm::EventSetup &, std::auto_ptr< LorentzVectorCollection > &)
void doJets (edm::Event &, const edm::EventSetup &)
void doMuons (edm::Event &, const edm::EventSetup &)
void doPFTaus (edm::Event &, const edm::EventSetup &)
void doPhotons (edm::Event &, const edm::EventSetup &)
void doTowers (edm::Event &, const edm::EventSetup &)
double ElectronTrkIsolation (const reco::TrackCollection *, const reco::GsfElectron &)

Private Attributes

bool doElecFromZ_
bool doElectrons_
bool doJets_
bool doMuons_
bool doPFTaus_
bool doPhotons_
bool doTowers_
edm::InputTag e_ctfTrackCollection_
bool e_doID_
bool e_doTrackIso_
double e_FromZet_
edm::InputTag e_idAssocProd_
double e_isoMaxSumPt_
double e_lipCut_
double e_maxIsoDR_
double e_minIsoDR_
double e_trackMinPt_
double e_zMmax_
double e_zMmin_
edm::InputTag Electrons_
double etaMax
edm::InputTag Jets_
edm::InputTag Muons_
std::vector< edm::InputTagPFTauDis_
edm::InputTag PFTaus_
double photonEcalIso_
edm::InputTag Photons_
double ptMinElectron_
double ptMinJet_
double ptMinMuon_
double ptMinPFTau_
double ptMinPhoton_
double ptMinTower_
double towerIsol_
edm::InputTag Towers_

Detailed Description

Definition at line 48 of file HLTTauRefProducer.h.


Member Typedef Documentation

Definition at line 57 of file HLTTauRefProducer.h.

Definition at line 58 of file HLTTauRefProducer.h.


Constructor & Destructor Documentation

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

Definition at line 33 of file HLTTauRefProducer.cc.

References HI_PhotonSkim_cff::electrons, jptDQMConfig_cff::etaMax, edm::ParameterSet::getUntrackedParameter(), analyzePatCleaning_cfg::jets, patZpeak::muons, and interactiveExample::photons.

{

 
  //One Parameter Set per Collection

  ParameterSet pfTau = iConfig.getUntrackedParameter<edm::ParameterSet>("PFTaus");
  PFTaus_ = pfTau.getUntrackedParameter<InputTag>("PFTauProducer");
  PFTauDis_ = pfTau.getUntrackedParameter<std::vector<InputTag> >("PFTauDiscriminators");
  doPFTaus_ = pfTau.getUntrackedParameter<bool>("doPFTaus",false);
  ptMinPFTau_= pfTau.getUntrackedParameter<double>("ptMin",15.);

  ParameterSet  electrons = iConfig.getUntrackedParameter<edm::ParameterSet>("Electrons");
  Electrons_ = electrons.getUntrackedParameter<InputTag>("ElectronCollection");
  doElectrons_ = electrons.getUntrackedParameter<bool>("doElectrons",false);
  e_idAssocProd_ = electrons.getUntrackedParameter<InputTag>("IdCollection");
  e_ctfTrackCollection_= electrons.getUntrackedParameter<InputTag>("TrackCollection");
  ptMinElectron_= electrons.getUntrackedParameter<double>("ptMin",15.);
  e_doID_ = electrons.getUntrackedParameter<bool>("doID",false);
  e_doTrackIso_ = electrons.getUntrackedParameter<bool>("doTrackIso",false);
  e_trackMinPt_= electrons.getUntrackedParameter<double>("ptMinTrack",1.5);
  e_lipCut_= electrons.getUntrackedParameter<double>("lipMinTrack",1.5);
  e_minIsoDR_= electrons.getUntrackedParameter<double>("InnerConeDR",0.02);
  e_maxIsoDR_= electrons.getUntrackedParameter<double>("OuterConeDR",0.6);
  e_isoMaxSumPt_= electrons.getUntrackedParameter<double>("MaxIsoVar",0.02);

  ParameterSet  muons = iConfig.getUntrackedParameter<edm::ParameterSet>("Muons");
  Muons_ = muons.getUntrackedParameter<InputTag>("MuonCollection");
  doMuons_ = muons.getUntrackedParameter<bool>("doMuons",false);
  ptMinMuon_= muons.getUntrackedParameter<double>("ptMin",15.);

  ParameterSet  jets = iConfig.getUntrackedParameter<edm::ParameterSet>("Jets");
  Jets_ = jets.getUntrackedParameter<InputTag>("JetCollection");
  doJets_ = jets.getUntrackedParameter<bool>("doJets");
  ptMinJet_= jets.getUntrackedParameter<double>("etMin");

  ParameterSet  towers = iConfig.getUntrackedParameter<edm::ParameterSet>("Towers");
  Towers_ = towers.getUntrackedParameter<InputTag>("TowerCollection");
  doTowers_ = towers.getUntrackedParameter<bool>("doTowers");
  ptMinTower_= towers.getUntrackedParameter<double>("etMin");
  towerIsol_= towers.getUntrackedParameter<double>("towerIsolation");

  ParameterSet  photons = iConfig.getUntrackedParameter<edm::ParameterSet>("Photons");
  Photons_ = photons.getUntrackedParameter<InputTag>("PhotonCollection");
  doPhotons_ = photons.getUntrackedParameter<bool>("doPhotons");
  ptMinPhoton_= photons.getUntrackedParameter<double>("etMin");
  photonEcalIso_= photons.getUntrackedParameter<double>("ECALIso");


  etaMax = iConfig.getUntrackedParameter<double>("EtaMax",2.5);
  

  //recoCollections
  produces<LorentzVectorCollection>("PFTaus");
  produces<LorentzVectorCollection>("Electrons");
  produces<LorentzVectorCollection>("Muons");
  produces<LorentzVectorCollection>("Jets");
  produces<LorentzVectorCollection>("Photons");
  produces<LorentzVectorCollection>("Towers");

}
HLTTauRefProducer::~HLTTauRefProducer ( )

Definition at line 95 of file HLTTauRefProducer.cc.

{ }

Member Function Documentation

void HLTTauRefProducer::doElectrons ( edm::Event iEvent,
const edm::EventSetup iES 
) [private]

Definition at line 147 of file HLTTauRefProducer.cc.

References HI_PhotonSkim_cff::electrons, relval_parameters_module::energy, eta(), jptDQMConfig_cff::etaMax, edm::Event::getByLabel(), i, xuti::id_tag(), edm::HandleBase::isValid(), edm::Handle< T >::product(), edm::Event::put(), and mathSSE::sqrt().

{
  auto_ptr<LorentzVectorCollection> product_Electrons(new LorentzVectorCollection);
  //Retrieve the collections
  
  edm::Handle<reco::ElectronIDAssociationCollection> pEleID;
  if(e_doID_){//UGLY HACK UNTIL GET ELETRON ID WORKING IN 210
   
      iEvent.getByLabel(e_idAssocProd_,pEleID);
    
    if (!pEleID.isValid()){
      edm::LogInfo("")<< "Error! Can't get electronIDAssocProducer by label. ";
      e_doID_ = false;
    }
  }
  edm::Handle<reco::TrackCollection> pCtfTracks;
  iEvent.getByLabel(e_ctfTrackCollection_, pCtfTracks);
  if (!pCtfTracks.isValid()) {
  edm::LogInfo("")<< "Error! Can't get " << e_ctfTrackCollection_.label() << " by label. ";
  iEvent.put(product_Electrons,"Electrons"); 
  return;
  }
  const reco::TrackCollection * ctfTracks = pCtfTracks.product();
  edm::Handle<GsfElectronCollection> electrons;
  if(iEvent.getByLabel(Electrons_,electrons))
    for(size_t i=0;i<electrons->size();++i)
      {
        edm::Ref<reco::GsfElectronCollection> electronRef(electrons,i);
        bool idDec=false;
        if(e_doID_){
          reco::ElectronIDAssociationCollection::const_iterator tagIDAssocItr;
          tagIDAssocItr = pEleID->find(electronRef);
          const reco::ElectronIDRef& id_tag = tagIDAssocItr->val;
          idDec=id_tag->cutBasedDecision();
        }else idDec=true;
        if((*electrons)[i].pt()>ptMinElectron_&&fabs((*electrons)[i].eta())<etaMax&&idDec)
          {
            if(e_doTrackIso_){
              reco::TrackCollection::const_iterator tr = ctfTracks->begin();
              double sum_of_pt_ele=0;
              for(;tr != ctfTracks->end();++tr)
                {
                  double lip = (*electrons)[i].gsfTrack()->dz() - tr->dz();
                  if(tr->pt() > e_trackMinPt_ && fabs(lip) < e_lipCut_){
                    double dphi=fabs(tr->phi()-(*electrons)[i].trackMomentumAtVtx().phi());
                    if(dphi>acos(-1.))dphi=2*acos(-1.)-dphi;
                    double deta=fabs(tr->eta()-(*electrons)[i].trackMomentumAtVtx().eta());
                    double dr_ctf_ele = sqrt(deta*deta+dphi*dphi);
                    if((dr_ctf_ele>e_minIsoDR_) && (dr_ctf_ele<e_maxIsoDR_)){
                      double cft_pt_2 = (tr->pt())*(tr->pt());
                      sum_of_pt_ele += cft_pt_2;
                    }
                  }
                }
              double isolation_value_ele = sum_of_pt_ele/((*electrons)[i].trackMomentumAtVtx().Rho()*(*electrons)[i].trackMomentumAtVtx().Rho());
              if(isolation_value_ele<e_isoMaxSumPt_){
                LorentzVector vec((*electrons)[i].px(),(*electrons)[i].py(),(*electrons)[i].pz(),(*electrons)[i].energy());
                product_Electrons->push_back(vec);
              } 
              
            }
            else{ 
              LorentzVector vec((*electrons)[i].px(),(*electrons)[i].py(),(*electrons)[i].pz(),(*electrons)[i].energy());
              product_Electrons->push_back(vec);
            }
          }
      }
  
  iEvent.put(product_Electrons,"Electrons"); 
}
void HLTTauRefProducer::doElectronsFromZ ( edm::Event ,
const edm::EventSetup ,
std::auto_ptr< LorentzVectorCollection > &   
) [private]
void HLTTauRefProducer::doJets ( edm::Event iEvent,
const edm::EventSetup iES 
) [private]

Definition at line 243 of file HLTTauRefProducer.cc.

References relval_parameters_module::energy, eta(), jptDQMConfig_cff::etaMax, edm::Event::getByLabel(), i, analyzePatCleaning_cfg::jets, and edm::Event::put().

{
      auto_ptr<LorentzVectorCollection> product_Jets(new LorentzVectorCollection);
      //Retrieve the collection
      edm::Handle<CaloJetCollection> jets;
      if(iEvent.getByLabel(Jets_,jets))
      for(size_t i = 0 ;i<jets->size();++i)
        {
             if((*jets)[i].et()>ptMinJet_&&fabs((*jets)[i].eta())<etaMax)
              {
                LorentzVector vec((*jets)[i].px(),(*jets)[i].py(),(*jets)[i].pz(),(*jets)[i].energy());
                product_Jets->push_back(vec);
              }
        }
      iEvent.put(product_Jets,"Jets");
}
void HLTTauRefProducer::doMuons ( edm::Event iEvent,
const edm::EventSetup iES 
) [private]

Definition at line 219 of file HLTTauRefProducer.cc.

References relval_parameters_module::energy, eta(), jptDQMConfig_cff::etaMax, edm::Event::getByLabel(), i, patZpeak::muons, and edm::Event::put().

{
  auto_ptr<LorentzVectorCollection> product_Muons(new LorentzVectorCollection);
  //Retrieve the collection
  edm::Handle<MuonCollection> muons;
      if(iEvent.getByLabel(Muons_,muons))
   
      for(size_t i = 0 ;i<muons->size();++i)
        {
         
            if((*muons)[i].pt()>ptMinMuon_&&fabs((*muons)[i].eta())<etaMax)
              {
                LorentzVector vec((*muons)[i].px(),(*muons)[i].py(),(*muons)[i].pz(),(*muons)[i].energy());
                product_Muons->push_back(vec);
              }
        }


      iEvent.put(product_Muons,"Muons");
 
}
void HLTTauRefProducer::doPFTaus ( edm::Event iEvent,
const edm::EventSetup iES 
) [private]

Definition at line 115 of file HLTTauRefProducer.cc.

References relval_parameters_module::energy, eta(), jptDQMConfig_cff::etaMax, edm::Event::getByLabel(), i, j, and edm::Event::put().

{
      auto_ptr<LorentzVectorCollection> product_PFTaus(new LorentzVectorCollection);
      //Retrieve the collection
      edm::Handle<PFTauCollection> pftaus;
      if(iEvent.getByLabel(PFTaus_,pftaus))
        {
          for(unsigned int i=0;i<pftaus->size();++i)
            if((*pftaus)[i].pt()>ptMinPFTau_&&fabs((*pftaus)[i].eta())<etaMax)
              {
                reco::PFTauRef thePFTau(pftaus,i);
                for(unsigned int j=0;j<PFTauDis_.size();++j)
                {
                  edm::Handle<PFTauDiscriminator> pftaudis;
                  if(iEvent.getByLabel(PFTauDis_[j],pftaudis))
                    {
                      if((*pftaudis)[thePFTau]>0.5)
                        {
                          LorentzVector vec((*pftaus)[i].px(),(*pftaus)[i].py(),(*pftaus)[i].pz(),(*pftaus)[i].energy());
                          product_PFTaus->push_back(vec);
                        }
                    }
                }
              }
        }

      iEvent.put(product_PFTaus,"PFTaus");
      
}
void HLTTauRefProducer::doPhotons ( edm::Event iEvent,
const edm::EventSetup iES 
) [private]

Definition at line 291 of file HLTTauRefProducer.cc.

References relval_parameters_module::energy, eta(), jptDQMConfig_cff::etaMax, edm::Event::getByLabel(), i, interactiveExample::photons, and edm::Event::put().

{
      auto_ptr<LorentzVectorCollection> product_Gammas(new LorentzVectorCollection);
      //Retrieve the collection
      edm::Handle<PhotonCollection> photons;
      if(iEvent.getByLabel(Photons_,photons))
      for(size_t i = 0 ;i<photons->size();++i)
        if((*photons)[i].ecalRecHitSumEtConeDR04()<photonEcalIso_)
        {
             if((*photons)[i].et()>ptMinPhoton_&&fabs((*photons)[i].eta())<etaMax)
              {
                LorentzVector vec((*photons)[i].px(),(*photons)[i].py(),(*photons)[i].pz(),(*photons)[i].energy());
                product_Gammas->push_back(vec);
              }
        }
      iEvent.put(product_Gammas,"Photons");
}
void HLTTauRefProducer::doTowers ( edm::Event iEvent,
const edm::EventSetup iES 
) [private]

Definition at line 261 of file HLTTauRefProducer.cc.

References relval_parameters_module::energy, eta(), jptDQMConfig_cff::etaMax, edm::Event::getByLabel(), i, j, p4, and edm::Event::put().

{
      auto_ptr<LorentzVectorCollection> product_Towers(new LorentzVectorCollection);
      //Retrieve the collection
      edm::Handle<CaloTowerCollection> towers;
      if(iEvent.getByLabel(Towers_,towers))
      for(size_t i = 0 ;i<towers->size();++i)
        {
             if((*towers)[i].pt()>ptMinTower_&&fabs((*towers)[i].eta())<etaMax)
              {
                //calculate isolation
                double isolET=0;
                for(unsigned int j=0;j<towers->size();++j)
                  {
                    if(ROOT::Math::VectorUtil::DeltaR((*towers)[i].p4(),(*towers)[j].p4())<0.5)
                      isolET+=(*towers)[j].pt();
                  }
                isolET-=(*towers)[i].pt();
                if(isolET<towerIsol_)
                  {
                    LorentzVector vec((*towers)[i].px(),(*towers)[i].py(),(*towers)[i].pz(),(*towers)[i].energy());
                    product_Towers->push_back(vec);
                  }
              }
        }
      iEvent.put(product_Towers,"Towers");
}
double HLTTauRefProducer::ElectronTrkIsolation ( const reco::TrackCollection ,
const reco::GsfElectron  
) [private]
void HLTTauRefProducer::produce ( edm::Event iEvent,
const edm::EventSetup iES 
) [virtual]

Implements edm::EDProducer.

Definition at line 97 of file HLTTauRefProducer.cc.

{
  if(doPFTaus_)
    doPFTaus(iEvent,iES);
  if(doElectrons_)
    doElectrons(iEvent,iES);
  if(doMuons_)
    doMuons(iEvent,iES);
  if(doJets_)
    doJets(iEvent,iES);
  if(doPhotons_)
    doPhotons(iEvent,iES);
  if(doTowers_)
    doTowers(iEvent,iES);

}

Member Data Documentation

Definition at line 78 of file HLTTauRefProducer.h.

Definition at line 67 of file HLTTauRefProducer.h.

Definition at line 94 of file HLTTauRefProducer.h.

Definition at line 89 of file HLTTauRefProducer.h.

Definition at line 62 of file HLTTauRefProducer.h.

Definition at line 83 of file HLTTauRefProducer.h.

Definition at line 98 of file HLTTauRefProducer.h.

Definition at line 69 of file HLTTauRefProducer.h.

Definition at line 71 of file HLTTauRefProducer.h.

Definition at line 72 of file HLTTauRefProducer.h.

Definition at line 80 of file HLTTauRefProducer.h.

Definition at line 68 of file HLTTauRefProducer.h.

Definition at line 77 of file HLTTauRefProducer.h.

double HLTTauRefProducer::e_lipCut_ [private]

Definition at line 74 of file HLTTauRefProducer.h.

Definition at line 76 of file HLTTauRefProducer.h.

Definition at line 75 of file HLTTauRefProducer.h.

Definition at line 73 of file HLTTauRefProducer.h.

double HLTTauRefProducer::e_zMmax_ [private]

Definition at line 79 of file HLTTauRefProducer.h.

double HLTTauRefProducer::e_zMmin_ [private]

Definition at line 79 of file HLTTauRefProducer.h.

Definition at line 66 of file HLTTauRefProducer.h.

double HLTTauRefProducer::etaMax [private]

Definition at line 102 of file HLTTauRefProducer.h.

Definition at line 93 of file HLTTauRefProducer.h.

Definition at line 88 of file HLTTauRefProducer.h.

Definition at line 61 of file HLTTauRefProducer.h.

Definition at line 60 of file HLTTauRefProducer.h.

Definition at line 84 of file HLTTauRefProducer.h.

Definition at line 82 of file HLTTauRefProducer.h.

Definition at line 70 of file HLTTauRefProducer.h.

double HLTTauRefProducer::ptMinJet_ [private]

Definition at line 95 of file HLTTauRefProducer.h.

Definition at line 90 of file HLTTauRefProducer.h.

Definition at line 63 of file HLTTauRefProducer.h.

Definition at line 85 of file HLTTauRefProducer.h.

Definition at line 99 of file HLTTauRefProducer.h.

Definition at line 100 of file HLTTauRefProducer.h.

Definition at line 97 of file HLTTauRefProducer.h.