CMS 3D CMS Logo

Public Member Functions | Private Attributes

RecoTauPiZeroUnembedder Class Reference

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

List of all members.

Public Member Functions

void produce (edm::Event &evt, const edm::EventSetup &es)
 RecoTauPiZeroUnembedder (const edm::ParameterSet &pset)
virtual ~RecoTauPiZeroUnembedder ()

Private Attributes

edm::InputTag src_

Detailed Description

Definition at line 26 of file RecoTauPiZeroUnembedder.cc.


Constructor & Destructor Documentation

RecoTauPiZeroUnembedder::RecoTauPiZeroUnembedder ( const edm::ParameterSet pset)

Definition at line 35 of file RecoTauPiZeroUnembedder.cc.

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

                                                                            {
  src_ = pset.getParameter<edm::InputTag>("src");
  produces<reco::RecoTauPiZeroCollection>("pizeros");
  produces<reco::PFTauCollection>();
}
virtual RecoTauPiZeroUnembedder::~RecoTauPiZeroUnembedder ( ) [inline, virtual]

Definition at line 29 of file RecoTauPiZeroUnembedder.cc.

{}

Member Function Documentation

void RecoTauPiZeroUnembedder::produce ( edm::Event evt,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 40 of file RecoTauPiZeroUnembedder.cc.

References edm::Event::getByLabel(), edm::Event::getRefBeforePut(), reco::PFTau::isolationPiZeroCandidates(), edm::RefVector< C, T, F >::push_back(), edm::Event::put(), reco::PFTau::setIsolationPiZeroCandidatesRefs(), reco::PFTau::setSignalPiZeroCandidatesRefs(), reco::PFTau::signalPiZeroCandidates(), edm::RefVector< C, T, F >::size(), and src_.

                                                                            {
  std::auto_ptr<reco::RecoTauPiZeroCollection> piZerosOut(
      new reco::RecoTauPiZeroCollection);
  std::auto_ptr<reco::PFTauCollection> tausOut(new reco::PFTauCollection);

  edm::Handle<reco::CandidateView> tauView;
  evt.getByLabel(src_, tauView);

  reco::PFTauRefVector taus =
      reco::tau::castView<reco::PFTauRefVector>(tauView);

  // Get the reference to the product of where the final pizeros will end up
  reco::RecoTauPiZeroRefProd piZeroProd =
    evt.getRefBeforePut<reco::RecoTauPiZeroCollection>("pizeros");

  for (size_t iTau = 0; iTau < taus.size(); ++iTau) {
    // Make a copy
    reco::PFTau myTau = *taus[iTau];
    // The ref vectors that will be filled
    reco::RecoTauPiZeroRefVector signalPiZeroRefs;
    reco::RecoTauPiZeroRefVector isolationPiZeroRefs;

    // Copy the PiZeros into the new vector, while updating what refs they will
    // have
    const reco::RecoTauPiZeroCollection& signalPiZeros =
      myTau.signalPiZeroCandidates();

    for (size_t iPiZero = 0; iPiZero < signalPiZeros.size(); ++iPiZero) {
      piZerosOut->push_back(signalPiZeros[iPiZero]);
      // Figure out what the ref for this pizero will be in the new coll.
      signalPiZeroRefs.push_back(
          reco::RecoTauPiZeroRef(piZeroProd, piZerosOut->size()-1));
    }

    const reco::RecoTauPiZeroCollection& isolationPiZeroCandidates =
      myTau.isolationPiZeroCandidates();
    for (size_t iPiZero = 0; iPiZero < isolationPiZeroCandidates.size(); ++iPiZero) {
      piZerosOut->push_back(isolationPiZeroCandidates[iPiZero]);
      // Figure out what the ref for this pizero will be in the new coll.
      isolationPiZeroRefs.push_back(
          reco::RecoTauPiZeroRef(piZeroProd, piZerosOut->size()-1));
    }

    myTau.setSignalPiZeroCandidatesRefs(signalPiZeroRefs);
    myTau.setIsolationPiZeroCandidatesRefs(isolationPiZeroRefs);

    tausOut->push_back(myTau);
  }

  evt.put(piZerosOut, "pizeros");
  evt.put(tausOut);
}

Member Data Documentation

Definition at line 32 of file RecoTauPiZeroUnembedder.cc.

Referenced by produce(), and RecoTauPiZeroUnembedder().