17 #include "boost/bind.hpp"
41 namespace reco {
namespace tau {
47 double factor =
sqrt(vec.energy()*vec.energy()-mass*
mass)/vec.P();
49 vec.px()*factor,vec.py()*factor,vec.pz()*factor,vec.energy());
95 vertexAssociator_(pset.getParameter<edm::
ParameterSet>(
"qualityCuts"), std::
move(iC)),
110 qcuts_pset.addParameter<
double>(
"maxTrackChi2", 1.e+9);
111 qcuts_pset.addParameter<
double>(
"maxTransverseImpactParameter", 1.e+9);
112 qcuts_pset.addParameter<
double>(
"maxDeltaZ", 1.e+9);
113 qcuts_pset.addParameter<
double>(
"minTrackVertexWeight", -1.);
114 qcuts_pset.addParameter<
unsigned>(
"minTrackPixelHits", 0);
115 qcuts_pset.addParameter<
unsigned>(
"minTrackHits", 0);
129 if ( combineStrips_ ) {
150 std::set<size_t>& candIdsCurrentStrip,
bool& isCandAdded)
const
153 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"<RecoTauPiZeroStripPlugin2::addCandsToStrip>:" ;
155 size_t numCands = cands.size();
156 for (
size_t candId = 0; candId < numCands; ++candId ) {
157 if ( (!candFlags[candId]) && candIdsCurrentStrip.find(candId) == candIdsCurrentStrip.end() ) {
162 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"--> adding PFCand #" << candId <<
" (" << cand.
id() <<
":" << cand.
key() <<
"): Et = " << cand->et() <<
", eta = " << cand->eta() <<
", phi = " << cand->phi() ;
167 candIdsCurrentStrip.insert(candId);
175 void markCandsInStrip(std::vector<bool>& candFlags,
const std::set<size_t>& candIds)
177 for ( std::set<size_t>::const_iterator candId = candIds.begin();
178 candId != candIds.end(); ++candId ) {
179 candFlags[*candId] =
true;
186 else if ( cand.gsfTrackRef().isNonnull() )
return reco::TrackBaseRef(cand.gsfTrackRef());
194 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"<RecoTauPiZeroStripPlugin2::operator()>:" ;
210 for ( PFCandPtrs::iterator cand = candsVector.begin();
211 cand != candsVector.end(); ++cand ) {
213 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"PFGamma #" << idx <<
" (" << cand->id() <<
":" << cand->key() <<
"): Et = " << (*cand)->et() <<
", eta = " << (*cand)->eta() <<
", phi = " << (*cand)->phi() ;
217 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"--> assigning seedCandId = " << seedCands.size() ;
220 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"track: Pt = " << candTrack->
pt() <<
" eta = " << candTrack->
eta() <<
", phi = " << candTrack->
phi() <<
", charge = " << candTrack->
charge() ;
223 <<
" chi2 = " << candTrack->
normalizedChi2() <<
", dPt/Pt = " << (candTrack->
ptError()/candTrack->
pt()) <<
")" ;
225 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"ECAL Et: calibrated = " << (*cand)->ecalEnergy()*
sin((*cand)->theta()) <<
","
226 <<
" raw = " << (*cand)->rawEcalEnergy()*
sin((*cand)->theta()) ;
227 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"HCAL Et: calibrated = " << (*cand)->hcalEnergy()*
sin((*cand)->theta()) <<
","
228 <<
" raw = " << (*cand)->rawHcalEnergy()*
sin((*cand)->theta()) ;
230 seedCands.push_back(*cand);
233 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"--> assigning addCandId = " << addCands.size() ;
235 addCands.push_back(*cand);
240 std::vector<bool> seedCandFlags(seedCands.size());
241 std::vector<bool> addCandFlags(addCands.size());
243 std::set<size_t> seedCandIdsCurrentStrip;
244 std::set<size_t> addCandIdsCurrentStrip;
247 while ( idxSeed < seedCands.size() ) {
250 seedCandIdsCurrentStrip.clear();
251 addCandIdsCurrentStrip.clear();
254 strip->addDaughter(seedCands[idxSeed]);
255 seedCandIdsCurrentStrip.insert(idxSeed);
258 int stripBuildIteration = 0;
263 addCandsToStrip(*strip, seedCands, seedCandFlags, seedCandIdsCurrentStrip, isCandAdded);
265 addCandsToStrip(*strip, addCands, addCandFlags, addCandIdsCurrentStrip, isCandAdded);
269 ++stripBuildIteration;
273 if (
verbosity_ >= 2 )
edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"Building strip: Et = " << strip->et() <<
", eta = " << strip->eta() <<
", phi = " << strip->phi() ;
276 if ( strip->daughterPtr(0).isNonnull() ) strip->setVertex(strip->daughterPtr(0)->vertex());
277 output.push_back(strip);
280 markCandsInStrip(seedCandFlags, seedCandIdsCurrentStrip);
281 markCandsInStrip(addCandFlags, addCandIdsCurrentStrip);
283 if (
verbosity_ >= 2 )
edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"Discarding strip: Et = " << strip->et() <<
", eta = " << strip->eta() <<
", phi = " << strip->phi() ;
287 while ( idxSeed < seedCands.size() && seedCandFlags[idxSeed] ) {
296 output.sort(output.begin(), output.end(),
304 for ( PiZeroVector::const_iterator
first = output.begin();
306 for ( PiZeroVector::const_iterator
second =
first+1;
315 std::auto_ptr<RecoTauPiZero> combinedStrips(
323 first->daughterPtrVector()) {
324 combinedStrips->addDaughter(gamma);
327 second->daughterPtrVector()) {
328 combinedStrips->addDaughter(gamma);
331 if ( combinedStrips->daughterPtr(0).isNonnull() )
332 combinedStrips->setVertex(combinedStrips->daughterPtr(0)->vertex());
334 stripCombinations.push_back(combinedStrips);
339 output.transfer(output.end(), stripCombinations);
342 return output.release();
double minGammaEtStripSeed_
RecoTauPiZeroStripPlugin2(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
T getParameter(std::string const &) const
InputIterator takeNElements(const InputIterator &begin, const InputIterator &end, size_t N)
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
virtual ~RecoTauPiZeroStripPlugin2()
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of PFCandidates.
double etaAssociationDistance_
Sin< T >::type sin(const T &t)
reco::VertexRef associatedVertex(const PFJet &jet) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
virtual double phi() const final
momentum azimuthal angle
double phi() const
azimuthal angle of momentum vector
void setEvent(const edm::Event &evt)
Load the vertices from the event.
RecoTauVertexAssociator vertexAssociator_
bool isNonnull() const
Checks for non-null.
bool applyElecTrackQcuts_
Jets made from PFObjects.
bool updateStripAfterEachDaughter_
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
U second(std::pair< T, U > const &p)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Container::value_type value_type
double eta() const
pseudorapidity of momentum vector
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
void setPV(const reco::VertexRef &vtx) const
Update the primary vertex.
double pt() const
track transverse momentum
std::vector< int > inputPdgIds_
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
double phiAssociationDistance_
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
return_type operator()(const reco::PFJet &) const override
Build a collection of piZeros from objects in the input jet.
const edm::Event * evt() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
ParameterSet const & getParameterSet(std::string const &) const
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
ProductID id() const
Accessor for product ID.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
double minGammaEtStripAdd_
int numberOfValidTrackerHits() const
std::auto_ptr< PiZeroVector > return_type
int maxStripBuildIterations_
double combinatoricStripMassHypo_
boost::ptr_vector< RecoTauPiZero > PiZeroVector
std::vector< reco::PFCandidatePtr > PFCandPtrs
void addDaughter(const CandidatePtr &)
add a daughter via a reference
int numberOfValidPixelHits() const
math::XYZPoint Point
point in the space
int charge() const
track electric charge
#define DEFINE_EDM_PLUGIN(factory, type, name)
void set(reco::Candidate &c) const
set up a candidate
virtual double eta() const final
momentum pseudorapidity
virtual void beginEvent() override
Hook called at the beginning of the event.
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
RecoTauQualityCuts * qcuts_
void addCandsToStrip(RecoTauPiZero &, PFCandPtrs &, const std::vector< bool > &, std::set< size_t > &, bool &) const
AddFourMomenta p4Builder_
virtual double pt() const final
transverse momentum