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

virtual void beginEvent () override
 Hook called at the beginning of the event. More...
 
return_type operator() (const reco::PFJet &jet) const override
 Build a collection of piZeros from objects in the input jet. More...
 
 RecoTauPiZeroStripPlugin (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
virtual ~RecoTauPiZeroStripPlugin ()
 
- Public Member Functions inherited from reco::tau::RecoTauPiZeroBuilderPlugin
 RecoTauPiZeroBuilderPlugin (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
virtual ~RecoTauPiZeroBuilderPlugin ()
 
- 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 &)
 
virtual ~RecoTauEventHolderPlugin ()
 
- 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 > inputPdgIds_
 
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(), inputPdgIds_, maxStrips_, and phiAssociationDistance_.

72  :
75  "qualityCuts").getParameterSet("signalQualityCuts")),
76  vertexAssociator_(pset.getParameter<edm::ParameterSet>("qualityCuts"),std::move(iC)) {
77  inputPdgIds_ = 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:510
virtual reco::tau::RecoTauPiZeroStripPlugin::~RecoTauPiZeroStripPlugin ( )
inlinevirtual

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::PFJet ) 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(), combinatoricStripMassHypo_, combineStrips_, DEFINE_EDM_PLUGIN, reco::deltaPhi(), etaAssociationDistance_, reco::tau::RecoTauQualityCuts::filterCandRefs(), plotBeamSpotDB::first, CustomPhysics_cfi::gamma, inputPdgIds_, 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(), digi_MixPreMix_cfi::strip, reco::tau::takeNElements(), and vertexAssociator_.

Referenced by ~RecoTauPiZeroStripPlugin().

97  {
98  // Get list of gamma candidates
99  typedef std::vector<reco::PFCandidatePtr> PFCandPtrs;
100  typedef PFCandPtrs::iterator PFCandIter;
102 
103  // Get the candidates passing our quality cuts
105  PFCandPtrs candsVector = qcuts_.filterCandRefs(pfCandidates(jet, inputPdgIds_));
106  //PFCandPtrs candsVector = qcuts_.filterCandRefs(pfGammas(jet));
107 
108  // Convert to stl::list to allow fast deletions
109  typedef std::list<reco::PFCandidatePtr> PFCandPtrList;
110  typedef std::list<reco::PFCandidatePtr>::iterator PFCandPtrListIter;
111  PFCandPtrList cands;
112  cands.insert(cands.end(), candsVector.begin(), candsVector.end());
113 
114  while (cands.size() > 0) {
115  // Seed this new strip, and delete it from future strips
116  PFCandidatePtr seed = cands.front();
117  cands.pop_front();
118 
119  // Add a new candidate to our collection using this seed
120  std::auto_ptr<RecoTauPiZero> strip(new RecoTauPiZero(
121  *seed, RecoTauPiZero::kStrips));
122  strip->addDaughter(seed);
123 
124  // Find all other objects in the strip
125  PFCandPtrListIter 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);
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::auto_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  BOOST_FOREACH(const RecoTauPiZero::daughters::value_type& gamma,
178  first->daughterPtrVector()) {
179  combinedStrips->addDaughter(gamma);
180  }
181  BOOST_FOREACH(const RecoTauPiZero::daughters::value_type& gamma,
182  second->daughterPtrVector()) {
183  combinedStrips->addDaughter(gamma);
184  }
185  // Update the vertex
186  if (combinedStrips->daughterPtr(0).isNonnull())
187  combinedStrips->setVertex(combinedStrips->daughterPtr(0)->vertex());
188  // Add to our collection of combined strips
189  stripCombinations.push_back(combinedStrips);
190  }
191  }
192  // When done doing all the combinations, add the combined strips to the
193  // output.
194  output.transfer(output.end(), stripCombinations);
195  }
196 
197  return output.release();
198 }
virtual double pt() const final
transverse momentum
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 PFCandidates.
std::vector< reco::PFCandidatePtr > PFCandPtrs
reco::VertexRef associatedVertex(const PFJet &jet) const
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
U second(std::pair< T, U > const &p)
void setPV(const reco::VertexRef &vtx) const
Update the primary vertex.
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
boost::ptr_vector< RecoTauPiZero > PiZeroVector
PFCandPtrs::iterator PFCandIter
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
void set(reco::Candidate &c) const
set up a candidate
edm::Ptr< PFCandidate > PFCandidatePtr
persistent Ptr to a PFCandidate

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::inputPdgIds_
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()().