CMS 3D CMS Logo

Public Member Functions | Private Attributes

CaloRecoTauProducer Class Reference

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

List of all members.

Public Member Functions

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

Private Attributes

CaloRecoTauAlgorithmCaloRecoTauAlgo_
edm::InputTag CaloRecoTauTagInfoProducer_
double JetMinPt_
edm::InputTag PVProducer_
double smearedPVsigmaX_
double smearedPVsigmaY_
double smearedPVsigmaZ_

Detailed Description

Definition at line 34 of file CaloRecoTauProducer.cc.


Constructor & Destructor Documentation

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

Definition at line 49 of file CaloRecoTauProducer.cc.

References edm::ParameterSet::getParameter().

                                                                      {
  CaloRecoTauTagInfoProducer_  = iConfig.getParameter<edm::InputTag>("CaloRecoTauTagInfoProducer");
  PVProducer_                  = iConfig.getParameter<edm::InputTag>("PVProducer");
  smearedPVsigmaX_             = iConfig.getParameter<double>("smearedPVsigmaX");
  smearedPVsigmaY_             = iConfig.getParameter<double>("smearedPVsigmaY");
  smearedPVsigmaZ_             = iConfig.getParameter<double>("smearedPVsigmaZ");       
  JetMinPt_                    = iConfig.getParameter<double>("JetPtMin");
  CaloRecoTauAlgo_=new CaloRecoTauAlgorithm(iConfig);
  produces<CaloTauCollection>();
  produces<DetIdCollection>();
}
CaloRecoTauProducer::~CaloRecoTauProducer ( )

Definition at line 60 of file CaloRecoTauProducer.cc.

                                         {
  delete CaloRecoTauAlgo_;
}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 64 of file CaloRecoTauProducer.cc.

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

                                                                             {

  auto_ptr<CaloTauCollection> resultCaloTau(new CaloTauCollection);
  auto_ptr<DetIdCollection> selectedDetIds(new DetIdCollection);
 
  edm::ESHandle<TransientTrackBuilder> myTransientTrackBuilder;
  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",myTransientTrackBuilder);
  CaloRecoTauAlgo_->setTransientTrackBuilder(myTransientTrackBuilder.product());
  
  edm::ESHandle<MagneticField> myMF;
  iSetup.get<IdealMagneticFieldRecord>().get(myMF);
  CaloRecoTauAlgo_->setMagneticField(myMF.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<CaloTauTagInfoCollection> theCaloTauTagInfoCollection;
  iEvent.getByLabel(CaloRecoTauTagInfoProducer_,theCaloTauTagInfoCollection);
  int iinfo=0;
  for(CaloTauTagInfoCollection::const_iterator i_info=theCaloTauTagInfoCollection->begin();i_info!=theCaloTauTagInfoCollection->end();i_info++) { 
    if(i_info->jetRef()->pt()>JetMinPt_){ 
      CaloTau myCaloTau=CaloRecoTauAlgo_->buildCaloTau(iEvent,iSetup,Ref<CaloTauTagInfoCollection>(theCaloTauTagInfoCollection,iinfo),thePV);
      resultCaloTau->push_back(myCaloTau);
    }
    ++iinfo;
  }
  for(unsigned int i =0;i<CaloRecoTauAlgo_->mySelectedDetId_.size();i++)
    selectedDetIds->push_back(CaloRecoTauAlgo_->mySelectedDetId_[i]);


   iEvent.put(resultCaloTau);
  iEvent.put(selectedDetIds);
}

Member Data Documentation

Definition at line 46 of file CaloRecoTauProducer.cc.

Definition at line 40 of file CaloRecoTauProducer.cc.

Definition at line 45 of file CaloRecoTauProducer.cc.

Definition at line 41 of file CaloRecoTauProducer.cc.

Definition at line 42 of file CaloRecoTauProducer.cc.

Definition at line 43 of file CaloRecoTauProducer.cc.

Definition at line 44 of file CaloRecoTauProducer.cc.