14 #include <boost/ptr_container/ptr_vector.hpp> 15 #include <boost/ptr_container/ptr_list.hpp> 49 void print(
const std::vector<reco::RecoTauPiZero>& piZeros,
69 std::auto_ptr<StringCutObjectSelector<reco::RecoTauPiZero> >
87 typedef std::vector<edm::ParameterSet>
VPSet;
94 for (VPSet::const_iterator builderPSet = builders.begin();
95 builderPSet != builders.end(); ++builderPSet) {
101 pluginType, *builderPSet, consumesCollector()));
105 const VPSet& rankers = pset.
getParameter<VPSet>(
"ranking");
106 for (VPSet::const_iterator rankerPSet = rankers.begin();
107 rankerPSet != rankers.end(); ++rankerPSet) {
111 pluginType, *rankerPSet));
119 if (!selection.empty()) {
126 produces<reco::JetPiZeroAssociation>();
137 builder.setup(evt, es);
141 std::unique_ptr<reco::JetPiZeroAssociation>
association;
146 size_t nJets = jetView->
size();
147 for (
size_t i = 0;
i < nJets; ++
i) {
156 for(
auto const& builder : builders_) {
159 dirtyPiZeros.transfer(dirtyPiZeros.end(),
result);
162 <<
"Exception caught in builder plugin " << builder.name()
163 <<
", rethrowing" << std::endl;
171 std::vector<reco::RecoTauPiZero> cleanPiZeros;
172 std::set<reco::CandidatePtr> photonsInCleanCollection;
173 while (!dirtyPiZeros.empty()) {
175 std::auto_ptr<reco::RecoTauPiZero>
toAdd(
176 dirtyPiZeros.pop_front().release());
182 std::vector<reco::CandidatePtr> uniqueGammas;
183 std::set_difference(
toAdd->daughterPtrVector().begin(),
184 toAdd->daughterPtrVector().end(),
185 photonsInCleanCollection.begin(),
186 photonsInCleanCollection.end(),
187 std::back_inserter(uniqueGammas));
190 if (uniqueGammas.empty()) {
192 }
else if (uniqueGammas.size() ==
toAdd->daughterPtrVector().size()) {
195 photonsInCleanCollection.insert(
toAdd->daughterPtrVector().begin(),
196 toAdd->daughterPtrVector().end());
197 cleanPiZeros.push_back(*
toAdd);
201 toAdd->clearDaughters();
203 for(
auto const&
gamma : uniqueGammas) {
212 dirtyPiZeros.insert(insertionPoint,
toAdd);
217 for(
auto& cleanPiZero: cleanPiZeros )
224 association->setValue(
jet.key(), cleanPiZeros);
231 const std::vector<reco::RecoTauPiZero>& piZeros, std::ostream&
out) {
232 const unsigned int width = 25;
233 for(
auto const& piZero : piZeros) {
235 out <<
"* Rankers:" << std::endl;
236 for (rankerList::const_iterator ranker =
rankers_.begin();
237 ranker !=
rankers_.end(); ++ranker) {
238 out <<
"* " << std::setiosflags(std::ios::left)
239 << std::setw(width) << ranker->name()
240 <<
" " << std::resetiosflags(std::ios::left)
241 << std::setprecision(3) << (*ranker)(piZero);
252 desc_ranking.
add<
double>(
"selectionFailValue",1000);
258 pset_ranking.addParameter<
double>(
"selectionFailValue",1000);
259 pset_ranking.addParameter<
std::string>(
"selection",
"");
261 pset_ranking.addParameter<
std::string>(
"plugin",
"");
262 std::vector<edm::ParameterSet> vpsd_ranking;
263 vpsd_ranking.push_back(pset_ranking);
266 desc_signalQualityCuts.
add<
double>(
"maxDeltaZ", 0.4);
267 desc_signalQualityCuts.
add<
double>(
"minTrackPt", 0.5);
268 desc_signalQualityCuts.
add<
double>(
"minTrackVertexWeight", -1.0);
269 desc_signalQualityCuts.
add<
double>(
"maxTrackChi2", 100.0);
270 desc_signalQualityCuts.
add<
unsigned int>(
"minTrackPixelHits", 0);
271 desc_signalQualityCuts.
add<
double>(
"minGammaEt", 1.0);
272 desc_signalQualityCuts.
add<
unsigned int>(
"minTrackHits", 3);
273 desc_signalQualityCuts.
addOptional<
double>(
"minNeutralHadronEt");
274 desc_signalQualityCuts.
add<
double>(
"maxTransverseImpactParameter", 0.1);
275 desc_signalQualityCuts.
addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
278 desc_vxAssocQualityCuts.
add<
double>(
"minTrackPt", 0.5);
279 desc_vxAssocQualityCuts.add<
double>(
"minTrackVertexWeight", -1.0);
280 desc_vxAssocQualityCuts.add<
double>(
"maxTrackChi2", 100.0);
281 desc_vxAssocQualityCuts.add<
unsigned int>(
"minTrackPixelHits", 0);
282 desc_vxAssocQualityCuts.add<
double>(
"minGammaEt", 1.0);
283 desc_vxAssocQualityCuts.add<
unsigned int>(
"minTrackHits", 3);
284 desc_vxAssocQualityCuts.add<
double>(
"maxTransverseImpactParameter", 0.1);
285 desc_vxAssocQualityCuts.addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
288 desc_isolationQualityCuts.
add<
double>(
"maxDeltaZ", 0.2);
289 desc_isolationQualityCuts.add<
double>(
"minTrackPt", 1.0);
290 desc_isolationQualityCuts.add<
double>(
"minTrackVertexWeight", -1.0);
291 desc_isolationQualityCuts.add<
double>(
"maxTrackChi2", 100.0);
292 desc_isolationQualityCuts.add<
unsigned int>(
"minTrackPixelHits", 0);
293 desc_isolationQualityCuts.add<
double>(
"minGammaEt", 1.5);
294 desc_isolationQualityCuts.add<
unsigned int>(
"minTrackHits", 8);
295 desc_isolationQualityCuts.add<
double>(
"maxTransverseImpactParameter", 0.03);
296 desc_isolationQualityCuts.addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
302 desc_qualityCuts.
add<
std::string>(
"leadingTrkOrPFCandOption",
"leadPFCand");
303 desc_qualityCuts.add<
std::string>(
"pvFindingAlgo",
"closestInDeltaZ");
305 desc_qualityCuts.add<
bool>(
"vertexTrackFiltering",
false);
306 desc_qualityCuts.add<
bool>(
"recoverLeadingTrk",
false);
310 pset_builders.addParameter<
std::string>(
"plugin",
"");
318 desc.
add<
double>(
"massHypothesis", 0.136);
319 desc.
addVPSet(
"ranking", desc_ranking, vpsd_ranking);
320 desc.
add<
int>(
"verbosity", 0);
321 desc.
add<
double>(
"maxJetAbsEta", 2.5);
323 desc.
add<
double>(
"minJetPt", 14.0);
329 psd0.
add<
std::string>(
"function",
"TMath::Min(0.3, TMath::Max(0.05, [0]*TMath::Power(pT, -[1])))");
330 psd0.
add<
double>(
"par1", 0.707716);
331 psd0.
add<
double>(
"par0", 0.352476);
336 psd0.
add<
std::string>(
"function",
"TMath::Min(0.15, TMath::Max(0.05, [0]*TMath::Power(pT, -[1])))");
337 psd0.
add<
double>(
"par1", 0.658701);
338 psd0.
add<
double>(
"par0", 0.197077);
341 desc_builders.
addOptional<
double>(
"stripEtaAssociationDistance", 0.05);
342 desc_builders.addOptional<
double>(
"stripPhiAssociationDistance", 0.2);
348 desc_builders.add<
int>(
"verbosity", 0);
350 desc_builders.addOptional<
bool>(
"makeCombinatoricStrips");
351 desc_builders.addOptional<
int>(
"maxStripBuildIterations");
352 desc_builders.addOptional<
double>(
"minGammaEtStripAdd");
353 desc_builders.addOptional<
double>(
"minGammaEtStripSeed");
354 desc_builders.addOptional<
double>(
"minStripEt");
355 desc_builders.addOptional<std::vector<int>>(
"stripCandidatesParticleIds");
356 desc_builders.addOptional<
bool>(
"updateStripAfterEachDaughter");
357 desc_builders.addOptional<
bool>(
"applyElecTrackQcuts");
359 std::vector<edm::ParameterSet> vpsd_builders;
360 vpsd_builders.push_back(pset_builders);
361 desc.
addVPSet(
"builders", desc_builders, vpsd_builders);
363 descriptions.
add(
"recoTauPiZeroProducer", desc);
T getParameter(std::string const &) const
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)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
def create(alignables, pedeDump, additionalData, outputFile, config)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
reco::tau::RecoTauPiZeroQualityPlugin Ranker
RecoTauPiZeroProducer(const edm::ParameterSet &pset)
reco::tau::RecoTauLexicographicalRanking< rankerList, reco::RecoTauPiZero > PiZeroPredicate
void print(const std::vector< reco::RecoTauPiZero > &piZeros, std::ostream &out)
RefToBase< value_type > refAt(size_type i) const
edm::RefToBaseProd< reco::Jet > JetRefBaseProd
#define DEFINE_FWK_MODULE(type)
reco::tau::RecoTauPiZeroBuilderPlugin Builder
void addParameter(std::string const &name, T const &value)
Abs< T >::type abs(const T &t)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
boost::ptr_vector< reco::RecoTauPiZero > PiZeroVector
boost::ptr_vector< Builder > builderList
boost::ptr_list< reco::RecoTauPiZero > PiZeroList
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< reco::JetView > cand_token
boost::ptr_vector< Ranker > rankerList
void set(reco::Candidate &c) const
set up a candidate
std::auto_ptr< StringCutObjectSelector< reco::RecoTauPiZero > > outputSelector_
~RecoTauPiZeroProducer() override
T get(const Candidate &c)
std::auto_ptr< PiZeroPredicate > predicate_