48 void print(
const std::vector<reco::RecoTauPiZero>& piZeros, std::ostream&
out);
55 typedef std::list<std::unique_ptr<reco::RecoTauPiZero>>
PiZeroList;
81 typedef std::vector<edm::ParameterSet>
VPSet;
88 for (VPSet::const_iterator builderPSet =
builders.begin(); builderPSet !=
builders.end(); ++builderPSet) {
98 for (VPSet::const_iterator rankerPSet = rankers.begin(); rankerPSet != rankers.end(); ++rankerPSet) {
114 produces<reco::JetPiZeroAssociation>();
124 builder->setup(evt, es);
132 for (
size_t i = 0;
i <
nJets; ++
i) {
149 <<
"Exception caught in builder plugin " << builder->name() <<
", rethrowing" << std::endl;
154 dirtyPiZeros.sort([
this](
const auto&
a,
const auto&
b) {
return (*
predicate_)(*
a, *
b); });
157 std::vector<reco::RecoTauPiZero> cleanPiZeros;
158 std::set<reco::CandidatePtr> photonsInCleanCollection;
159 while (!dirtyPiZeros.empty()) {
161 std::unique_ptr<reco::RecoTauPiZero>
toAdd(dirtyPiZeros.front().release());
162 dirtyPiZeros.pop_front();
168 std::vector<reco::CandidatePtr> uniqueGammas;
170 toAdd->daughterPtrVector().end(),
171 photonsInCleanCollection.begin(),
172 photonsInCleanCollection.end(),
173 std::back_inserter(uniqueGammas));
176 if (uniqueGammas.empty()) {
178 }
else if (uniqueGammas.size() ==
toAdd->daughterPtrVector().size()) {
181 photonsInCleanCollection.insert(
toAdd->daughterPtrVector().begin(),
toAdd->daughterPtrVector().end());
182 cleanPiZeros.push_back(*
toAdd);
186 toAdd->clearDaughters();
188 for (
auto const&
gamma : uniqueGammas) {
195 auto insertionPoint =
204 for (
auto& cleanPiZero : cleanPiZeros) {
219 const unsigned int width = 25;
220 for (
auto const& piZero : piZeros) {
222 out <<
"* Rankers:" << std::endl;
223 for (
auto const& ranker :
rankers_) {
224 out <<
"* " << std::setiosflags(std::ios::left) << std::setw(
width) << ranker->name() <<
" " 225 << std::resetiosflags(std::ios::left) << std::setprecision(3) << (*ranker)(piZero);
235 desc_ranking.
add<
double>(
"selectionFailValue", 1000);
241 pset_ranking.addParameter<
double>(
"selectionFailValue", 1000);
242 pset_ranking.addParameter<
std::string>(
"selection",
"");
243 pset_ranking.addParameter<
std::string>(
"name",
"");
244 pset_ranking.addParameter<
std::string>(
"plugin",
"");
245 std::vector<edm::ParameterSet> vpsd_ranking;
246 vpsd_ranking.push_back(pset_ranking);
261 desc.add<
double>(
"massHypothesis", 0.136);
262 desc.addVPSet(
"ranking", desc_ranking, vpsd_ranking);
263 desc.add<
int>(
"verbosity", 0);
264 desc.add<
double>(
"maxJetAbsEta", 2.5);
266 desc.add<
double>(
"minJetPt", 14.0);
272 psd0.
add<
std::string>(
"function",
"TMath::Min(0.3, TMath::Max(0.05, [0]*TMath::Power(pT, -[1])))");
273 psd0.
add<
double>(
"par1", 0.707716);
274 psd0.
add<
double>(
"par0", 0.352476);
279 psd0.
add<
std::string>(
"function",
"TMath::Min(0.15, TMath::Max(0.05, [0]*TMath::Power(pT, -[1])))");
280 psd0.
add<
double>(
"par1", 0.658701);
281 psd0.
add<
double>(
"par0", 0.197077);
284 desc_builders.
addOptional<
double>(
"stripEtaAssociationDistance", 0.05);
285 desc_builders.addOptional<
double>(
"stripPhiAssociationDistance", 0.2);
291 desc_builders.add<
int>(
"verbosity", 0);
293 desc_builders.addOptional<
bool>(
"makeCombinatoricStrips");
294 desc_builders.addOptional<
int>(
"maxStripBuildIterations");
295 desc_builders.addOptional<
double>(
"minGammaEtStripAdd");
296 desc_builders.addOptional<
double>(
"minGammaEtStripSeed");
297 desc_builders.addOptional<
double>(
"minStripEt");
298 desc_builders.addOptional<std::vector<int>>(
"stripCandidatesParticleIds");
299 desc_builders.addOptional<
bool>(
"updateStripAfterEachDaughter");
300 desc_builders.addOptional<
bool>(
"applyElecTrackQcuts");
302 std::vector<edm::ParameterSet> vpsd_builders;
303 vpsd_builders.push_back(pset_builders);
304 desc.addVPSet(
"builders", desc_builders, vpsd_builders);
306 descriptions.
add(
"recoTauPiZeroProducer",
desc);
void produce(edm::Event &evt, const edm::EventSetup &es) override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
RefToBase< value_type > refAt(size_type i) const
void set(reco::Candidate &c) const
set up a candidate
static void fillDescriptions(edm::ParameterSetDescription &descriptions)
Declare all parameters read from python config file.
def create(alignables, pedeDump, additionalData, outputFile, config)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
reco::tau::RecoTauLexicographicalRanking< RankerList, reco::RecoTauPiZero > PiZeroPredicate
reco::tau::RecoTauPiZeroQualityPlugin Ranker
RecoTauPiZeroProducer(const edm::ParameterSet &pset)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::list< std::unique_ptr< reco::RecoTauPiZero > > PiZeroList
Log< level::Error, false > LogError
static constexpr int nJets
void print(const std::vector< reco::RecoTauPiZero > &piZeros, std::ostream &out)
edm::RefToBaseProd< reco::Jet > JetRefBaseProd
reco::tau::RecoTauPiZeroBuilderPlugin Builder
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
void addParameter(std::string const &name, T const &value)
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Builder::return_type PiZeroVector
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< StringCutObjectSelector< reco::RecoTauPiZero > > outputSelector_
edm::EDGetTokenT< reco::JetView > cand_token
std::vector< std::unique_ptr< Ranker > > RankerList
std::vector< std::unique_ptr< Builder > > builders_
~RecoTauPiZeroProducer() override
std::unique_ptr< PiZeroPredicate > predicate_