CMS 3D CMS Logo

Public Member Functions | Private Attributes

reco::tau::RecoTauPiZeroStripPlugin Class Reference

Inheritance diagram for reco::tau::RecoTauPiZeroStripPlugin:
reco::tau::RecoTauPiZeroBuilderPlugin reco::tau::RecoTauEventHolderPlugin reco::tau::RecoTauNamedPlugin

List of all members.

Public Member Functions

virtual void beginEvent ()
 Hook called at the beginning of the event.
return_type operator() (const reco::PFJet &jet) const
 Build a collection of piZeros from objects in the input jet.
 RecoTauPiZeroStripPlugin (const edm::ParameterSet &pset)
virtual ~RecoTauPiZeroStripPlugin ()

Private Attributes

double combinatoricStripMassHypo_
bool combineStrips_
double etaAssociationDistance_
std::vector< int > inputPdgIds_
int maxStrips_
AddFourMomenta p4Builder_
double phiAssociationDistance_
edm::InputTag pvSrc_
RecoTauQualityCuts qcuts_

Detailed Description

Definition at line 44 of file RecoTauPiZeroStripPlugin.cc.


Constructor & Destructor Documentation

reco::tau::RecoTauPiZeroStripPlugin::RecoTauPiZeroStripPlugin ( const edm::ParameterSet pset) [explicit]

Definition at line 70 of file RecoTauPiZeroStripPlugin.cc.

References combinatoricStripMassHypo_, combineStrips_, etaAssociationDistance_, edm::ParameterSet::getParameter(), inputPdgIds_, maxStrips_, phiAssociationDistance_, and pvSrc_.

                                :RecoTauPiZeroBuilderPlugin(pset),
    qcuts_(pset.getParameter<edm::ParameterSet>("qualityCuts"))
{
  pvSrc_ = pset.getParameter<edm::InputTag>("primaryVertexSrc");
  inputPdgIds_ = pset.getParameter<std::vector<int> >(
      "stripCandidatesParticleIds");
  etaAssociationDistance_ = pset.getParameter<double>(
      "stripEtaAssociationDistance");
  phiAssociationDistance_ = pset.getParameter<double>(
      "stripPhiAssociationDistance");
  combineStrips_ = pset.getParameter<bool>("makeCombinatoricStrips");
  if (combineStrips_) {
    maxStrips_ = pset.getParameter<int>("maxInputStrips");
    combinatoricStripMassHypo_ =
      pset.getParameter<double>("stripMassWhenCombining");
  }
}
virtual reco::tau::RecoTauPiZeroStripPlugin::~RecoTauPiZeroStripPlugin ( ) [inline, virtual]

Definition at line 47 of file RecoTauPiZeroStripPlugin.cc.

{}

Member Function Documentation

void reco::tau::RecoTauPiZeroStripPlugin::beginEvent ( ) [virtual]

Hook called at the beginning of the event.

Reimplemented from reco::tau::RecoTauPiZeroBuilderPlugin.

Definition at line 90 of file RecoTauPiZeroStripPlugin.cc.

References reco::tau::RecoTauEventHolderPlugin::evt(), edm::Event::getByLabel(), pvSrc_, qcuts_, and reco::tau::RecoTauQualityCuts::setPV().

                                          {
  edm::Handle<reco::VertexCollection> pvHandle;
  evt()->getByLabel(pvSrc_, pvHandle);
  if (pvHandle->size()) {
    qcuts_.setPV(reco::VertexRef(pvHandle, 0));
  }
}
RecoTauPiZeroStripPlugin::return_type reco::tau::RecoTauPiZeroStripPlugin::operator() ( const reco::PFJet ) const [virtual]

Build a collection of piZeros from objects in the input jet.

Implements reco::tau::RecoTauPiZeroBuilderPlugin.

Definition at line 98 of file RecoTauPiZeroStripPlugin.cc.

References combinatoricStripMassHypo_, combineStrips_, reco::deltaPhi(), etaAssociationDistance_, reco::tau::RecoTauQualityCuts::filterRefs(), first, inputPdgIds_, reco::RecoTauPiZero::kStrips, reco::RecoTauPiZero::kUndefined, maxStrips_, convertSQLitetoXML_cfg::output, p4Builder_, reco::tau::pfCandidates(), phiAssociationDistance_, reco::LeafCandidate::pt(), qcuts_, edm::second(), AddFourMomenta::set(), strip(), and reco::tau::takeNElements().

                                {
  // Get list of gamma candidates
  typedef std::vector<reco::PFCandidatePtr> PFCandPtrs;
  typedef PFCandPtrs::iterator PFCandIter;
  PiZeroVector output;

  // Get the candidates passing our quality cuts
  PFCandPtrs candsVector = qcuts_.filterRefs(pfCandidates(jet, inputPdgIds_));
  //PFCandPtrs candsVector = qcuts_.filterRefs(pfGammas(jet));

  // Convert to stl::list to allow fast deletions
  typedef std::list<reco::PFCandidatePtr> PFCandPtrList;
  typedef std::list<reco::PFCandidatePtr>::iterator PFCandPtrListIter;
  PFCandPtrList cands;
  cands.insert(cands.end(), candsVector.begin(), candsVector.end());

  while (cands.size() > 0) {
    // Seed this new strip, and delete it from future strips
    PFCandidatePtr seed = cands.front();
    cands.pop_front();

    // Add a new candidate to our collection using this seed
    std::auto_ptr<RecoTauPiZero> strip(new RecoTauPiZero(
            *seed, RecoTauPiZero::kStrips));
    strip->addDaughter(seed);

    // Find all other objects in the strip
    PFCandPtrListIter stripCand = cands.begin();
    while(stripCand != cands.end()) {
      if( fabs(strip->eta() - (*stripCand)->eta()) < etaAssociationDistance_
          && fabs(deltaPhi(*strip, **stripCand)) < phiAssociationDistance_ ) {
        // Add candidate to strip
        strip->addDaughter(*stripCand);
        // Update the strips four momenta
        p4Builder_.set(*strip);
        // Delete this candidate from future strips and move on to
        // the next potential candidate
        stripCand = cands.erase(stripCand);
      } else {
        // This candidate isn't compatabile - just move to the next candidate
        ++stripCand;
      }
    }
    // Update the vertex
    if (strip->daughterPtr(0).isNonnull())
      strip->setVertex(strip->daughterPtr(0)->vertex());
    output.push_back(strip);
  }

  // Check if we want to combine our strips
  if (combineStrips_ && output.size() > 1) {
    PiZeroVector stripCombinations;
    // Sort the output by descending pt
    output.sort(output.begin(), output.end(),
        boost::bind(&RecoTauPiZero::pt, _1) >
        boost::bind(&RecoTauPiZero::pt, _2));
    // Get the end of interesting set of strips to try and combine
    PiZeroVector::const_iterator end_iter = takeNElements(
        output.begin(), output.end(), maxStrips_);

    // Look at all the combinations
    for (PiZeroVector::const_iterator first = output.begin();
        first != end_iter-1; ++first) {
      for (PiZeroVector::const_iterator second = first+1;
          second != end_iter; ++second) {
        Candidate::LorentzVector firstP4 = first->p4();
        Candidate::LorentzVector secondP4 = second->p4();
        // If we assume a certain mass for each strip apply it here.
        firstP4 = applyMassConstraint(firstP4, combinatoricStripMassHypo_);
        secondP4 = applyMassConstraint(secondP4, combinatoricStripMassHypo_);
        Candidate::LorentzVector totalP4 = firstP4 + secondP4;
        // Make our new combined strip
        std::auto_ptr<RecoTauPiZero> combinedStrips(
            new RecoTauPiZero(0, totalP4,
              Candidate::Point(0, 0, 0),
              //111, 10001, true, RecoTauPiZero::kCombinatoricStrips));
              111, 10001, true, RecoTauPiZero::kUndefined));

        // Now loop over the strip members
        BOOST_FOREACH(const RecoTauPiZero::daughters::value_type& gamma,
            first->daughterPtrVector()) {
          combinedStrips->addDaughter(gamma);
        }
        BOOST_FOREACH(const RecoTauPiZero::daughters::value_type& gamma,
            second->daughterPtrVector()) {
          combinedStrips->addDaughter(gamma);
        }
        // Update the vertex
        if (combinedStrips->daughterPtr(0).isNonnull())
          combinedStrips->setVertex(combinedStrips->daughterPtr(0)->vertex());
        // Add to our collection of combined strips
        stripCombinations.push_back(combinedStrips);
      }
    }
    // When done doing all the combinations, add the combined strips to the
    // output.
    output.transfer(output.end(), stripCombinations);
  }

  return output.release();
}

Member Data Documentation

Definition at line 65 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()(), and RecoTauPiZeroStripPlugin().

Definition at line 63 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()(), and RecoTauPiZeroStripPlugin().

Definition at line 59 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()(), and RecoTauPiZeroStripPlugin().

Definition at line 58 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()(), and RecoTauPiZeroStripPlugin().

Definition at line 64 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()(), and RecoTauPiZeroStripPlugin().

Definition at line 67 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()().

Definition at line 60 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()(), and RecoTauPiZeroStripPlugin().

Definition at line 55 of file RecoTauPiZeroStripPlugin.cc.

Referenced by beginEvent(), and RecoTauPiZeroStripPlugin().

Definition at line 56 of file RecoTauPiZeroStripPlugin.cc.

Referenced by beginEvent(), and operator()().