CMS 3D CMS Logo

Public Member Functions | Private Attributes

ConeIsolation Class Reference

#include <RecoBTag/ConeIsolation/src/ConeIsolation.cc>

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

List of all members.

Public Member Functions

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

Private Attributes

edm::InputTag beamSpotProducer
edm::InputTag jetTrackSrc
ConeIsolationAlgorithmm_algo
bool usingBeamSpot
bool usingVertex
edm::InputTag vertexSrc

Detailed Description

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

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

EDProducer of the tagged TauJet with the ConeIsolationAlgorithm. It returns two collections: base collection is the JetTag, and extended Collection which is the IsolatedTauTagInfo. The method implemented in the IsolatedTauTagInfo class are used to compute the discriminator variable. A trick is used to link the IsolatedTauTagInfo to a smart reference to the JetTag.

Revision:
1.2
Author:
Simone Gennai

Definition at line 24 of file ConeIsolation.h.


Constructor & Destructor Documentation

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

Definition at line 52 of file ConeIsolation.cc.

References edm::ParameterSet::getParameter(), and HLTFastRecoForTau_cff::vertexSrc.

{
  jetTrackSrc = iConfig.getParameter<InputTag>("JetTrackSrc");
  vertexSrc = iConfig.getParameter<InputTag>("vertexSrc");
  usingVertex = iConfig.getParameter<bool>("useVertex");
  usingBeamSpot = iConfig.getParameter<bool>("useBeamSpot"); //If false the OfflinePrimaryVertex will be used.
  beamSpotProducer = iConfig.getParameter<edm::InputTag>("BeamSpotProducer");
  m_algo = new ConeIsolationAlgorithm(iConfig);
  
  produces<reco::JetTagCollection>(); 
   produces<reco::IsolatedTauTagInfoCollection>();       



}
ConeIsolation::~ConeIsolation ( )

Definition at line 69 of file ConeIsolation.cc.

{
  delete m_algo;
}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 81 of file ConeIsolation.cc.

References reco::Vertex::chi2(), alignCSCRings::e, reco::Vertex::error(), edm::Event::getByLabel(), i, reco::Vertex::ndof(), AlCaHLTBitMon_ParallelJobs::p, parseEventContent::prod, edm::Event::put(), reco::Vertex::tracksSize(), HLTFastRecoForTau_cff::vertexSrc, and reco::Vertex::z().

{
   using namespace edm;
   //Get jets with tracks
   Handle<reco::JetTracksAssociationCollection> jetTracksAssociation;
   iEvent.getByLabel(jetTrackSrc,jetTracksAssociation);

   std::auto_ptr<reco::JetTagCollection>             tagCollection;
   std::auto_ptr<reco::IsolatedTauTagInfoCollection> extCollection( new reco::IsolatedTauTagInfoCollection() );
if (not jetTracksAssociation->empty()) {
     RefToBaseProd<reco::Jet> prod( jetTracksAssociation->begin()->first );
     tagCollection.reset( new reco::JetTagCollection(prod) );
   } else {
     tagCollection.reset( new reco::JetTagCollection() );
   }

   Vertex::Error e;
   e(0,0)=1;
   e(1,1)=1;
   e(2,2)=1;
   Vertex::Point p(0,0,-1000);
   Vertex myPVtmp(p,e);//Fake vertex to be used in case no vertex is found
   Vertex myPV;

   //Get pixel vertices
   Handle<reco::VertexCollection> vertices;
   iEvent.getByLabel(vertexSrc,vertices);
   const reco::VertexCollection vertCollection = *(vertices.product());
   //Check if there is the PV!!!!
   if(vertCollection.begin() != vertCollection.end())
     myPVtmp = *(vertCollection.begin());

   //In case the beam spot is used, the Z of the vertex still comes from the PV, while the (x,y) is taken from the beamspot
   reco::BeamSpot vertexBeamSpot;
   edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
   
   if(usingBeamSpot)
     {
       //Create a new vertex with the information on x0 and Y0 from the beamspot, to be used in HLT.
       iEvent.getByLabel(beamSpotProducer,recoBeamSpotHandle);
       vertexBeamSpot = *recoBeamSpotHandle;
       Vertex::Point bspoint(vertexBeamSpot.x0(),vertexBeamSpot.y0(),myPVtmp.z());
       Vertex combinedVertex = Vertex(bspoint,myPVtmp.error(),myPVtmp.chi2(),myPVtmp.ndof(),myPVtmp.tracksSize());
       myPV = combinedVertex;
         }else{
           myPV = myPVtmp;
         }
   
   for (unsigned int i = 0; i < jetTracksAssociation->size(); ++i)
     {
       pair<float,IsolatedTauTagInfo> myPair =m_algo->tag(edm::Ref<JetTracksAssociationCollection>(jetTracksAssociation,i),myPV); 
       tagCollection->setValue(i, myPair.first);
       extCollection->push_back(myPair.second);
     }

   iEvent.put(extCollection);
   iEvent.put(tagCollection);

}

Member Data Documentation

Definition at line 36 of file ConeIsolation.h.

Definition at line 33 of file ConeIsolation.h.

Definition at line 32 of file ConeIsolation.h.

Definition at line 37 of file ConeIsolation.h.

Definition at line 35 of file ConeIsolation.h.

Definition at line 34 of file ConeIsolation.h.