CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
< RecoTauPiZero
PiZeroVector
 
typedef std::auto_ptr
< PiZeroVector
return_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(), inputPdgIds_, maxStrips_, and phiAssociationDistance_.

70  :
71  RecoTauPiZeroBuilderPlugin(pset,std::move(iC)),
73  "qualityCuts").getParameterSet("signalQualityCuts")),
74  vertexAssociator_(pset.getParameter<edm::ParameterSet>("qualityCuts"),std::move(iC)) {
75  inputPdgIds_ = pset.getParameter<std::vector<int> >(
76  "stripCandidatesParticleIds");
78  "stripEtaAssociationDistance");
80  "stripPhiAssociationDistance");
81  combineStrips_ = pset.getParameter<bool>("makeCombinatoricStrips");
82  if (combineStrips_) {
83  maxStrips_ = pset.getParameter<int>("maxInputStrips");
85  pset.getParameter<double>("stripMassWhenCombining");
86  }
87 }
T getParameter(std::string const &) const
RecoTauPiZeroBuilderPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
ParameterSet const & getParameterSet(std::string const &) const
virtual reco::tau::RecoTauPiZeroStripPlugin::~RecoTauPiZeroStripPlugin ( )
inlinevirtual

Definition at line 47 of file RecoTauPiZeroStripPlugin.cc.

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

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

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

References reco::tau::RecoTauVertexAssociator::associatedVertex(), combinatoricStripMassHypo_, combineStrips_, reco::deltaPhi(), etaAssociationDistance_, reco::tau::RecoTauQualityCuts::filterCandRefs(), first, inputPdgIds_, reco::RecoTauPiZero::kStrips, reco::RecoTauPiZero::kUndefined, maxStrips_, convertSQLitetoXML_cfg::output, p4Builder_, reco::tau::pfCandidates(), phiAssociationDistance_, reco::LeafCandidate::pt(), qcuts_, edm::second(), fileCollector::seed, AddFourMomenta::set(), reco::tau::RecoTauQualityCuts::setPV(), reco::tau::takeNElements(), and vertexAssociator_.

95  {
96  // Get list of gamma candidates
97  typedef std::vector<reco::PFCandidatePtr> PFCandPtrs;
98  typedef PFCandPtrs::iterator PFCandIter;
100 
101  // Get the candidates passing our quality cuts
103  PFCandPtrs candsVector = qcuts_.filterCandRefs(pfCandidates(jet, inputPdgIds_));
104  //PFCandPtrs candsVector = qcuts_.filterCandRefs(pfGammas(jet));
105 
106  // Convert to stl::list to allow fast deletions
107  typedef std::list<reco::PFCandidatePtr> PFCandPtrList;
108  typedef std::list<reco::PFCandidatePtr>::iterator PFCandPtrListIter;
109  PFCandPtrList cands;
110  cands.insert(cands.end(), candsVector.begin(), candsVector.end());
111 
112  while (cands.size() > 0) {
113  // Seed this new strip, and delete it from future strips
114  PFCandidatePtr seed = cands.front();
115  cands.pop_front();
116 
117  // Add a new candidate to our collection using this seed
118  std::auto_ptr<RecoTauPiZero> strip(new RecoTauPiZero(
119  *seed, RecoTauPiZero::kStrips));
120  strip->addDaughter(seed);
121 
122  // Find all other objects in the strip
123  PFCandPtrListIter stripCand = cands.begin();
124  while(stripCand != cands.end()) {
125  if( fabs(strip->eta() - (*stripCand)->eta()) < etaAssociationDistance_
126  && fabs(deltaPhi(*strip, **stripCand)) < phiAssociationDistance_ ) {
127  // Add candidate to strip
128  strip->addDaughter(*stripCand);
129  // Update the strips four momenta
130  p4Builder_.set(*strip);
131  // Delete this candidate from future strips and move on to
132  // the next potential candidate
133  stripCand = cands.erase(stripCand);
134  } else {
135  // This candidate isn't compatabile - just move to the next candidate
136  ++stripCand;
137  }
138  }
139  // Update the vertex
140  if (strip->daughterPtr(0).isNonnull())
141  strip->setVertex(strip->daughterPtr(0)->vertex());
142  output.push_back(strip);
143  }
144 
145  // Check if we want to combine our strips
146  if (combineStrips_ && output.size() > 1) {
147  PiZeroVector stripCombinations;
148  // Sort the output by descending pt
149  output.sort(output.begin(), output.end(),
150  boost::bind(&RecoTauPiZero::pt, _1) >
151  boost::bind(&RecoTauPiZero::pt, _2));
152  // Get the end of interesting set of strips to try and combine
153  PiZeroVector::const_iterator end_iter = takeNElements(
154  output.begin(), output.end(), maxStrips_);
155 
156  // Look at all the combinations
157  for (PiZeroVector::const_iterator first = output.begin();
158  first != end_iter-1; ++first) {
159  for (PiZeroVector::const_iterator second = first+1;
160  second != end_iter; ++second) {
161  Candidate::LorentzVector firstP4 = first->p4();
162  Candidate::LorentzVector secondP4 = second->p4();
163  // If we assume a certain mass for each strip apply it here.
164  firstP4 = applyMassConstraint(firstP4, combinatoricStripMassHypo_);
165  secondP4 = applyMassConstraint(secondP4, combinatoricStripMassHypo_);
166  Candidate::LorentzVector totalP4 = firstP4 + secondP4;
167  // Make our new combined strip
168  std::auto_ptr<RecoTauPiZero> combinedStrips(
169  new RecoTauPiZero(0, totalP4,
170  Candidate::Point(0, 0, 0),
171  //111, 10001, true, RecoTauPiZero::kCombinatoricStrips));
172  111, 10001, true, RecoTauPiZero::kUndefined));
173 
174  // Now loop over the strip members
175  BOOST_FOREACH(const RecoTauPiZero::daughters::value_type& gamma,
176  first->daughterPtrVector()) {
177  combinedStrips->addDaughter(gamma);
178  }
179  BOOST_FOREACH(const RecoTauPiZero::daughters::value_type& gamma,
180  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);
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 }
InputIterator takeNElements(const InputIterator &begin, const InputIterator &end, size_t N)
virtual float pt() const
transverse momentum
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.
bool first
Definition: L1TdeRCT.cc:75
Container::value_type value_type
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
boost::ptr_vector< RecoTauPiZero > PiZeroVector
PFCandPtrs::iterator PFCandIter
math::XYZPoint Point
point in the space
Definition: Candidate.h:45
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 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::inputPdgIds_
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().

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