CMS 3D CMS Logo

Public Member Functions | Private Attributes

PFRecoTauProducer Class Reference

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

List of all members.

Public Member Functions

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

Private Attributes

std::string Algorithm_
edm::InputTag ElectronPreIDProducer_
double JetMinPt_
PFRecoTauAlgorithmBasePFRecoTauAlgo_
edm::InputTag PFTauTagInfoProducer_
edm::InputTag PVProducer_
double smearedPVsigmaX_
double smearedPVsigmaY_
double smearedPVsigmaZ_

Detailed Description

Definition at line 34 of file PFRecoTauProducer.cc.


Constructor & Destructor Documentation

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

Definition at line 52 of file PFRecoTauProducer.cc.

References Exception, and edm::ParameterSet::getParameter().

                                                                  {
  PFTauTagInfoProducer_   = iConfig.getParameter<edm::InputTag>("PFTauTagInfoProducer");
  ElectronPreIDProducer_  = iConfig.getParameter<edm::InputTag>("ElectronPreIDProducer");
  PVProducer_             = iConfig.getParameter<edm::InputTag>("PVProducer");
  Algorithm_              = iConfig.getParameter<std::string>("Algorithm");
  smearedPVsigmaX_        = iConfig.getParameter<double>("smearedPVsigmaX");
  smearedPVsigmaY_        = iConfig.getParameter<double>("smearedPVsigmaY");
  smearedPVsigmaZ_        = iConfig.getParameter<double>("smearedPVsigmaZ");    
  JetMinPt_               = iConfig.getParameter<double>("JetPtMin");

  if(Algorithm_ =="ConeBased") {
    PFRecoTauAlgo_=new PFRecoTauAlgorithm(iConfig);
  }
  else if(Algorithm_ =="HPS") {
    PFRecoTauAlgo_=new HPSPFRecoTauAlgorithm(iConfig);
  }
  else {    //Add inside out Algorithm here

    //If no Algorithm found throw exception
    throw cms::Exception("") << "Unknown Algorithkm" << std::endl;
  }
    

  produces<PFTauCollection>();      
}
PFRecoTauProducer::~PFRecoTauProducer ( )

Definition at line 77 of file PFRecoTauProducer.cc.

                                     {
  delete PFRecoTauAlgo_;
}

Member Function Documentation

void PFRecoTauProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 81 of file PFRecoTauProducer.cc.

References edm::EventSetup::get(), edm::Event::getByLabel(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), and edm::Event::put().

                                                                           {
  auto_ptr<PFTauCollection> resultPFTau(new PFTauCollection);
  
  edm::ESHandle<TransientTrackBuilder> myTransientTrackBuilder;
  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",myTransientTrackBuilder);
  PFRecoTauAlgo_->setTransientTrackBuilder(myTransientTrackBuilder.product());

  //edm::ESHandle<MagneticField> myMF;
  //iSetup.get<IdealMagneticFieldRecord>().get(myMF);
  //PFRecoTauAlgo_->setMagneticField(myMF.product());

  // Electron PreID tracks: Temporary until integrated to PFCandidate
  /*
  edm::Handle<PFRecTrackCollection> myPFelecTk; 
  iEvent.getByLabel(ElectronPreIDProducer_,myPFelecTk); 
  const PFRecTrackCollection theElecTkCollection=*(myPFelecTk.product()); 
  */
  // query a rec/sim PV
  edm::Handle<VertexCollection> thePVs;
  iEvent.getByLabel(PVProducer_,thePVs);
  const VertexCollection vertCollection=*(thePVs.product());
  Vertex thePV;
  if(vertCollection.size()) thePV=*(vertCollection.begin());
  else{
    Vertex::Error SimPVError;
    SimPVError(0,0)=smearedPVsigmaX_*smearedPVsigmaX_;
    SimPVError(1,1)=smearedPVsigmaY_*smearedPVsigmaY_;
    SimPVError(2,2)=smearedPVsigmaZ_*smearedPVsigmaZ_;
    Vertex::Point SimPVPoint(CLHEP::RandGauss::shoot(0.,smearedPVsigmaX_),  
                             CLHEP::RandGauss::shoot(0.,smearedPVsigmaY_),  
                             CLHEP::RandGauss::shoot(0.,smearedPVsigmaZ_));
    thePV=Vertex(SimPVPoint,SimPVError,1,1,1);    
  }
  
  edm::Handle<PFTauTagInfoCollection> thePFTauTagInfoCollection;
  iEvent.getByLabel(PFTauTagInfoProducer_,thePFTauTagInfoCollection);
  int iinfo=0;
  for(PFTauTagInfoCollection::const_iterator i_info=thePFTauTagInfoCollection->begin();i_info!=thePFTauTagInfoCollection->end();i_info++) { 
    if((*i_info).pfjetRef()->pt()>JetMinPt_){
      //        PFTau myPFTau=PFRecoTauAlgo_->buildPFTau(Ref<PFTauTagInfoCollection>(thePFTauTagInfoCollection,iinfo),thePV,theElecTkCollection);
        PFTau myPFTau=PFRecoTauAlgo_->buildPFTau(Ref<PFTauTagInfoCollection>(thePFTauTagInfoCollection,iinfo),thePV);
       resultPFTau->push_back(myPFTau);
    }
    ++iinfo;
  }
  iEvent.put(resultPFTau);
}

Member Data Documentation

std::string PFRecoTauProducer::Algorithm_ [private]

Definition at line 43 of file PFRecoTauProducer.cc.

Definition at line 41 of file PFRecoTauProducer.cc.

double PFRecoTauProducer::JetMinPt_ [private]

Definition at line 47 of file PFRecoTauProducer.cc.

Definition at line 48 of file PFRecoTauProducer.cc.

Definition at line 40 of file PFRecoTauProducer.cc.

Definition at line 42 of file PFRecoTauProducer.cc.

Definition at line 44 of file PFRecoTauProducer.cc.

Definition at line 45 of file PFRecoTauProducer.cc.

Definition at line 46 of file PFRecoTauProducer.cc.