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_
 
RecoTauQualityCuts qcuts_
 
RecoTauVertexAssociator vertexAssociator_
 

Additional Inherited Members

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

Detailed Description

Definition at line 46 of file RecoTauPiZeroStripPlugin.cc.

Constructor & Destructor Documentation

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

Definition at line 71 of file RecoTauPiZeroStripPlugin.cc.

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

72  :
75  "qualityCuts").getParameterSet("signalQualityCuts")),
76  vertexAssociator_(pset.getParameter<edm::ParameterSet>("qualityCuts"),std::move(iC)) {
77  inputParticleIds_ = pset.getParameter<std::vector<int> >(
78  "stripCandidatesParticleIds");
80  "stripEtaAssociationDistance");
82  "stripPhiAssociationDistance");
83  combineStrips_ = pset.getParameter<bool>("makeCombinatoricStrips");
84  if (combineStrips_) {
85  maxStrips_ = pset.getParameter<int>("maxInputStrips");
87  pset.getParameter<double>("stripMassWhenCombining");
88  }
89 }
T getParameter(std::string const &) const
RecoTauPiZeroBuilderPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
ParameterSet const & getParameterSet(std::string const &) const
def move(src, dest)
Definition: eostools.py:511
reco::tau::RecoTauPiZeroStripPlugin::~RecoTauPiZeroStripPlugin ( )
inlineoverride

Definition at line 49 of file RecoTauPiZeroStripPlugin.cc.

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

49 {}

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 92 of file RecoTauPiZeroStripPlugin.cc.

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

Referenced by ~RecoTauPiZeroStripPlugin().

92  {
94 }
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 96 of file RecoTauPiZeroStripPlugin.cc.

References reco::tau::RecoTauVertexAssociator::associatedVertex(), egammaForCoreTracking_cff::cands, combinatoricStripMassHypo_, combineStrips_, DEFINE_EDM_PLUGIN, reco::deltaPhi(), etaAssociationDistance_, reco::tau::RecoTauQualityCuts::filterCandRefs(), plotBeamSpotDB::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(), reco::tau::RecoTauQualityCuts::setPV(), digitizers_cfi::strip, reco::tau::takeNElements(), and vertexAssociator_.

Referenced by ~RecoTauPiZeroStripPlugin().

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

Member Data Documentation

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

Definition at line 66 of file RecoTauPiZeroStripPlugin.cc.

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

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

Definition at line 64 of file RecoTauPiZeroStripPlugin.cc.

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

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

Definition at line 60 of file RecoTauPiZeroStripPlugin.cc.

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

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

Definition at line 59 of file RecoTauPiZeroStripPlugin.cc.

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

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

Definition at line 65 of file RecoTauPiZeroStripPlugin.cc.

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

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

Definition at line 68 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()().

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

Definition at line 61 of file RecoTauPiZeroStripPlugin.cc.

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

RecoTauQualityCuts reco::tau::RecoTauPiZeroStripPlugin::qcuts_
private

Definition at line 56 of file RecoTauPiZeroStripPlugin.cc.

Referenced by operator()().

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

Definition at line 57 of file RecoTauPiZeroStripPlugin.cc.

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