CMS 3D CMS Logo

RecoTauPiZeroCombinatoricPlugin.cc
Go to the documentation of this file.
1 /*
2  * RecoTauPiZeroCombinatoricPlugin
3  *
4  * Author: Evan K. Friis, UC Davis
5  *
6  * Build PiZero candidates out of all possible sets of <choose> gammas that are
7  * contained in the input PFJet. Optionally, the pi zero candidates are
8  * filtered by a min and max selection on their invariant mass.
9  *
10  */
11 
12 #include <algorithm>
13 
19 
23 
25 
26 namespace reco {
27  namespace tau {
28 
30  public:
33  // Return type is unique_ptr<PiZeroVector>
34  return_type operator()(const reco::Jet& jet) const override;
35 
36  private:
38  double minMass_;
39  double maxMass_;
40  unsigned int maxInputGammas_;
41  unsigned int choose_;
43  };
44 
48  qcuts_(pset.getParameterSet("qualityCuts").getParameterSet("signalQualityCuts")) {
49  minMass_ = pset.getParameter<double>("minMass");
50  maxMass_ = pset.getParameter<double>("maxMass");
51  maxInputGammas_ = pset.getParameter<unsigned int>("maxInputGammas");
52  choose_ = pset.getParameter<unsigned int>("choose");
53  }
54 
56  const reco::Jet& jet) const {
57  // Get list of gamma candidates
58  typedef std::vector<reco::CandidatePtr> CandPtrs;
59  typedef CandPtrs::const_iterator CandIter;
61 
62  CandPtrs pfGammaCands = qcuts_.filterCandRefs(pfGammas(jet));
63  // Check if we have anything to do...
64  if (pfGammaCands.size() < choose_)
65  return output.release();
66 
67  // Define the valid range of gammas to use
68  CandIter start_iter = pfGammaCands.begin();
69  CandIter end_iter = pfGammaCands.end();
70 
71  // Only take the desired number of piZeros
72  end_iter = takeNElements(start_iter, end_iter, maxInputGammas_);
73 
74  // Build the combinatoric generator
75  typedef CombinatoricGenerator<CandPtrs> ComboGenerator;
76  ComboGenerator generator(start_iter, end_iter, choose_);
77 
78  // Find all possible combinations
79  for (ComboGenerator::iterator combo = generator.begin(); combo != generator.end(); ++combo) {
80  const Candidate::LorentzVector totalP4;
81  std::unique_ptr<RecoTauPiZero> piZero(
82  new RecoTauPiZero(0, totalP4, Candidate::Point(0, 0, 0), 111, 10001, true, RecoTauPiZero::kCombinatoric));
83  // Add our daughters from this combination
84  for (ComboGenerator::combo_iterator candidate = combo->combo_begin(); candidate != combo->combo_end();
85  ++candidate) {
86  piZero->addDaughter(*candidate);
87  }
88  p4Builder_.set(*piZero);
89 
90  if (piZero->daughterPtr(0).isNonnull())
91  piZero->setVertex(piZero->daughterPtr(0)->vertex());
92 
93  if ((maxMass_ < 0 || piZero->mass() < maxMass_) && piZero->mass() > minMass_)
94  output.push_back(piZero.get());
95  }
96  return output.release();
97  }
98 
99  } // namespace tau
100 } // namespace reco
101 
105  "RecoTauPiZeroCombinatoricPlugin");
reco::RecoTauPiZero::kCombinatoric
Definition: RecoTauPiZero.h:13
reco::tau::RecoTauPiZeroCombinatoricPlugin::operator()
return_type operator()(const reco::Jet &jet) const override
Build a collection of piZeros from objects in the input jet.
Definition: RecoTauPiZeroCombinatoricPlugin.cc:55
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
reco::tau::RecoTauPiZeroCombinatoricPlugin::minMass_
double minMass_
Definition: RecoTauPiZeroCombinatoricPlugin.cc:38
reco::tau::RecoTauQualityCuts
Definition: RecoTauQualityCuts.h:35
reco::tau::RecoTauPiZeroCombinatoricPlugin::qcuts_
RecoTauQualityCuts qcuts_
Definition: RecoTauPiZeroCombinatoricPlugin.cc:37
metsig::tau
Definition: SignAlgoResolutions.h:49
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
PFJet.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
RecoTauPiZeroPlugins.h
RecoTauPiZero.h
CandidateFwd.h
MakerMacros.h
reco::tau::RecoTauPiZeroCombinatoricPlugin::p4Builder_
AddFourMomenta p4Builder_
Definition: RecoTauPiZeroCombinatoricPlugin.cc:42
reco::tau::RecoTauPiZeroCombinatoricPlugin
Definition: RecoTauPiZeroCombinatoricPlugin.cc:29
RecoTauCommonUtilities.h
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
reco::tau::RecoTauPiZeroBuilderPlugin::PiZeroVector
boost::ptr_vector< RecoTauPiZero > PiZeroVector
Definition: RecoTauPiZeroPlugins.h:36
RecoTauQualityCuts.h
reco::tau::pfGammas
std::vector< CandidatePtr > pfGammas(const Jet &jet, bool sort=true)
Extract all pfGammas from a PFJet.
Definition: RecoTauCommonUtilities.cc:92
CombinatoricGenerator.h
reco::tau::RecoTauQualityCuts::filterCandRefs
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of Candidates.
Definition: RecoTauQualityCuts.h:86
edm::ParameterSet
Definition: ParameterSet.h:47
edmplugin::PluginFactory
Definition: PluginFactory.h:34
reco::tau::RecoTauPiZeroCombinatoricPlugin::RecoTauPiZeroCombinatoricPlugin
RecoTauPiZeroCombinatoricPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
Definition: RecoTauPiZeroCombinatoricPlugin.cc:45
AddFourMomenta.h
CandPtrs
std::vector< reco::CandidatePtr > CandPtrs
Definition: RecoTauCommonUtilities.cc:13
reco::tau::CombinatoricGenerator
Definition: CombinatoricGenerator.h:234
genfragment_ptgun_cfg.generator
generator
Definition: genfragment_ptgun_cfg.py:4
reco::tau::RecoTauPiZeroCombinatoricPlugin::~RecoTauPiZeroCombinatoricPlugin
~RecoTauPiZeroCombinatoricPlugin() override
Definition: RecoTauPiZeroCombinatoricPlugin.cc:32
reco::tau::takeNElements
InputIterator takeNElements(const InputIterator &begin, const InputIterator &end, size_t N)
Definition: RecoTauCommonUtilities.h:104
edm::getParameterSet
ParameterSet const & getParameterSet(ParameterSetID const &id)
Definition: ParameterSet.cc:862
reco::RecoTauPiZero
Definition: RecoTauPiZero.h:7
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
reco::tau::RecoTauPiZeroCombinatoricPlugin::maxMass_
double maxMass_
Definition: RecoTauPiZeroCombinatoricPlugin.cc:39
metsig::jet
Definition: SignAlgoResolutions.h:47
reco::tau::RecoTauPiZeroBuilderPlugin
Definition: RecoTauPiZeroPlugins.h:33
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
AddFourMomenta::set
void set(reco::Candidate &c) const
set up a candidate
Definition: AddFourMomenta.cc:6
AddFourMomenta
Definition: AddFourMomenta.h:18
Candidate.h
CandIter
CandPtrs::iterator CandIter
Definition: RecoTauCommonUtilities.cc:14
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
reco::Candidate::Point
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
reco::tau::RecoTauPiZeroCombinatoricPlugin::maxInputGammas_
unsigned int maxInputGammas_
Definition: RecoTauPiZeroCombinatoricPlugin.cc:40
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
reco::tau::RecoTauPiZeroCombinatoricPlugin::choose_
unsigned int choose_
Definition: RecoTauPiZeroCombinatoricPlugin.cc:41
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
reco::tau::RecoTauPiZeroBuilderPlugin::return_type
std::unique_ptr< PiZeroVector > return_type
Definition: RecoTauPiZeroPlugins.h:39