65 typedef std::vector<reco::CandidatePtr>
CandPtrs;
70 std::unique_ptr<RecoTauQualityCuts>
qcuts_;
98 std::unique_ptr<TFormula>
function(
new 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);
139 qcuts_ = std::make_unique<RecoTauQualityCuts>(qcuts_pset);
142 const edm::ParameterSet& stripSize_eta_pset =
pset.getParameterSet(
"stripEtaAssociationDistanceFunc");
144 const edm::ParameterSet& stripSize_phi_pset =
pset.getParameterSet(
"stripPhiAssociationDistanceFunc");
165 const std::vector<bool>& candFlags,
166 std::set<size_t>& candIdsCurrentStrip,
167 bool& isCandAdded)
const {
169 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"<RecoTauPiZeroStripPlugin3::addCandsToStrip>:";
171 size_t numCands =
cands.size();
172 for (
size_t candId = 0; candId < numCands; ++candId) {
173 if ((!candFlags[candId]) &&
174 candIdsCurrentStrip.find(candId) == candIdsCurrentStrip.end()) {
176 double etaAssociationDistance_value =
178 double phiAssociationDistance_value =
181 etaAssociationDistance_value &&
185 <<
"--> adding PFCand #" << candId <<
" (" <<
cand.id() <<
":" <<
cand.key()
186 <<
"): Et = " <<
cand->et() <<
", eta = " <<
cand->eta() <<
", phi = " <<
cand->phi();
192 candIdsCurrentStrip.insert(candId);
199 void markCandsInStrip(std::vector<bool>& candFlags,
const std::set<size_t>& candIds) {
200 for (std::set<size_t>::const_iterator candId = candIds.begin(); candId != candIds.end(); ++candId) {
201 candFlags[*candId] =
true;
209 const PFCandidate* pfCandPtr = dynamic_cast<const PFCandidate*>(&
cand);
211 if (pfCandPtr->trackRef().isNonnull())
213 else if (pfCandPtr->gsfTrackRef().isNonnull())
225 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"<RecoTauPiZeroStripPlugin3::operator()>:";
241 for (CandPtrs::iterator
cand = candsVector.begin();
cand != candsVector.end(); ++
cand) {
244 <<
"PFGamma #" <<
idx <<
" (" <<
cand->id() <<
":" <<
cand->key() <<
"): Et = " << (*cand)->et()
245 <<
", eta = " << (*cand)->eta() <<
", phi = " << (*cand)->phi();
249 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"--> assigning seedCandId = " << seedCands.size();
253 <<
"track: Pt = " << candTrack->
pt() <<
" eta = " << candTrack->
eta()
254 <<
", phi = " << candTrack->
phi() <<
", charge = " << candTrack->
charge();
261 <<
", dPt/Pt = " << (candTrack->
ptError() / candTrack->
pt()) <<
")";
264 seedCands.push_back(*
cand);
267 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"--> assigning addCandId = " << addCands.size();
269 addCands.push_back(*
cand);
274 std::vector<bool> seedCandFlags(seedCands.size());
275 std::vector<bool> addCandFlags(addCands.size());
277 std::set<size_t> seedCandIdsCurrentStrip;
278 std::set<size_t> addCandIdsCurrentStrip;
281 while (idxSeed < seedCands.size()) {
283 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"processing seed #" << idxSeed;
285 seedCandIdsCurrentStrip.clear();
286 addCandIdsCurrentStrip.clear();
289 strip->addDaughter(seedCands[idxSeed]);
290 seedCandIdsCurrentStrip.insert(idxSeed);
293 int stripBuildIteration = 0;
305 ++stripBuildIteration;
311 <<
"Building strip: Et = " <<
strip->et() <<
", eta = " <<
strip->eta() <<
", phi = " <<
strip->phi();
314 if (
strip->daughterPtr(0).isNonnull())
315 strip->setVertex(
strip->daughterPtr(0)->vertex());
319 markCandsInStrip(seedCandFlags, seedCandIdsCurrentStrip);
320 markCandsInStrip(addCandFlags, addCandIdsCurrentStrip);
324 <<
"Discarding strip: Et = " <<
strip->et() <<
", eta = " <<
strip->eta() <<
", phi = " <<
strip->phi();
328 while (idxSeed < seedCands.size() && seedCandFlags[idxSeed]) {
337 output.sort(
output.begin(),
output.end(), [&](
auto& arg1,
auto& arg2) {
return arg1.pt() > arg2.pt(); });
351 std::unique_ptr<RecoTauPiZero> combinedStrips(
362 for (
auto const&
gamma :
first->daughterPtrVector()) {
363 combinedStrips->addDaughter(
gamma);
365 for (
auto const&
gamma :
second->daughterPtrVector()) {
366 combinedStrips->addDaughter(
gamma);
369 if (combinedStrips->daughterPtr(0).isNonnull()) {
370 combinedStrips->setVertex(combinedStrips->daughterPtr(0)->vertex());
374 stripCombinations.push_back(
std::move(combinedStrips));
385 double bendCorrEta = 0.;
386 double bendCorrPhi = 0.;
388 for (
auto const&
gamma :
strip->daughterPtrVector()) {
398 strip->setBendCorrEta(bendCorrEta);
399 strip->setBendCorrPhi(bendCorrPhi);