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),
81 if ( iConfig.
exists(
"UseOnlyVertexTracks") )
86 if ( iConfig.
exists(
"UseOnlyOnePV") )
91 if ( iConfig.
exists(
"DzTrVtxMax") )
95 if ( iConfig.
exists(
"DxyTrVtxMax") )
99 if ( iConfig.
exists(
"MinVtxNdof") )
103 if ( iConfig.
exists(
"MaxVtxZ") )
109 if ( iConfig.
exists(
"useFiltering") ||
110 iConfig.
exists(
"useTrimming") ||
111 iConfig.
exists(
"usePruning") ||
112 iConfig.
exists(
"useMassDropTagger") ||
113 iConfig.
exists(
"useCMSBoostedTauSeedingAlgorithm") ||
114 iConfig.
exists(
"useConstituentSubtraction") ||
115 iConfig.
exists(
"useSoftDrop")
147 if ( iConfig.
exists(
"useMassDropTagger") ) {
153 if ( iConfig.
exists(
"useFiltering") ) {
157 if ( iConfig.
exists(
"useDynamicFiltering") ) {
165 if ( iConfig.
exists(
"useTrimming") ) {
171 if ( iConfig.
exists(
"usePruning") ) {
176 if ( iConfig.
exists(
"useKtPruning") )
180 if ( iConfig.
exists(
"useCMSBoostedTauSeedingAlgorithm") ) {
192 if ( iConfig.
exists(
"useConstituentSubtraction") ) {
195 throw cms::Exception(
"AreaMustBeSet") <<
"Logic error. The area definition must be set if you use constituent subtraction." << std::endl;
203 if ( iConfig.
exists(
"useSoftDrop") ) {
205 throw cms::Exception(
"PruningAndSoftDrop") <<
"Logic error. Soft drop is a generalized pruning, do not run them together." << std::endl;
255 std::vector<edm::Ptr<reco::RecoChargedRefCandidate> > allInputs;
256 std::vector<edm::Ptr<reco::Candidate> > origInputs;
257 for (
size_t i = 0;
i < inputsHandle->size(); ++
i) {
258 allInputs.push_back(inputsHandle->ptrAt(
i));
259 origInputs.push_back(inputsHandle->ptrAt(
i));
266 std::auto_ptr<std::vector<reco::TrackJet> >
jets(
new std::vector<reco::TrackJet>() );
269 for (reco::VertexCollection::const_iterator itVtx = pvCollection->begin(); itVtx != pvCollection->end(); ++itVtx) {
270 if (itVtx->isFake() || itVtx->ndof() <
minVtxNdof_ || fabs(itVtx->z()) >
maxVtxZ_)
continue;
288 if ((*itIn)->track() == trref) {
293 allInputs.erase(itIn);
299 if (!found)
edm::LogInfo(
"FastjetTrackJetProducer") <<
"Ignoring a track at vertex which is not in input track collection!";
306 float dz = (*itIn)->track()->dz(itVtx->position());
307 float dxy = (*itIn)->track()->dxy(itVtx->position());
310 bool closervtx =
false;
312 for (reco::VertexCollection::const_iterator itVtx2 = pvCollection->begin(); itVtx2 != pvCollection->end(); ++itVtx2) {
313 if (itVtx->isFake() || itVtx->ndof() <
minVtxNdof_ || fabs(itVtx->z()) >
maxVtxZ_)
continue;
317 fabs((*itIn)->track()->dz(itVtx2->position())) < fabs(dz)) {
323 if (closervtx)
continue;
327 allInputs.erase(itIn);
336 LogDebug(
"FastjetTrackJetProducer") <<
"Inputted towers\n";
340 LogDebug(
"FastjetTrackJetProducer") <<
"Ran algorithm\n";
343 for (
unsigned int ijet=0;ijet<
fjJets_.size();++ijet) {
345 std::vector<fastjet::PseudoJet> fjConstituents = sorted_by_pt(
fjClusterSeq_->constituents(
fjJets_[ijet]));
347 std::vector<reco::CandidatePtr> constituents =
getConstituents(fjConstituents);
353 vertex_, constituents, iSetup);
358 jets->push_back(jet);
365 LogDebug(
"FastjetTrackJetProducer") <<
"Put " << jets->size() <<
" jets in the event.\n";
411 std::vector<fastjet::PseudoJet> tempJets = fastjet::sorted_by_pt(
fjClusterSeq_->inclusive_jets(
jetPtMin_));
413 unique_ptr<fastjet::JetMedianBackgroundEstimator> bge_rho;
415 fastjet::Selector rho_range = fastjet::SelectorAbsRapMax(
csRho_EtaMax_);
416 bge_rho = unique_ptr<fastjet::JetMedianBackgroundEstimator> (
new fastjet::JetMedianBackgroundEstimator(rho_range, fastjet::JetDefinition(fastjet::kt_algorithm,
csRParam_), *
fjAreaDefinition_) );
418 fastjet::contrib::ConstituentSubtractor * constituentSubtractor =
new fastjet::contrib::ConstituentSubtractor(bge_rho.get());
420 constituentSubtractor->use_common_bge_for_rho_and_rhom(
true);
425 fastjet::MassDropTagger * md_tagger =
new fastjet::MassDropTagger (
muCut_,
yCut_ );
429 fastjet::contrib::CMSBoostedTauSeedingAlgorithm * tau_tagger =
443 fastjet::Pruner * pruner =
new fastjet::Pruner(fastjet::cambridge_algorithm,
zCut_,
RcutFactor_);
453 fastjet::Pruner * pruner =
new fastjet::Pruner(fastjet::kt_algorithm,
zCut_,
RcutFactor_);
458 fastjet::contrib::SoftDrop *
sd =
new fastjet::contrib::SoftDrop(
beta_,
zCut_ );
463 for ( std::vector<fastjet::PseudoJet>::const_iterator ijet = tempJets.begin(),
464 ijetEnd = tempJets.end(); ijet != ijetEnd; ++ijet ) {
466 fastjet::PseudoJet transformedJet = *ijet;
468 for ( transformer_coll::const_iterator itransf = transformers.begin(),
469 itransfEnd = transformers.end(); itransf != itransfEnd; ++itransf ) {
470 if ( transformedJet != 0 ) {
471 transformedJet = (**itransf)(transformedJet);
478 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 : beta (angular exponent)
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_
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
std::unique_ptr< transformer > transformer_ptr
double yCut_
for mass-drop tagging, m0/mjet (m0 = mass of highest mass subjet)
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_