29 #include "fastjet/SISConePlugin.hh"
30 #include "fastjet/CMSIterativeConePlugin.hh"
31 #include "fastjet/ATLASConePlugin.hh"
32 #include "fastjet/CDFMidPointPlugin.hh"
33 #include "fastjet/tools/Filter.hh"
34 #include "fastjet/tools/Pruner.hh"
35 #include "fastjet/tools/MassDropTagger.hh"
36 #include "fastjet/contrib/SoftDrop.hh"
37 #include "fastjet/tools/JetMedianBackgroundEstimator.hh"
38 #include "fastjet/contrib/ConstituentSubtractor.hh"
59 useMassDropTagger_(
false),
61 useDynamicFiltering_(
false),
64 useCMSBoostedTauSeedingAlgorithm_(
false),
66 useConstituentSubtraction_(
false),
82 if ( iConfig.
exists(
"UseOnlyVertexTracks") )
87 if ( iConfig.
exists(
"UseOnlyOnePV") )
92 if ( iConfig.
exists(
"DzTrVtxMax") )
96 if ( iConfig.
exists(
"DxyTrVtxMax") )
100 if ( iConfig.
exists(
"MinVtxNdof") )
104 if ( iConfig.
exists(
"MaxVtxZ") )
110 if ( iConfig.
exists(
"useFiltering") ||
111 iConfig.
exists(
"useTrimming") ||
112 iConfig.
exists(
"usePruning") ||
113 iConfig.
exists(
"useMassDropTagger") ||
114 iConfig.
exists(
"useCMSBoostedTauSeedingAlgorithm") ||
115 iConfig.
exists(
"useConstituentSubtraction") ||
116 iConfig.
exists(
"useSoftDrop")
149 if ( iConfig.
exists(
"useMassDropTagger") ) {
155 if ( iConfig.
exists(
"useFiltering") ) {
159 if ( iConfig.
exists(
"useDynamicFiltering") ) {
167 if ( iConfig.
exists(
"useTrimming") ) {
173 if ( iConfig.
exists(
"usePruning") ) {
178 if ( iConfig.
exists(
"useKtPruning") )
182 if ( iConfig.
exists(
"useCMSBoostedTauSeedingAlgorithm") ) {
194 if ( iConfig.
exists(
"useConstituentSubtraction") ) {
197 throw cms::Exception(
"AreaMustBeSet") <<
"Logic error. The area definition must be set if you use constituent subtraction." << std::endl;
205 if ( iConfig.
exists(
"useSoftDrop") ) {
207 throw cms::Exception(
"PruningAndSoftDrop") <<
"Logic error. Soft drop is a generalized pruning, do not run them together." << std::endl;
258 std::vector<edm::Ptr<reco::RecoChargedRefCandidate> > allInputs;
259 std::vector<edm::Ptr<reco::Candidate> > origInputs;
260 for (
size_t i = 0;
i < inputsHandle->size(); ++
i) {
261 allInputs.push_back(inputsHandle->ptrAt(
i));
262 origInputs.push_back(inputsHandle->ptrAt(
i));
269 std::auto_ptr<std::vector<reco::TrackJet> >
jets(
new std::vector<reco::TrackJet>() );
272 for (reco::VertexCollection::const_iterator itVtx = pvCollection->begin(); itVtx != pvCollection->end(); ++itVtx) {
273 if (itVtx->isFake() || itVtx->ndof() <
minVtxNdof_ || fabs(itVtx->z()) >
maxVtxZ_)
continue;
291 if ((*itIn)->track() == trref) {
296 allInputs.erase(itIn);
302 if (!found)
edm::LogInfo(
"FastjetTrackJetProducer") <<
"Ignoring a track at vertex which is not in input track collection!";
309 float dz = (*itIn)->track()->dz(itVtx->position());
310 float dxy = (*itIn)->track()->dxy(itVtx->position());
313 bool closervtx =
false;
315 for (reco::VertexCollection::const_iterator itVtx2 = pvCollection->begin(); itVtx2 != pvCollection->end(); ++itVtx2) {
316 if (itVtx->isFake() || itVtx->ndof() <
minVtxNdof_ || fabs(itVtx->z()) >
maxVtxZ_)
continue;
320 fabs((*itIn)->track()->dz(itVtx2->position())) < fabs(dz)) {
326 if (closervtx)
continue;
330 allInputs.erase(itIn);
339 LogDebug(
"FastjetTrackJetProducer") <<
"Inputted towers\n";
343 LogDebug(
"FastjetTrackJetProducer") <<
"Ran algorithm\n";
346 for (
unsigned int ijet=0;ijet<
fjJets_.size();++ijet) {
348 std::vector<fastjet::PseudoJet> fjConstituents = sorted_by_pt(
fjClusterSeq_->constituents(
fjJets_[ijet]));
350 std::vector<reco::CandidatePtr> constituents =
getConstituents(fjConstituents);
356 vertex_, constituents, iSetup);
361 jets->push_back(jet);
368 LogDebug(
"FastjetTrackJetProducer") <<
"Put " << jets->size() <<
" jets in the event.\n";
414 std::vector<fastjet::PseudoJet> tempJets = fastjet::sorted_by_pt(
fjClusterSeq_->inclusive_jets(
jetPtMin_));
416 unique_ptr<fastjet::JetMedianBackgroundEstimator> bge_rho;
418 fastjet::Selector rho_range = fastjet::SelectorAbsRapMax(
csRho_EtaMax_);
419 bge_rho = unique_ptr<fastjet::JetMedianBackgroundEstimator> (
new fastjet::JetMedianBackgroundEstimator(rho_range, fastjet::JetDefinition(fastjet::kt_algorithm,
csRParam_), *
fjAreaDefinition_) );
421 fastjet::contrib::ConstituentSubtractor * constituentSubtractor =
new fastjet::contrib::ConstituentSubtractor(bge_rho.get());
423 constituentSubtractor->use_common_bge_for_rho_and_rhom(
true);
428 fastjet::MassDropTagger * md_tagger =
new fastjet::MassDropTagger (
muCut_,
yCut_ );
432 fastjet::contrib::CMSBoostedTauSeedingAlgorithm * tau_tagger =
446 fastjet::Pruner * pruner =
new fastjet::Pruner(fastjet::cambridge_algorithm,
zCut_,
RcutFactor_);
456 fastjet::Pruner * pruner =
new fastjet::Pruner(fastjet::kt_algorithm,
zCut_,
RcutFactor_);
461 fastjet::contrib::SoftDrop *
sd =
new fastjet::contrib::SoftDrop(
beta_,
zCut_,
R0_ );
466 for ( std::vector<fastjet::PseudoJet>::const_iterator ijet = tempJets.begin(),
467 ijetEnd = tempJets.end(); ijet != ijetEnd; ++ijet ) {
469 fastjet::PseudoJet transformedJet = *ijet;
471 for ( transformer_coll::const_iterator itransf = transformers.begin(),
472 itransfEnd = transformers.end(); itransf != itransfEnd; ++itransf ) {
473 if ( transformedJet != 0 ) {
474 transformedJet = (**itransf)(transformedJet);
481 fjJets_.push_back( transformedJet );
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.
double rFilt_
for mass-drop tagging, symmetry cut: min(pt1^2,pt2^2) * dR(1,2) / mjet > ycut
reco::Particle::Point vertex_
double dRMax_
for CMSBoostedTauSeedingAlgorithm : min dR
double subjetPtMin_
for soft drop : R0 (angular distance normalization - should be set to jet radius in most cases) ...
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()
virtual void runAlgorithm(edm::Event &iEvent, const edm::EventSetup &iSetup)
#define DEFINE_FWK_MODULE(type)
bool useOnlyVertexTracks_
bool useDynamicFiltering_
Jet filtering technique.
bool exists(std::string const ¶meterName) const
checks if a parameter exists
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
bool useKtPruning_
algorithm for seeding reconstruction of boosted Taus (similar to mass-drop tagging) ...
FastjetJetProducer(const edm::ParameterSet &iConfig)
bool useTrimming_
Use dynamic filtering radius (as in arXiv:0802.2470)
double csRParam_
for constituent subtraction : maximum rapidity for ghosts
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
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
double trimPtFracMin_
for filtering, pruning: number of subjets expected
bool usePruning_
Jet trimming technique.
std::vector< edm::Ptr< reco::Candidate > > inputs_
bool useCMSBoostedTauSeedingAlgorithm_
Jet pruning technique.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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
double muMax_
for CMSBoostedTauSeedingAlgorithm : min mass-drop
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 ...
double zCut_
for trimming: constituent minimum pt fraction of full jet
virtual void setVertex(const Point &vertex)
set vertex
int nFilt_
for dynamic filtering radius (as in arXiv:0802.2470)
int maxDepth_
for CMSBoostedTauSeedingAlgorithm : max dR
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
double R0_
for soft drop : beta (angular exponent)
std::unique_ptr< transformer > transformer_ptr
double yCut_
for mass-drop tagging, m0/mjet (m0 = mass of highest mass subjet)
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
virtual ~FastjetJetProducer()
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_
volatile std::atomic< bool > shutdown_flag false
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_