CMS 3D CMS Logo

Public Member Functions | Private Attributes

ImpactParameter Class Reference

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

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

List of all members.

Public Member Functions

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

Private Attributes

ImpactParameterAlgorithmalgo
std::string jetTrackSrc
bool usingVertex
std::string vertexSrc

Detailed Description

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

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

Definition at line 13 of file ImpactParameter.h.


Constructor & Destructor Documentation

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

Definition at line 47 of file ImpactParameter.cc.

References algo, edm::ParameterSet::getParameter(), jetTrackSrc, usingVertex, and vertexSrc.

                                                               {

        jetTrackSrc = iConfig.getParameter<std::string>("JetTagProd");
        vertexSrc   = iConfig.getParameter<std::string>("vertexSrc");
        usingVertex = iConfig.getParameter<bool>("useVertex");

        algo = new ImpactParameterAlgorithm(iConfig);

        std::string modulname = iConfig.getParameter<std::string>( "@module_label" );
        produces<reco::JetTagCollection>().setBranchAlias(modulname);
        std::string infoBranchName = modulname + "Info";
        produces<reco::TauImpactParameterInfoCollection>().setBranchAlias(infoBranchName);
}
ImpactParameter::~ImpactParameter ( )

Definition at line 62 of file ImpactParameter.cc.

References algo.

                                 {
        delete algo;
}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 72 of file ImpactParameter.cc.

References algo, alignCSCRings::e, edm::EventSetup::get(), edm::Event::getByLabel(), i, jetTrackSrc, AlCaHLTBitMon_ParallelJobs::p, parseEventContent::prod, edm::Handle< T >::product(), edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, ImpactParameterAlgorithm::setTransientTrackBuilder(), ImpactParameterAlgorithm::tag(), usingVertex, and vertexSrc.

                                                                          {

        using namespace reco;

        edm::Handle<IsolatedTauTagInfoCollection> isolatedTaus;
        iEvent.getByLabel(jetTrackSrc,isolatedTaus);

        std::auto_ptr<JetTagCollection>                 tagCollection;
        std::auto_ptr<TauImpactParameterInfoCollection> extCollection( new TauImpactParameterInfoCollection() );
        if (not isolatedTaus->empty()) {
          edm::RefToBaseProd<reco::Jet> prod( isolatedTaus->begin()->jet() );
          tagCollection.reset( new JetTagCollection(prod) );
        } else {
          tagCollection.reset( new JetTagCollection() );
        }

        edm::ESHandle<TransientTrackBuilder> builder;
        iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",builder);
        algo->setTransientTrackBuilder(builder.product());

        Vertex PV;
        if (usingVertex) {
          edm::Handle<reco::VertexCollection> vertices;
          iEvent.getByLabel(vertexSrc,vertices);

          const reco::VertexCollection vertCollection = *(vertices.product());
          reco::VertexCollection::const_iterator iVertex;

          for(iVertex = vertCollection.begin();iVertex!=vertCollection.end();iVertex++){
            PV = *iVertex;
          }

        } else {
          Vertex::Error e;
          e(0,0)=0;
          e(1,1)=0;
          e(2,2)=0;
          Vertex::Point p(0,0,0);

          Vertex dummyPV(p,e,1,1,1);
          PV = dummyPV;
        }

        for (unsigned int i = 0; i < isolatedTaus->size(); ++i) {
            IsolatedTauTagInfoRef tauRef(isolatedTaus, i);
            std::pair<float, TauImpactParameterInfo> ipInfo = algo->tag(tauRef,PV);
            tagCollection->setValue(i, ipInfo.first);    
            extCollection->push_back(ipInfo.second);
        }

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

Member Data Documentation

Definition at line 21 of file ImpactParameter.h.

Referenced by ImpactParameter(), produce(), and ~ImpactParameter().

std::string ImpactParameter::jetTrackSrc [private]

Definition at line 22 of file ImpactParameter.h.

Referenced by ImpactParameter(), and produce().

Definition at line 24 of file ImpactParameter.h.

Referenced by ImpactParameter(), and produce().

std::string ImpactParameter::vertexSrc [private]

Definition at line 23 of file ImpactParameter.h.

Referenced by ImpactParameter(), and produce().