17 #include "boost/bind.hpp"
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);
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]) {
352 std::unique_ptr<RecoTauPiZero> combinedStrips(
363 for (
auto const&
gamma :
first->daughterPtrVector()) {
364 combinedStrips->addDaughter(
gamma);
366 for (
auto const&
gamma :
second->daughterPtrVector()) {
367 combinedStrips->addDaughter(
gamma);
370 if (combinedStrips->daughterPtr(0).isNonnull()) {
371 combinedStrips->setVertex(combinedStrips->daughterPtr(0)->vertex());
375 stripCombinations.push_back(
std::move(combinedStrips));
386 double bendCorrEta = 0.;
387 double bendCorrPhi = 0.;
389 for (
auto const&
gamma :
strip->daughterPtrVector()) {
399 strip->setBendCorrEta(bendCorrEta);
400 strip->setBendCorrPhi(bendCorrPhi);