31 #include "fastjet/SISConePlugin.hh" 32 #include "fastjet/CMSIterativeConePlugin.hh" 33 #include "fastjet/ATLASConePlugin.hh" 34 #include "fastjet/CDFMidPointPlugin.hh" 35 #include "fastjet/tools/Filter.hh" 36 #include "fastjet/tools/Pruner.hh" 37 #include "fastjet/tools/MassDropTagger.hh" 38 #include "fastjet/contrib/SoftDrop.hh" 39 #include "fastjet/tools/JetMedianBackgroundEstimator.hh" 40 #include "fastjet/tools/GridMedianBackgroundEstimator.hh" 41 #include "fastjet/tools/Subtractor.hh" 42 #include "fastjet/contrib/ConstituentSubtractor.hh" 118 if ( useFiltering_ ||
121 useMassDropTagger_ ||
122 useCMSBoostedTauSeedingAlgorithm_ ||
123 useConstituentSubtraction_ ||
130 if ( ( useMassDropTagger_ ) && ( ( muCut_ == -1 ) || ( yCut_ == -1 ) ) )
131 throw cms::Exception(
"useMassDropTagger") <<
"Parameters muCut and/or yCut for Mass Drop are not defined." << std::endl;
133 if ( ( useFiltering_ ) && ( ( rFilt_ == -1 ) || ( nFilt_ == -1 ) ) ) {
134 throw cms::Exception(
"useFiltering") <<
"Parameters rFilt and/or nFilt for Filtering are not defined." << std::endl;
135 if ( ( useDynamicFiltering_ ) && (
rFiltFactor_ == -1 ) )
136 throw cms::Exception(
"useDynamicFiltering") <<
"Parameters rFiltFactor for DynamicFiltering is not defined." << std::endl;
139 if ( ( useTrimming_ ) && ( ( rFilt_ == -1 ) || ( trimPtFracMin_ == -1 ) ) )
140 throw cms::Exception(
"useTrimming") <<
"Parameters rFilt and/or trimPtFracMin for Trimming are not defined." << std::endl;
142 if ( ( usePruning_ ) && ( ( zCut_ == -1 ) || ( RcutFactor_ == -1 ) || ( nFilt_ == -1 )) )
143 throw cms::Exception(
"usePruning") <<
"Parameters zCut and/or RcutFactor and/or nFilt for Pruning are not defined." << std::endl;
145 if ( ( useCMSBoostedTauSeedingAlgorithm_ ) && ( ( subjetPtMin_ == -1 ) || ( maxDepth_ == -1 ) ||
146 ( muMin_ == -1 ) || ( muMax_ == -1 ) ||
147 ( yMin_ == -1 ) || ( yMax_ == -1 ) ||
148 ( dRMin_ == -1 ) || ( dRMax_ == -1 ) ) )
149 throw cms::Exception(
"useCMSBoostedTauSeedingAlgorithm") <<
"Parameters subjetPtMin, muMin, muMax, yMin, yMax, dRmin, dRmax, maxDepth for CMSBoostedTauSeedingAlgorithm are not defined." << std::endl;
152 throw cms::Exception(
"AreaMustBeSet") <<
"Logic error. The area definition must be set if you use constituent subtraction." << std::endl;
154 if ( ( useConstituentSubtraction_ ) && ( ( csRho_EtaMax_ == -1 ) || ( csRParam_ == -1 ) ) )
155 throw cms::Exception(
"useConstituentSubtraction") <<
"Parameters csRho_EtaMax and/or csRParam for ConstituentSubtraction are not defined." << std::endl;
157 if ( useSoftDrop_ && usePruning_ )
158 throw cms::Exception(
"PruningAndSoftDrop") <<
"Logic error. Soft drop is a generalized pruning, do not run them together." << std::endl;
160 if ( ( useSoftDrop_ ) && ( ( zCut_ == -1 ) || ( beta_ == -1 ) || ( R0_ == -1 )) )
161 throw cms::Exception(
"useSoftDrop") <<
"Parameters zCut and/or beta and/or R0 for SoftDrop are not defined." << std::endl;
163 if ( ( correctShape_ ) && ( ( gridMaxRapidity_ == -1 ) || ( gridSpacing_ == -1 )) )
164 throw cms::Exception(
"correctShape") <<
"Parameters gridMaxRapidity and/or gridSpacing for SoftDrop are not defined." << std::endl;
210 std::vector<edm::Ptr<reco::RecoChargedRefCandidate> > allInputs;
211 std::vector<edm::Ptr<reco::Candidate> > origInputs;
212 for (
size_t i = 0;
i < inputsHandle->size(); ++
i) {
213 allInputs.push_back(inputsHandle->ptrAt(
i));
214 origInputs.push_back(inputsHandle->ptrAt(
i));
221 auto jets = std::make_unique<std::vector<reco::TrackJet>>();
224 for (reco::VertexCollection::const_iterator itVtx = pvCollection->begin(); itVtx != pvCollection->end(); ++itVtx) {
225 if (itVtx->isFake() || itVtx->ndof() <
minVtxNdof_ || fabs(itVtx->z()) >
maxVtxZ_)
continue;
243 if ((*itIn)->track() == trref) {
248 allInputs.erase(itIn);
254 if (!found)
edm::LogInfo(
"FastjetTrackJetProducer") <<
"Ignoring a track at vertex which is not in input track collection!";
261 float dz = (*itIn)->track()->dz(itVtx->position());
262 float dxy = (*itIn)->track()->dxy(itVtx->position());
265 bool closervtx =
false;
267 for (reco::VertexCollection::const_iterator itVtx2 = pvCollection->begin(); itVtx2 != pvCollection->end(); ++itVtx2) {
268 if (itVtx->isFake() || itVtx->ndof() <
minVtxNdof_ || fabs(itVtx->z()) >
maxVtxZ_)
continue;
272 fabs((*itIn)->track()->dz(itVtx2->position())) < fabs(dz)) {
278 if (closervtx)
continue;
282 allInputs.erase(itIn);
291 LogDebug(
"FastjetTrackJetProducer") <<
"Inputted towers\n";
295 LogDebug(
"FastjetTrackJetProducer") <<
"Ran algorithm\n";
298 for (
unsigned int ijet=0;ijet<
fjJets_.size();++ijet) {
300 std::vector<fastjet::PseudoJet> fjConstituents = sorted_by_pt(
fjClusterSeq_->constituents(
fjJets_[ijet]));
302 std::vector<reco::CandidatePtr> constituents =
getConstituents(fjConstituents);
308 vertex_, constituents, iSetup);
313 jets->push_back(jet);
320 LogDebug(
"FastjetTrackJetProducer") <<
"Put " <<
jets->size() <<
" jets in the event.\n";
372 std::vector<fastjet::PseudoJet> tempJets = fastjet::sorted_by_pt(
fjClusterSeq_->inclusive_jets(
jetPtMin_));
374 unique_ptr<fastjet::JetMedianBackgroundEstimator> bge_rho;
377 bge_rho = unique_ptr<fastjet::JetMedianBackgroundEstimator> (
new fastjet::JetMedianBackgroundEstimator(rho_range, fastjet::JetDefinition(fastjet::kt_algorithm,
csRParam_), *
fjAreaDefinition_) );
379 fastjet::contrib::ConstituentSubtractor * constituentSubtractor =
new fastjet::contrib::ConstituentSubtractor(bge_rho.get());
384 fastjet::MassDropTagger * md_tagger =
new fastjet::MassDropTagger (
muCut_,
yCut_ );
388 fastjet::contrib::CMSBoostedTauSeedingAlgorithm * tau_tagger =
402 fastjet::Pruner * pruner =
new fastjet::Pruner(fastjet::cambridge_algorithm,
zCut_,
RcutFactor_);
412 fastjet::Pruner * pruner =
new fastjet::Pruner(fastjet::kt_algorithm,
zCut_,
RcutFactor_);
417 fastjet::contrib::SoftDrop *
sd =
new fastjet::contrib::SoftDrop(
beta_,
zCut_,
R0_ );
421 unique_ptr<fastjet::Subtractor> subtractor;
422 unique_ptr<fastjet::GridMedianBackgroundEstimator> bge_rho_grid;
424 bge_rho_grid = unique_ptr<fastjet::GridMedianBackgroundEstimator> (
new fastjet::GridMedianBackgroundEstimator(
gridMaxRapidity_,
gridSpacing_) );
426 subtractor = unique_ptr<fastjet::Subtractor>(
new fastjet::Subtractor( bge_rho_grid.get()) );
427 subtractor->set_use_rho_m();
432 for ( std::vector<fastjet::PseudoJet>::const_iterator ijet = tempJets.begin(),
433 ijetEnd = tempJets.end(); ijet != ijetEnd; ++ijet ) {
435 fastjet::PseudoJet transformedJet = *ijet;
437 for ( transformer_coll::const_iterator itransf = transformers.begin(),
438 itransfEnd = transformers.end(); itransf != itransfEnd; ++itransf ) {
439 if ( transformedJet != 0 ) {
440 transformedJet = (**itransf)(transformedJet);
447 transformedJet = (*subtractor)(transformedJet);
451 fjJets_.push_back( transformedJet );
467 descFastjetJetProducer.
add<
string>(
"jetCollInstanceName",
"" );
468 descFastjetJetProducer.
add<
bool> (
"sumRecHits",
false);
471 descriptions.
add(
"FastjetJetProducer",descFastjetJetProducer);
477 desc.
add<
bool>(
"useMassDropTagger",
false);
478 desc.
add<
bool>(
"useFiltering",
false);
479 desc.
add<
bool>(
"useDynamicFiltering",
false);
480 desc.
add<
bool>(
"useTrimming",
false);
481 desc.
add<
bool>(
"usePruning",
false);
482 desc.
add<
bool>(
"useCMSBoostedTauSeedingAlgorithm",
false);
483 desc.
add<
bool>(
"useKtPruning",
false);
484 desc.
add<
bool>(
"useConstituentSubtraction",
false);
485 desc.
add<
bool>(
"useSoftDrop",
false);
486 desc.
add<
bool>(
"correctShape",
false);
487 desc.
add<
bool>(
"UseOnlyVertexTracks",
false);
488 desc.
add<
bool>(
"UseOnlyOnePV",
false);
489 desc.
add<
double>(
"muCut", -1.0);
490 desc.
add<
double>(
"yCut", -1.0);
491 desc.
add<
double>(
"rFilt", -1.0);
492 desc.
add<
double>(
"rFiltFactor", -1.0);
493 desc.
add<
double>(
"trimPtFracMin",-1.0);
494 desc.
add<
double>(
"zcut", -1.0);
495 desc.
add<
double>(
"rcut_factor", -1.0);
496 desc.
add<
double>(
"csRho_EtaMax",-1.0);
497 desc.
add<
double>(
"csRParam", -1.0);
498 desc.
add<
double>(
"beta", -1.0);
499 desc.
add<
double>(
"R0", -1.0);
500 desc.
add<
double>(
"gridMaxRapidity", -1.0);
501 desc.
add<
double>(
"gridSpacing", -1.0);
502 desc.
add<
double>(
"DzTrVtxMax", 999999.);
503 desc.
add<
double>(
"DxyTrVtxMax", 999999.);
504 desc.
add<
double>(
"MaxVtxZ", 15.0);
505 desc.
add<
double>(
"subjetPtMin", -1.0);
506 desc.
add<
double>(
"muMin", -1.0);
507 desc.
add<
double>(
"muMax", -1.0);
508 desc.
add<
double>(
"yMin", -1.0);
509 desc.
add<
double>(
"yMax", -1.0);
510 desc.
add<
double>(
"dRMin", -1.0);
511 desc.
add<
double>(
"dRMax", -1.0);
512 desc.
add<
int>(
"maxDepth", -1);
513 desc.
add<
int>(
"nFilt", -1);
514 desc.
add<
int>(
"MinVtxNdof", 5);
double muMin_
for CMSBoostedTauSeedingAlgorithm : subjet pt min
T getParameter(std::string const &) const
double yMin_
for CMSBoostedTauSeedingAlgorithm : max mass-drop
bool useFiltering_
Mass-drop tagging for boosted Higgs.
bool correctShape_
Soft drop.
double rFilt_
for mass-drop tagging, symmetry cut: min(pt1^2,pt2^2) * dR(1,2) / mjet > ycut
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
reco::Particle::Point vertex_
~FastjetJetProducer() override
double dRMax_
for CMSBoostedTauSeedingAlgorithm : min dR
double subjetPtMin_
for shape subtraction, get the grid spacing
virtual std::vector< reco::CandidatePtr > getConstituents(const std::vector< fastjet::PseudoJet > &fjConstituents)
std::vector< fastjet::PseudoJet > fjJets_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void setPileup(float fEnergy)
Set pileup energy contribution as calculated by algorithm.
virtual void inputTowers()
bool useOnlyVertexTracks_
bool useDynamicFiltering_
Jet filtering technique.
double RcutFactor_
for pruning OR soft drop: constituent minimum pt fraction of parent cluster
bool useSoftDrop_
constituent subtraction technique
double yMax_
for CMSBoostedTauSeedingAlgorithm : min asymmetry
double gridSpacing_
for shape subtraction, get the fixed-grid rho
bool useKtPruning_
algorithm for seeding reconstruction of boosted Taus (similar to mass-drop tagging) ...
FastjetJetProducer(const edm::ParameterSet &iConfig)
void swap(Association< C > &lhs, Association< C > &rhs)
bool useTrimming_
Use dynamic filtering radius (as in arXiv:0802.2470)
double csRParam_
for constituent subtraction : maximum rapidity for ghosts
void setVertex(const Point &vertex) override
set vertex
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
bool makeTrackJet(const JetType::Type &fTag)
virtual void setJetArea(float fArea)
set jet area
std::vector< fastjet::PseudoJet > fjInputs_
std::vector< transformer_ptr > transformer_coll
double trimPtFracMin_
for filtering, pruning: number of subjets expected
double gridMaxRapidity_
for soft drop : R0 (angular distance normalization - should be set to jet radius in most cases) ...
#define DEFINE_FWK_MODULE(type)
bool usePruning_
Jet trimming technique.
std::vector< edm::Ptr< reco::Candidate > > inputs_
bool useCMSBoostedTauSeedingAlgorithm_
Jet pruning technique.
ClusterSequencePtr fjClusterSeq_
virtual void produceTrackJets(edm::Event &iEvent, const edm::EventSetup &iSetup)
edm::EDGetTokenT< edm::View< reco::RecoChargedRefCandidate > > input_chrefcand_token_
for CMSBoostedTauSeedingAlgorithm : max depth for descending into clustering sequence ...
double csRho_EtaMax_
for pruning: constituent dR * pt/2m < rcut_factor
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double muMax_
for CMSBoostedTauSeedingAlgorithm : min mass-drop
double muCut_
Correct the shape of the jets.
double rFiltFactor_
for dynamic filtering radius (as in arXiv:0802.2470)
DynamicRfiltPtr rFiltDynamic_
for filtering, trimming: dR scale of sub-clustering
void setPrimaryVertex(const reco::VertexRef &vtx)
set associated primary vertex
double dRMin_
for CMSBoostedTauSeedingAlgorithm : max asymmetry
boost::shared_ptr< DynamicRfilt > DynamicRfiltPtr
double beta_
for constituent subtraction : R parameter for KT alg in jet median background estimator ...
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double zCut_
for trimming: constituent minimum pt fraction of full jet
int nFilt_
for dynamic filtering radius (as in arXiv:0802.2470)
int maxDepth_
for CMSBoostedTauSeedingAlgorithm : max dR
static void fillDescriptionsFromFastJetProducer(edm::ParameterSetDescription &desc)
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
double R0_
for soft drop : beta (angular exponent)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< transformer > transformer_ptr
double yCut_
for mass-drop tagging, m0/mjet (m0 = mass of highest mass subjet)
void runAlgorithm(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
bool useConstituentSubtraction_
Use Kt clustering algorithm for pruning (default is Cambridge/Aachen)
AreaDefinitionPtr fjAreaDefinition_
static void fillDescriptionsFromVirtualJetProducer(edm::ParameterSetDescription &desc)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
boost::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
void writeSpecific(reco::CaloJet &jet, reco::Particle::LorentzVector const &p4, reco::Particle::Point const &point, std::vector< reco::CandidatePtr > const &constituents, edm::EventSetup const &c)
JetDefPtr fjJetDefinition_