CMS 3D CMS Logo

List of all members | 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

Public Member Functions

void beginEvent () override
 Hook called at the beginning of the event. More...
 
return_type operator() (const reco::Jet &jet) const override
 Build a collection of piZeros from objects in the input jet. More...
 
 RecoTauPiZeroStripPlugin (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 ~RecoTauPiZeroStripPlugin () override
 
- Public Member Functions inherited from reco::tau::RecoTauPiZeroBuilderPlugin
 RecoTauPiZeroBuilderPlugin (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 ~RecoTauPiZeroBuilderPlugin () override
 
- Public Member Functions inherited from reco::tau::RecoTauEventHolderPlugin
const edm::Eventevt () const
 
edm::Eventevt ()
 
const edm::EventSetupevtSetup () const
 
 RecoTauEventHolderPlugin (const edm::ParameterSet &pset)
 
void setup (edm::Event &, const edm::EventSetup &)
 
 ~RecoTauEventHolderPlugin () override
 
- Public Member Functions inherited from reco::tau::RecoTauNamedPlugin
const std::string & name () const
 
 RecoTauNamedPlugin (const edm::ParameterSet &pset)
 
virtual ~RecoTauNamedPlugin ()
 

Private Attributes

double combinatoricStripMassHypo_
 
bool combineStrips_
 
double etaAssociationDistance_
 
std::vector< int > inputParticleIds_
 
int maxStrips_
 
AddFourMomenta p4Builder_
 
double phiAssociationDistance_
 
std::unique_ptr< RecoTauQualityCutsqcuts_
 
RecoTauVertexAssociator vertexAssociator_
 

Additional Inherited Members

- Public Types inherited from reco::tau::RecoTauPiZeroBuilderPlugin
typedef boost::ptr_vector< RecoTauPiZeroPiZeroVector
 
typedef std::unique_ptr< PiZeroVectorreturn_type
 

Detailed Description

Definition at line 44 of file RecoTauPiZeroStripPlugin.cc.

Constructor & Destructor Documentation

reco::tau::RecoTauPiZeroStripPlugin::RecoTauPiZeroStripPlugin ( const edm::ParameterSet pset,
edm::ConsumesCollector &&  iC 
)
explicit

Definition at line 69 of file RecoTauPiZeroStripPlugin.cc.

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

71  qcuts_(new RecoTauQualityCuts(pset.getParameterSet("qualityCuts").getParameterSet("signalQualityCuts"))),
72  vertexAssociator_(pset.getParameter<edm::ParameterSet>("qualityCuts"), std::move(iC)) {
73  inputParticleIds_ = pset.getParameter<std::vector<int> >("stripCandidatesParticleIds");
74  etaAssociationDistance_ = pset.getParameter<double>("stripEtaAssociationDistance");
75  phiAssociationDistance_ = pset.getParameter<double>("stripPhiAssociationDistance");
76  combineStrips_ = pset.getParameter<bool>("makeCombinatoricStrips");
77  if (combineStrips_) {
78  maxStrips_ = pset.getParameter<int>("maxInputStrips");
79  combinatoricStripMassHypo_ = pset.getParameter<double>("stripMassWhenCombining");
80  }
81  }
T getParameter(std::string const &) const
RecoTauPiZeroBuilderPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
ParameterSet const & getParameterSet(std::string const &) const
std::unique_ptr< RecoTauQualityCuts > qcuts_
def move(src, dest)
Definition: eostools.py:511
reco::tau::RecoTauPiZeroStripPlugin::~RecoTauPiZeroStripPlugin ( )
inlineoverride

Definition at line 47 of file RecoTauPiZeroStripPlugin.cc.

References beginEvent(), metsig::jet, and operator()().

47 {}

Member Function Documentation

void reco::tau::RecoTauPiZeroStripPlugin::beginEvent ( )
overridevirtual

Hook called at the beginning of the event.

Reimplemented from reco::tau::RecoTauPiZeroBuilderPlugin.

Definition at line 84 of file RecoTauPiZeroStripPlugin.cc.

References reco::tau::RecoTauEventHolderPlugin::evt(), reco::tau::RecoTauVertexAssociator::setEvent(), and vertexAssociator_.

Referenced by ~RecoTauPiZeroStripPlugin().

void setEvent(const edm::Event &evt)
Load the vertices from the event.
RecoTauPiZeroStripPlugin::return_type reco::tau::RecoTauPiZeroStripPlugin::operator() ( const reco::Jet ) const
overridevirtual

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

Implements reco::tau::RecoTauPiZeroBuilderPlugin.

Definition at line 86 of file RecoTauPiZeroStripPlugin.cc.

References reco::tau::RecoTauVertexAssociator::associatedVertex(), HLT_2018_cff::cands, combinatoricStripMassHypo_, combineStrips_, DEFINE_EDM_PLUGIN, reco::deltaPhi(), etaAssociationDistance_, dqmdumpme::first, CustomPhysics_cfi::gamma, inputParticleIds_, reco::RecoTauPiZero::kStrips, reco::RecoTauPiZero::kUndefined, maxStrips_, convertSQLitetoXML_cfg::output, p4Builder_, reco::tau::pfCandidates(), phiAssociationDistance_, reco::LeafCandidate::pt(), qcuts_, edm::second(), SurveyInfoScenario_cff::seed, AddFourMomenta::set(), digitizers_cfi::strip, reco::tau::takeNElements(), and vertexAssociator_.

Referenced by ~RecoTauPiZeroStripPlugin().

86  {
87  // Get list of gamma candidates
88  typedef std::vector<reco::CandidatePtr> CandPtrs;
89  typedef CandPtrs::iterator CandIter;
91 
92  // Get the candidates passing our quality cuts
94  CandPtrs candsVector = qcuts_->filterCandRefs(pfCandidates(jet, inputParticleIds_));
95  //PFCandPtrs candsVector = qcuts_->filterCandRefs(pfGammas(jet));
96 
97  // Convert to stl::list to allow fast deletions
98  typedef std::list<reco::CandidatePtr> CandPtrList;
99  typedef std::list<reco::CandidatePtr>::iterator CandPtrListIter;
100  CandPtrList cands;
101  cands.insert(cands.end(), candsVector.begin(), candsVector.end());
102 
103  while (!cands.empty()) {
104  // Seed this new strip, and delete it from future strips
105  CandidatePtr seed = cands.front();
106  cands.pop_front();
107 
108  // Add a new candidate to our collection using this seed
109  std::unique_ptr<RecoTauPiZero> strip(new RecoTauPiZero(*seed, RecoTauPiZero::kStrips));
110  strip->addDaughter(seed);
111 
112  // Find all other objects in the strip
113  CandPtrListIter stripCand = cands.begin();
114  while (stripCand != cands.end()) {
115  if (fabs(strip->eta() - (*stripCand)->eta()) < etaAssociationDistance_ &&
116  fabs(deltaPhi(*strip, **stripCand)) < phiAssociationDistance_) {
117  // Add candidate to strip
118  strip->addDaughter(*stripCand);
119  // Update the strips four momenta
120  p4Builder_.set(*strip);
121  // Delete this candidate from future strips and move on to
122  // the next potential candidate
123  stripCand = cands.erase(stripCand);
124  } else {
125  // This candidate isn't compatabile - just move to the next candidate
126  ++stripCand;
127  }
128  }
129  // Update the vertex
130  if (strip->daughterPtr(0).isNonnull())
131  strip->setVertex(strip->daughterPtr(0)->vertex());
132  output.push_back(strip.get());
133  }
134 
135  // Check if we want to combine our strips
136  if (combineStrips_ && output.size() > 1) {
137  PiZeroVector stripCombinations;
138  // Sort the output by descending pt
139  output.sort(
140  output.begin(), output.end(), boost::bind(&RecoTauPiZero::pt, _1) > boost::bind(&RecoTauPiZero::pt, _2));
141  // Get the end of interesting set of strips to try and combine
142  PiZeroVector::const_iterator end_iter = takeNElements(output.begin(), output.end(), maxStrips_);
143 
144  // Look at all the combinations
145  for (PiZeroVector::const_iterator first = output.begin(); first != end_iter - 1; ++first) {
146  for (PiZeroVector::const_iterator second = first + 1; second != end_iter; ++second) {
147  Candidate::LorentzVector firstP4 = first->p4();
148  Candidate::LorentzVector secondP4 = second->p4();
149  // If we assume a certain mass for each strip apply it here.
150  firstP4 = applyMassConstraint(firstP4, combinatoricStripMassHypo_);
151  secondP4 = applyMassConstraint(secondP4, combinatoricStripMassHypo_);
152  Candidate::LorentzVector totalP4 = firstP4 + secondP4;
153  // Make our new combined strip
154  std::unique_ptr<RecoTauPiZero> combinedStrips(
155  new RecoTauPiZero(0,
156  totalP4,
157  Candidate::Point(0, 0, 0),
158  //111, 10001, true, RecoTauPiZero::kCombinatoricStrips));
159  111,
160  10001,
161  true,
163 
164  // Now loop over the strip members
165  for (auto const& gamma : first->daughterPtrVector()) {
166  combinedStrips->addDaughter(gamma);
167  }
168  for (auto const& gamma : second->daughterPtrVector()) {
169  combinedStrips->addDaughter(gamma);
170  }
171  // Update the vertex
172  if (combinedStrips->daughterPtr(0).isNonnull())
173  combinedStrips->setVertex(combinedStrips->daughterPtr(0)->vertex());
174  // Add to our collection of combined strips
175  stripCombinations.push_back(combinedStrips.get());
176  }
177  }
178  // When done doing all the combinations, add the combined strips to the
179  // output.
180  output.transfer(output.end(), stripCombinations);
181  }
182 
183  return output.release();
184  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
std::vector< CandidatePtr > pfCandidates(const Jet &jet, int particleId, bool sort=true)
InputIterator takeNElements(const InputIterator &begin, const InputIterator &end, size_t N)
double pt() const final
transverse momentum
U second(std::pair< T, U > const &p)
std::vector< reco::CandidatePtr > CandPtrs
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
reco::VertexRef associatedVertex(const Jet &jet) const
boost::ptr_vector< RecoTauPiZero > PiZeroVector
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
void set(reco::Candidate &c) const
set up a candidate
std::unique_ptr< RecoTauQualityCuts > qcuts_
CandPtrs::iterator CandIter

Member Data Documentation

double reco::tau::RecoTauPiZeroStripPlugin::combinatoricStripMassHypo_
private

Definition at line 64 of file RecoTauPiZeroStripPlugin.cc.

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

bool reco::tau::RecoTauPiZeroStripPlugin::combineStrips_
private

Definition at line 62 of file RecoTauPiZeroStripPlugin.cc.

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

double reco::tau::RecoTauPiZeroStripPlugin::etaAssociationDistance_
private

Definition at line 58 of file RecoTauPiZeroStripPlugin.cc.

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

std::vector<int> reco::tau::RecoTauPiZeroStripPlugin::inputParticleIds_
private

Definition at line 57 of file RecoTauPiZeroStripPlugin.cc.

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

int reco::tau::RecoTauPiZeroStripPlugin::maxStrips_
private

Definition at line 63 of file RecoTauPiZeroStripPlugin.cc.

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

AddFourMomenta reco::tau::RecoTauPiZeroStripPlugin::p4Builder_
private

Definition at line 66 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()().

double reco::tau::RecoTauPiZeroStripPlugin::phiAssociationDistance_
private

Definition at line 59 of file RecoTauPiZeroStripPlugin.cc.

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

std::unique_ptr<RecoTauQualityCuts> reco::tau::RecoTauPiZeroStripPlugin::qcuts_
private

Definition at line 54 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()().

RecoTauVertexAssociator reco::tau::RecoTauPiZeroStripPlugin::vertexAssociator_
private

Definition at line 55 of file RecoTauPiZeroStripPlugin.cc.

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