64 typedef std::vector<reco::CandidatePtr>
CandPtrs;
69 std::unique_ptr<RecoTauQualityCuts>
qcuts_;
97 std::unique_ptr<TFormula>
function(
new TFormula(functionName.data(),
formula.Data()));
98 int numParameter =
function->GetNpar();
99 for (
int idxParameter = 0; idxParameter < numParameter; ++idxParameter) {
100 std::string parameterName = Form(
"par%i", idxParameter);
102 function->SetParameter(idxParameter,
parameter);
112 etaAssociationDistance_(nullptr),
113 phiAssociationDistance_(nullptr) {
119 edm::ParameterSet qcuts_pset =
pset.getParameterSet(
"qualityCuts").getParameterSet(
"signalQualityCuts");
126 qcuts_pset.addParameter<
double>(
"maxTrackChi2", 1.e+9);
127 qcuts_pset.addParameter<
double>(
"maxTransverseImpactParameter", 1.e+9);
128 qcuts_pset.addParameter<
double>(
"maxDeltaZ", 1.e+9);
129 qcuts_pset.addParameter<
double>(
"minTrackVertexWeight", -1.);
130 qcuts_pset.addParameter<
unsigned>(
"minTrackPixelHits", 0);
131 qcuts_pset.addParameter<
unsigned>(
"minTrackHits", 0);
138 qcuts_ = std::make_unique<RecoTauQualityCuts>(qcuts_pset);
141 const edm::ParameterSet& stripSize_eta_pset =
pset.getParameterSet(
"stripEtaAssociationDistanceFunc");
143 const edm::ParameterSet& stripSize_phi_pset =
pset.getParameterSet(
"stripPhiAssociationDistanceFunc");
164 const std::vector<bool>& candFlags,
165 std::set<size_t>& candIdsCurrentStrip,
166 bool& isCandAdded)
const {
168 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"<RecoTauPiZeroStripPlugin3::addCandsToStrip>:";
170 size_t numCands =
cands.size();
171 for (
size_t candId = 0; candId < numCands; ++candId) {
172 if ((!candFlags[candId]) &&
173 candIdsCurrentStrip.find(candId) == candIdsCurrentStrip.end()) {
175 double etaAssociationDistance_value =
177 double phiAssociationDistance_value =
180 etaAssociationDistance_value &&
184 <<
"--> adding PFCand #" << candId <<
" (" <<
cand.id() <<
":" <<
cand.key()
185 <<
"): Et = " <<
cand->et() <<
", eta = " <<
cand->eta() <<
", phi = " <<
cand->phi();
191 candIdsCurrentStrip.insert(candId);
198 void markCandsInStrip(std::vector<bool>& candFlags,
const std::set<size_t>& candIds) {
199 for (std::set<size_t>::const_iterator candId = candIds.begin(); candId != candIds.end(); ++candId) {
200 candFlags[*candId] =
true;
208 const PFCandidate* pfCandPtr = dynamic_cast<const PFCandidate*>(&
cand);
210 if (pfCandPtr->trackRef().isNonnull())
212 else if (pfCandPtr->gsfTrackRef().isNonnull())
224 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"<RecoTauPiZeroStripPlugin3::operator()>:";
240 for (CandPtrs::iterator
cand = candsVector.begin();
cand != candsVector.end(); ++
cand) {
243 <<
"PFGamma #" <<
idx <<
" (" <<
cand->id() <<
":" <<
cand->key() <<
"): Et = " << (*cand)->et()
244 <<
", eta = " << (*cand)->eta() <<
", phi = " << (*cand)->phi();
248 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"--> assigning seedCandId = " << seedCands.size();
252 <<
"track: Pt = " << candTrack->
pt() <<
" eta = " << candTrack->
eta()
253 <<
", phi = " << candTrack->
phi() <<
", charge = " << candTrack->
charge();
260 <<
", dPt/Pt = " << (candTrack->
ptError() / candTrack->
pt()) <<
")";
263 seedCands.push_back(*
cand);
266 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"--> assigning addCandId = " << addCands.size();
268 addCands.push_back(*
cand);
273 std::vector<bool> seedCandFlags(seedCands.size());
274 std::vector<bool> addCandFlags(addCands.size());
276 std::set<size_t> seedCandIdsCurrentStrip;
277 std::set<size_t> addCandIdsCurrentStrip;
280 while (idxSeed < seedCands.size()) {
282 edm::LogPrint(
"RecoTauPiZeroStripPlugin3") <<
"processing seed #" << idxSeed;
284 seedCandIdsCurrentStrip.clear();
285 addCandIdsCurrentStrip.clear();
288 strip->addDaughter(seedCands[idxSeed]);
289 seedCandIdsCurrentStrip.insert(idxSeed);
292 int stripBuildIteration = 0;
304 ++stripBuildIteration;
310 <<
"Building strip: Et = " <<
strip->et() <<
", eta = " <<
strip->eta() <<
", phi = " <<
strip->phi();
313 if (
strip->daughterPtr(0).isNonnull())
314 strip->setVertex(
strip->daughterPtr(0)->vertex());
318 markCandsInStrip(seedCandFlags, seedCandIdsCurrentStrip);
319 markCandsInStrip(addCandFlags, addCandIdsCurrentStrip);
323 <<
"Discarding strip: Et = " <<
strip->et() <<
", eta = " <<
strip->eta() <<
", phi = " <<
strip->phi();
327 while (idxSeed < seedCands.size() && seedCandFlags[idxSeed]) {
336 output.sort(
output.begin(),
output.end(), [&](
auto& arg1,
auto& arg2) {
return arg1.pt() > arg2.pt(); });
350 std::unique_ptr<RecoTauPiZero> combinedStrips(
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));
384 double bendCorrEta = 0.;
385 double bendCorrPhi = 0.;
387 for (
auto const&
gamma :
strip->daughterPtrVector()) {
397 strip->setBendCorrEta(bendCorrEta);
398 strip->setBendCorrPhi(bendCorrPhi);