65 typedef std::vector<reco::CandidatePtr>
CandPtrs;
70 std::unique_ptr<RecoTauQualityCuts>
qcuts_;
98 auto function = std::make_unique<TFormula>(functionName.data(),
formula.Data());
99 int numParameter =
function->GetNpar();
100 for (
int idxParameter = 0; idxParameter < numParameter; ++idxParameter) {
101 std::string parameterName = Form(
"par%i", idxParameter);
103 function->SetParameter(idxParameter,
parameter);
113 etaAssociationDistance_(nullptr),
114 phiAssociationDistance_(nullptr) {
120 edm::ParameterSet qcuts_pset =
pset.getParameterSet(
"qualityCuts").getParameterSet(
"signalQualityCuts");
127 qcuts_pset.addParameter<
double>(
"maxTrackChi2", 1.e+9);
128 qcuts_pset.addParameter<
double>(
"maxTransverseImpactParameter", 1.e+9);
129 qcuts_pset.addParameter<
double>(
"maxDeltaZ", 1.e+9);
130 qcuts_pset.addParameter<
double>(
"minTrackVertexWeight", -1.);
131 qcuts_pset.addParameter<
unsigned>(
"minTrackPixelHits", 0);
132 qcuts_pset.addParameter<
unsigned>(
"minTrackHits", 0);
136 qcuts_ = std::make_unique<RecoTauQualityCuts>(qcuts_pset);
139 const edm::ParameterSet& stripSize_eta_pset =
pset.getParameterSet(
"stripEtaAssociationDistanceFunc");
141 const edm::ParameterSet& stripSize_phi_pset =
pset.getParameterSet(
"stripPhiAssociationDistanceFunc");
162 const std::vector<bool>& candFlags,
163 std::set<size_t>& candIdsCurrentStrip,
164 bool& isCandAdded)
const {
166 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"<RecoTauPiZeroStripPlugin3::addCandsToStrip>:";
168 size_t numCands =
cands.size();
169 for (
size_t candId = 0; candId < numCands; ++candId) {
170 if ((!candFlags[candId]) &&
171 candIdsCurrentStrip.find(candId) == candIdsCurrentStrip.end()) {
173 double etaAssociationDistance_value =
175 double phiAssociationDistance_value =
178 etaAssociationDistance_value &&
182 <<
"--> adding PFCand #" << candId <<
" (" <<
cand.id() <<
":" <<
cand.key()
183 <<
"): Et = " <<
cand->et() <<
", eta = " <<
cand->eta() <<
", phi = " <<
cand->phi();
189 candIdsCurrentStrip.insert(candId);
196 void markCandsInStrip(std::vector<bool>& candFlags,
const std::set<size_t>& candIds) {
197 for (std::set<size_t>::const_iterator candId = candIds.begin(); candId != candIds.end(); ++candId) {
198 candFlags[*candId] =
true;
208 if (pfCandPtr->trackRef().isNonnull())
210 else if (pfCandPtr->gsfTrackRef().isNonnull())
222 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"<RecoTauPiZeroStripPlugin3::operator()>:";
238 for (CandPtrs::iterator
cand = candsVector.begin();
cand != candsVector.end(); ++
cand) {
241 <<
"PFGamma #" <<
idx <<
" (" <<
cand->id() <<
":" <<
cand->key() <<
"): Et = " << (*cand)->et()
242 <<
", eta = " << (*cand)->eta() <<
", phi = " << (*cand)->phi();
246 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"--> assigning seedCandId = " << seedCands.size();
250 <<
"track: Pt = " << candTrack->
pt() <<
" eta = " << candTrack->
eta()
251 <<
", phi = " << candTrack->
phi() <<
", charge = " << candTrack->
charge();
258 <<
", dPt/Pt = " << (candTrack->
ptError() / candTrack->
pt()) <<
")";
261 seedCands.push_back(*
cand);
264 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"--> assigning addCandId = " << addCands.size();
266 addCands.push_back(*
cand);
271 std::vector<bool> seedCandFlags(seedCands.size());
272 std::vector<bool> addCandFlags(addCands.size());
274 std::set<size_t> seedCandIdsCurrentStrip;
275 std::set<size_t> addCandIdsCurrentStrip;
278 while (idxSeed < seedCands.size()) {
280 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"processing seed #" << idxSeed;
282 seedCandIdsCurrentStrip.clear();
283 addCandIdsCurrentStrip.clear();
286 strip->addDaughter(seedCands[idxSeed]);
287 seedCandIdsCurrentStrip.insert(idxSeed);
290 int stripBuildIteration = 0;
302 ++stripBuildIteration;
308 <<
"Building strip: Et = " <<
strip->et() <<
", eta = " <<
strip->eta() <<
", phi = " <<
strip->phi();
311 if (
strip->daughterPtr(0).isNonnull())
312 strip->setVertex(
strip->daughterPtr(0)->vertex());
316 markCandsInStrip(seedCandFlags, seedCandIdsCurrentStrip);
317 markCandsInStrip(addCandFlags, addCandIdsCurrentStrip);
321 <<
"Discarding strip: Et = " <<
strip->et() <<
", eta = " <<
strip->eta() <<
", phi = " <<
strip->phi();
325 while (idxSeed < seedCands.size() && seedCandFlags[idxSeed]) {
334 std::sort(
output.begin(),
output.end(), [&](
auto& arg1,
auto& arg2) {
return arg1->pt() > arg2->pt(); });
339 for (PiZeroVector::const_iterator firstIter =
output.begin(); firstIter != end_iter - 1; ++firstIter) {
340 for (PiZeroVector::const_iterator secondIter = firstIter + 1; secondIter != end_iter; ++secondIter) {
341 auto const&
first = *firstIter;
342 auto const&
second = *secondIter;
350 auto combinedStrips =
351 std::make_unique<RecoTauPiZero>(0,
361 for (
auto const&
gamma :
first->daughterPtrVector()) {
362 combinedStrips->addDaughter(
gamma);
364 for (
auto const&
gamma :
second->daughterPtrVector()) {
365 combinedStrips->addDaughter(
gamma);
368 if (combinedStrips->daughterPtr(0).isNonnull()) {
369 combinedStrips->setVertex(combinedStrips->daughterPtr(0)->vertex());
373 stripCombinations.push_back(
std::move(combinedStrips));
378 std::move(stripCombinations.begin(), stripCombinations.end(), std::back_inserter(
output));
384 double bendCorrEta = 0.;
385 double bendCorrPhi = 0.;
387 for (
auto const&
gamma :
strip->daughterPtrVector()) {
397 strip->setBendCorrEta(bendCorrEta);
398 strip->setBendCorrPhi(bendCorrPhi);
int numberOfValidPixelHits() const
constexpr double deltaPhi(double phi1, double phi2)
std::vector< CandidatePtr > pfCandidates(const Jet &jet, int particleId, bool sort=true)
InputIterator takeNElements(const InputIterator &begin, const InputIterator &end, size_t N)
void set(reco::Candidate &c) const
set up a candidate
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
bool isNonnull() const
Checks for non-null.
Base class for all types of Jets.
void addCandsToStrip(RecoTauPiZero &, CandPtrs &, const std::vector< bool > &, std::set< size_t > &, bool &) const
bool updateStripAfterEachDaughter_
void setEvent(const edm::Event &evt)
Load the vertices from the event.
return_type operator()(const reco::Jet &) const override
Build a collection of piZeros from objects in the input jet.
~RecoTauPiZeroStripPlugin3() override
reco::VertexRef associatedVertex(const Jet &jet) const
U second(std::pair< T, U > const &p)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
double pt() const
track transverse momentum
int charge() const
track electric charge
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...
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
bool applyElecTrackQcuts_
double phi() const
azimuthal angle of momentum vector
std::vector< reco::CandidatePtr > CandPtrs
void beginEvent() override
Hook called at the beginning of the event.
const edm::Event * evt() const
std::unique_ptr< const TFormula > etaAssociationDistance_
Log< level::Warning, true > LogPrint
std::unique_ptr< RecoTauQualityCuts > qcuts_
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
double eta() const
pseudorapidity of momentum vector
double minGammaEtStripSeed_
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
int maxStripBuildIterations_
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
std::vector< std::unique_ptr< RecoTauPiZero > > PiZeroVector
double combinatoricStripMassHypo_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
RecoTauPiZeroStripPlugin3(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
std::unique_ptr< const TFormula > phiAssociationDistance_
RecoTauVertexAssociator vertexAssociator_
AddFourMomenta p4Builder_
std::vector< int > inputParticleIds_
double minGammaEtStripAdd_
math::XYZPoint Point
point in the space
#define DEFINE_EDM_PLUGIN(factory, type, name)
double energySum(const DataFrame &df, int fs, int ls)
int numberOfValidTrackerHits() const
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...