47 double factor =
sqrt(vec.energy() * vec.energy() - mass *
mass) / vec.P();
62 typedef std::vector<reco::CandidatePtr>
CandPtrs;
93 vertexAssociator_(pset.getParameter<edm::
ParameterSet>(
"qualityCuts"), std::
move(iC)),
107 qcuts_pset.addParameter<
double>(
"maxTrackChi2", 1.e+9);
108 qcuts_pset.addParameter<
double>(
"maxTransverseImpactParameter", 1.e+9);
109 qcuts_pset.addParameter<
double>(
"maxDeltaZ", 1.e+9);
110 qcuts_pset.addParameter<
double>(
"minTrackVertexWeight", -1.);
111 qcuts_pset.addParameter<
unsigned>(
"minTrackPixelHits", 0);
112 qcuts_pset.addParameter<
unsigned>(
"minTrackHits", 0);
126 if (combineStrips_) {
141 const std::vector<bool>& candFlags,
142 std::set<size_t>& candIdsCurrentStrip,
143 bool& isCandAdded)
const {
145 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"<RecoTauPiZeroStripPlugin2::addCandsToStrip>:";
147 size_t numCands = cands.size();
148 for (
size_t candId = 0; candId < numCands; ++candId) {
149 if ((!candFlags[candId]) &&
150 candIdsCurrentStrip.find(candId) == candIdsCurrentStrip.end()) {
152 if (fabs(strip.
eta() - cand->eta()) <
157 <<
"--> adding PFCand #" << candId <<
" (" << cand.
id() <<
":" << cand.
key()
158 <<
"): Et = " << cand->et() <<
", eta = " << cand->eta() <<
", phi = " << cand->phi();
164 candIdsCurrentStrip.insert(candId);
171 void markCandsInStrip(std::vector<bool>& candFlags,
const std::set<size_t>& candIds) {
172 for (std::set<size_t>::const_iterator candId = candIds.begin(); candId != candIds.end(); ++candId) {
173 candFlags[*candId] =
true;
178 const PFCandidate* pfCandPtr =
dynamic_cast<const PFCandidate*
>(&cand);
180 if (pfCandPtr->trackRef().isNonnull())
182 else if (pfCandPtr->gsfTrackRef().isNonnull())
194 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"<RecoTauPiZeroStripPlugin2::operator()>:";
210 for (CandPtrs::iterator cand = candsVector.begin(); cand != candsVector.end(); ++cand) {
213 <<
"PFGamma #" << idx <<
" (" << cand->id() <<
":" << cand->key() <<
"): Et = " << (*cand)->et()
214 <<
", eta = " << (*cand)->eta() <<
", phi = " << (*cand)->phi();
218 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"--> assigning seedCandId = " << seedCands.size();
222 <<
"track: Pt = " << candTrack->
pt() <<
" eta = " << candTrack->
eta()
223 <<
", phi = " << candTrack->
phi() <<
", charge = " << candTrack->
charge();
230 <<
", dPt/Pt = " << (candTrack->
ptError() / candTrack->
pt()) <<
")";
233 seedCands.push_back(*cand);
236 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"--> assigning addCandId = " << addCands.size();
238 addCands.push_back(*cand);
243 std::vector<bool> seedCandFlags(seedCands.size());
244 std::vector<bool> addCandFlags(addCands.size());
246 std::set<size_t> seedCandIdsCurrentStrip;
247 std::set<size_t> addCandIdsCurrentStrip;
250 while (idxSeed < seedCands.size()) {
252 edm::LogPrint(
"RecoTauPiZeroStripPlugin2") <<
"processing seed #" << idxSeed;
254 seedCandIdsCurrentStrip.clear();
255 addCandIdsCurrentStrip.clear();
258 strip->addDaughter(seedCands[idxSeed]);
259 seedCandIdsCurrentStrip.insert(idxSeed);
262 int stripBuildIteration = 0;
267 addCandsToStrip(*strip, seedCands, seedCandFlags, seedCandIdsCurrentStrip, isCandAdded);
269 addCandsToStrip(*strip, addCands, addCandFlags, addCandIdsCurrentStrip, isCandAdded);
274 ++stripBuildIteration;
280 <<
"Building strip: Et = " << strip->et() <<
", eta = " << strip->eta() <<
", phi = " << strip->phi();
283 if (strip->daughterPtr(0).isNonnull())
284 strip->setVertex(strip->daughterPtr(0)->vertex());
288 markCandsInStrip(seedCandFlags, seedCandIdsCurrentStrip);
289 markCandsInStrip(addCandFlags, addCandIdsCurrentStrip);
293 <<
"Discarding strip: Et = " << strip->et() <<
", eta = " << strip->eta() <<
", phi = " << strip->phi();
297 while (idxSeed < seedCands.size() && seedCandFlags[idxSeed]) {
306 std::sort(output.begin(), output.end(), [&](
auto& arg1,
auto& arg2) {
return arg1->pt() > arg2->pt(); });
311 for (PiZeroVector::const_iterator firstIter = output.begin(); firstIter != end_iter - 1; ++firstIter) {
312 for (PiZeroVector::const_iterator secondIter = firstIter + 1; secondIter != end_iter; ++secondIter) {
313 auto const&
first = *firstIter;
314 auto const&
second = *secondIter;
322 auto combinedStrips =
323 std::make_unique<RecoTauPiZero>(0,
333 for (
auto const& gamma :
first->daughterPtrVector()) {
334 combinedStrips->addDaughter(gamma);
336 for (
auto const& gamma :
second->daughterPtrVector()) {
337 combinedStrips->addDaughter(gamma);
340 if (combinedStrips->daughterPtr(0).isNonnull())
341 combinedStrips->setVertex(combinedStrips->daughterPtr(0)->vertex());
343 stripCombinations.push_back(
std::move(combinedStrips));
348 std::move(stripCombinations.begin(), stripCombinations.end(), std::back_inserter(output));
double minGammaEtStripSeed_
RecoTauPiZeroStripPlugin2(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
std::vector< CandidatePtr > pfCandidates(const Jet &jet, int particleId, bool sort=true)
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)
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of Candidates.
double etaAssociationDistance_
Base class for all types of Jets.
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_
bool updateStripAfterEachDaughter_
~RecoTauPiZeroStripPlugin2() override
U second(std::pair< T, U > const &p)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
double eta() const
pseudorapidity of momentum vector
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
double pt() const
track transverse momentum
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
double phiAssociationDistance_
Log< level::Warning, true > LogPrint
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)
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
T getParameter(std::string const &) const
std::vector< std::unique_ptr< RecoTauPiZero > > PiZeroVector
ProductID id() const
Accessor for product ID.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
double minGammaEtStripAdd_
int numberOfValidTrackerHits() const
int maxStripBuildIterations_
double combinatoricStripMassHypo_
reco::VertexRef associatedVertex(const Jet &jet) const
std::vector< int > inputParticleIds_
void addDaughter(const CandidatePtr &)
add a daughter via a reference
int numberOfValidPixelHits() const
std::vector< reco::CandidatePtr > CandPtrs
math::XYZPoint Point
point in the space
int charge() const
track electric charge
#define DEFINE_EDM_PLUGIN(factory, type, name)
return_type operator()(const reco::Jet &) const override
Build a collection of piZeros from objects in the input jet.
void set(reco::Candidate &c) const
set up a candidate
void addCandsToStrip(RecoTauPiZero &, CandPtrs &, const std::vector< bool > &, std::set< size_t > &, bool &) const
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...
double phi() const final
momentum azimuthal angle
void setPV(const reco::VertexRef &vtx)
Update the primary vertex.
RecoTauQualityCuts * qcuts_
AddFourMomenta p4Builder_
double eta() const final
momentum pseudorapidity