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 std::vector< std::unique_ptr< RecoTauPiZero > > PiZeroVector
 
typedef PiZeroVector return_type
 

Detailed Description

Definition at line 43 of file RecoTauPiZeroStripPlugin.cc.

Constructor & Destructor Documentation

◆ RecoTauPiZeroStripPlugin()

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

Definition at line 68 of file RecoTauPiZeroStripPlugin.cc.

References combinatoricStripMassHypo_, combineStrips_, etaAssociationDistance_, inputParticleIds_, maxStrips_, phiAssociationDistance_, and muonDTDigis_cfi::pset.

70  qcuts_(std::make_unique<RecoTauQualityCuts>(
71  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  }
RecoTauPiZeroBuilderPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
std::unique_ptr< RecoTauQualityCuts > qcuts_
def move(src, dest)
Definition: eostools.py:511

◆ ~RecoTauPiZeroStripPlugin()

reco::tau::RecoTauPiZeroStripPlugin::~RecoTauPiZeroStripPlugin ( )
inlineoverride

Definition at line 46 of file RecoTauPiZeroStripPlugin.cc.

46 {}

Member Function Documentation

◆ beginEvent()

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_.

void setEvent(const edm::Event &evt)
Load the vertices from the event.

◆ operator()()

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_2024v14_cff::cands, combinatoricStripMassHypo_, combineStrips_, reco::deltaPhi(), etaAssociationDistance_, dqmdumpme::first, CustomPhysics_cfi::gamma, inputParticleIds_, metsig::jet, reco::RecoTauPiZero::kStrips, reco::RecoTauPiZero::kUndefined, maxStrips_, eostools::move(), convertSQLitetoXML_cfg::output, p4Builder_, reco::tau::pfCandidates(), phiAssociationDistance_, qcuts_, edm::second(), fileCollector::seed, AddFourMomenta::set(), jetUpdater_cfi::sort, nano_mu_digi_cff::strip, reco::tau::takeNElements(), and vertexAssociator_.

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  std::list<reco::CandidatePtr> cands;
99  cands.insert(cands.end(), candsVector.begin(), candsVector.end());
100 
101  while (!cands.empty()) {
102  // Seed this new strip, and delete it from future strips
103  CandidatePtr seed = cands.front();
104  cands.pop_front();
105 
106  // Add a new candidate to our collection using this seed
107  auto strip = std::make_unique<RecoTauPiZero>(*seed, RecoTauPiZero::kStrips);
108  strip->addDaughter(seed);
109 
110  // Find all other objects in the strip
111  auto stripCand = cands.begin();
112  while (stripCand != cands.end()) {
113  if (fabs(strip->eta() - (*stripCand)->eta()) < etaAssociationDistance_ &&
114  fabs(deltaPhi(*strip, **stripCand)) < phiAssociationDistance_) {
115  // Add candidate to strip
116  strip->addDaughter(*stripCand);
117  // Update the strips four momenta
118  p4Builder_.set(*strip);
119  // Delete this candidate from future strips and move on to
120  // the next potential candidate
121  stripCand = cands.erase(stripCand);
122  } else {
123  // This candidate isn't compatabile - just move to the next candidate
124  ++stripCand;
125  }
126  }
127  // Update the vertex
128  if (strip->daughterPtr(0).isNonnull())
129  strip->setVertex(strip->daughterPtr(0)->vertex());
130  output.emplace_back(strip.release());
131  }
132 
133  // Check if we want to combine our strips
134  if (combineStrips_ && output.size() > 1) {
135  PiZeroVector stripCombinations;
136  // Sort the output by descending pt
137  std::sort(output.begin(), output.end(), [&](auto& arg1, auto& arg2) { return arg1->pt() > arg2->pt(); });
138  // Get the end of interesting set of strips to try and combine
139  PiZeroVector::const_iterator end_iter = takeNElements(output.begin(), output.end(), maxStrips_);
140 
141  // Look at all the combinations
142  for (PiZeroVector::const_iterator firstIter = output.begin(); firstIter != end_iter - 1; ++firstIter) {
143  for (PiZeroVector::const_iterator secondIter = firstIter + 1; secondIter != end_iter; ++secondIter) {
144  auto const& first = *firstIter;
145  auto const& second = *secondIter;
146  Candidate::LorentzVector firstP4 = first->p4();
147  Candidate::LorentzVector secondP4 = second->p4();
148  // If we assume a certain mass for each strip apply it here.
149  firstP4 = applyMassConstraint(firstP4, combinatoricStripMassHypo_);
150  secondP4 = applyMassConstraint(secondP4, combinatoricStripMassHypo_);
151  Candidate::LorentzVector totalP4 = firstP4 + secondP4;
152  // Make our new combined strip
153  auto combinedStrips =
154  std::make_unique<RecoTauPiZero>(0,
155  totalP4,
156  Candidate::Point(0, 0, 0),
157  //111, 10001, true, RecoTauPiZero::kCombinatoricStrips));
158  111,
159  10001,
160  true,
162 
163  // Now loop over the strip members
164  for (auto const& gamma : first->daughterPtrVector()) {
165  combinedStrips->addDaughter(gamma);
166  }
167  for (auto const& gamma : second->daughterPtrVector()) {
168  combinedStrips->addDaughter(gamma);
169  }
170  // Update the vertex
171  if (combinedStrips->daughterPtr(0).isNonnull())
172  combinedStrips->setVertex(combinedStrips->daughterPtr(0)->vertex());
173  // Add to our collection of combined strips
174  stripCombinations.emplace_back(combinedStrips.release());
175  }
176  }
177  // When done doing all the combinations, add the combined strips to the output.
178  std::move(stripCombinations.begin(), stripCombinations.end(), std::back_inserter(output));
179  }
180 
181  return output;
182  }
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)
void set(reco::Candidate &c) const
set up a candidate
reco::VertexRef associatedVertex(const Jet &jet) const
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
std::vector< std::unique_ptr< RecoTauPiZero > > PiZeroVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
Definition: output.py:1
std::unique_ptr< RecoTauQualityCuts > qcuts_
CandPtrs::iterator CandIter
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ combinatoricStripMassHypo_

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

Definition at line 63 of file RecoTauPiZeroStripPlugin.cc.

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

◆ combineStrips_

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

Definition at line 61 of file RecoTauPiZeroStripPlugin.cc.

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

◆ etaAssociationDistance_

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

Definition at line 57 of file RecoTauPiZeroStripPlugin.cc.

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

◆ inputParticleIds_

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

Definition at line 56 of file RecoTauPiZeroStripPlugin.cc.

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

◆ maxStrips_

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

Definition at line 62 of file RecoTauPiZeroStripPlugin.cc.

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

◆ p4Builder_

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

Definition at line 65 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()().

◆ phiAssociationDistance_

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

Definition at line 58 of file RecoTauPiZeroStripPlugin.cc.

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

◆ qcuts_

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

Definition at line 53 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()().

◆ vertexAssociator_

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

Definition at line 54 of file RecoTauPiZeroStripPlugin.cc.

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