Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <algorithm>
00014
00015 #include "RecoTauTag/RecoTau/interface/RecoTauPiZeroPlugins.h"
00016 #include "DataFormats/TauReco/interface/RecoTauPiZero.h"
00017 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
00018 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00019 #include "DataFormats/JetReco/interface/PFJet.h"
00020
00021 #include "RecoTauTag/RecoTau/interface/RecoTauCommonUtilities.h"
00022 #include "RecoTauTag/RecoTau/interface/RecoTauQualityCuts.h"
00023 #include "RecoTauTag/RecoTau/interface/CombinatoricGenerator.h"
00024
00025 #include "CommonTools/CandUtils/interface/AddFourMomenta.h"
00026
00027 namespace reco { namespace tau {
00028
00029 class RecoTauPiZeroCombinatoricPlugin : public RecoTauPiZeroBuilderPlugin {
00030 public:
00031 explicit RecoTauPiZeroCombinatoricPlugin(const edm::ParameterSet& pset);
00032 ~RecoTauPiZeroCombinatoricPlugin() {}
00033
00034 return_type operator()(const reco::PFJet& jet) const;
00035
00036 private:
00037 RecoTauQualityCuts qcuts_;
00038 double minMass_;
00039 double maxMass_;
00040 unsigned int maxInputGammas_;
00041 unsigned int choose_;
00042 AddFourMomenta p4Builder_;
00043 };
00044
00045 RecoTauPiZeroCombinatoricPlugin::RecoTauPiZeroCombinatoricPlugin(
00046 const edm::ParameterSet& pset):RecoTauPiZeroBuilderPlugin(pset),
00047 qcuts_(pset.getParameterSet(
00048 "qualityCuts").getParameterSet("signalQualityCuts")) {
00049 minMass_ = pset.getParameter<double>("minMass");
00050 maxMass_ = pset.getParameter<double>("maxMass");
00051 maxInputGammas_ = pset.getParameter<unsigned int>("maxInputGammas");
00052 choose_ = pset.getParameter<unsigned int>("choose");
00053 }
00054
00055 RecoTauPiZeroCombinatoricPlugin::return_type
00056 RecoTauPiZeroCombinatoricPlugin::operator()(
00057 const reco::PFJet& jet) const {
00058
00059 typedef std::vector<reco::PFCandidatePtr> PFCandPtrs;
00060 typedef PFCandPtrs::const_iterator PFCandIter;
00061 PiZeroVector output;
00062
00063 PFCandPtrs pfGammaCands = qcuts_.filterRefs(pfGammas(jet));
00064
00065 if (pfGammaCands.size() < choose_)
00066 return output.release();
00067
00068
00069 PFCandIter start_iter = pfGammaCands.begin();
00070 PFCandIter end_iter = pfGammaCands.end();
00071
00072
00073 end_iter = takeNElements(start_iter, end_iter, maxInputGammas_);
00074
00075
00076 typedef CombinatoricGenerator<PFCandPtrs> ComboGenerator;
00077 ComboGenerator generator(start_iter, end_iter, choose_);
00078
00079
00080 for (ComboGenerator::iterator combo = generator.begin();
00081 combo != generator.end(); ++combo) {
00082 const Candidate::LorentzVector totalP4;
00083 std::auto_ptr<RecoTauPiZero> piZero(
00084 new RecoTauPiZero(0, totalP4, Candidate::Point(0, 0, 0),
00085 111, 10001, true, RecoTauPiZero::kCombinatoric));
00086
00087 for (ComboGenerator::combo_iterator candidate = combo->combo_begin();
00088 candidate != combo->combo_end(); ++candidate) {
00089 piZero->addDaughter(*candidate);
00090 }
00091 p4Builder_.set(*piZero);
00092
00093 if (piZero->daughterPtr(0).isNonnull())
00094 piZero->setVertex(piZero->daughterPtr(0)->vertex());
00095
00096 if ((maxMass_ < 0 || piZero->mass() < maxMass_) &&
00097 piZero->mass() > minMass_)
00098 output.push_back(piZero);
00099 }
00100 return output.release();
00101 }
00102
00103 }}
00104
00105 #include "FWCore/Framework/interface/MakerMacros.h"
00106 DEFINE_EDM_PLUGIN(RecoTauPiZeroBuilderPluginFactory,
00107 reco::tau::RecoTauPiZeroCombinatoricPlugin,
00108 "RecoTauPiZeroCombinatoricPlugin");