Loading...
Searching...
No Matches
RestFrameNSubjettinessTagger.cc
//FJSTARTHEADER
// $Id$
//
// Copyright (c) 2005-2021, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
//
//----------------------------------------------------------------------
// This file is part of FastJet.
//
// FastJet is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// The algorithms that underlie FastJet have required considerable
// development. They are described in the original FastJet paper,
// hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
// FastJet as part of work towards a scientific publication, please
// quote the version you use and include a citation to the manual and
// optionally also to hep-ph/0512210.
//
// FastJet is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
//----------------------------------------------------------------------
//FJENDHEADER
#include "fastjet/tools/RestFrameNSubjettinessTagger.hh"
#include "fastjet/tools/Boost.hh"
#include "fastjet/ClusterSequence.hh"
#include <sstream>
using namespace std;
FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
//------------------------------------------------------------------------
// RestFrameNSubjettinessTagger class implementation
//------------------------------------------------------------------------
//------------------------------------------------------------------------
// tagger description
string RestFrameNSubjettinessTagger::description() const{
ostringstream oss;
oss << "RestFrameNSubjettiness tagger that performs clustering in the jet rest frame with "
<< _subjet_def.description()
<< ", supplemented with cuts tau_2 < " << _t2cut
<< " and cos(theta_s) < " << _costscut;
return oss.str();
}
//------------------------------------------------------------------------
// action on a single jet
// returns the tagged PseudoJet if successful, 0 otherwise
PseudoJet RestFrameNSubjettinessTagger::result(const PseudoJet & jet) const{
// make sure that the jet has constituents
if (!jet.has_constituents())
throw("The jet you try to tag needs to have accessible constituents");
// get the constituents and boost them into the rest frame of the jet
vector<PseudoJet> rest_input = jet.constituents();
for (unsigned int i=0; i<rest_input.size(); i++)
rest_input[i].unboost(jet);
ClusterSequence cs_rest(rest_input, _subjet_def);
vector<PseudoJet> subjets = (_use_exclusive)
? cs_rest.exclusive_jets(2)
: sorted_by_E(cs_rest.inclusive_jets());
// impose the cuts in the rest-frame
if (subjets.size()<2) return PseudoJet();
const PseudoJet &j0 = subjets[0];
const PseudoJet &j1 = subjets[1];
/// impose the cut on cos(theta_s)
double ct0 = (j0.px()*jet.px() + j0.py()*jet.py() + j0.pz()*jet.pz())
/sqrt(j0.modp2()*jet.modp2());
double ct1 = (j1.px()*jet.px() + j1.py()*jet.py() + j1.pz()*jet.pz())
/sqrt(j1.modp2()*jet.modp2());
if ((ct0 > _costscut) || (ct1 > _costscut)) return PseudoJet();
// ccompute the 2-subjettiness and impose the coresponding cut
double tau2 = 0.0;
for (unsigned int i=0; i<rest_input.size(); i++)
tau2 += min(dot_product(rest_input[i], j0),
dot_product(rest_input[i], j1));
tau2 *= (2.0/jet.m2());
if (tau2 > _t2cut) return PseudoJet();
// We have a positive tag,
// - boost everything back into the lab frame
// - record the info in the interface
// Note that in order to point to the correct Clustersequence, the
// subjets must be taken from the boosted one. We extract that
// through the history index of the rest-frame subjets
ClusterSequence * cs_structure = new ClusterSequence();
Boost boost(jet);
cs_structure->transfer_from_sequence(cs_rest, &boost);
PseudoJet subjet_lab1 = cs_structure->jets()[cs_rest.history()[subjets[0].cluster_hist_index()].jetp_index];
PseudoJet subjet_lab2 = cs_structure->jets()[cs_rest.history()[subjets[0].cluster_hist_index()].jetp_index];
PseudoJet result_local = join<StructureType>(subjet_lab1,subjet_lab2);
StructureType * s = (StructureType *) result_local.structure_non_const_ptr();
// s->_original_jet = jet;
s->_tau2 = tau2;
s->_costhetas = max(ct0, ct1);
// keep the rest-frame CS alive
cs_structure->delete_self_when_unused();
return result_local;
}
FASTJET_END_NAMESPACE
fastjet::Boost
Class to boost a PseudoJet.
Definition Boost.hh:47
fastjet::ClusterSequence
deals with clustering
Definition ClusterSequence.hh:63
fastjet::ClusterSequence::history
const std::vector< history_element > & history() const
allow the user to access the raw internal history.
Definition ClusterSequence.hh:1007
fastjet::ClusterSequence::delete_self_when_unused
void delete_self_when_unused()
by calling this routine you tell the ClusterSequence to delete itself when all the Pseudojets associa...
Definition ClusterSequence.cc:1778
fastjet::ClusterSequence::inclusive_jets
std::vector< PseudoJet > inclusive_jets(const double ptmin=0.0) const
return a vector of all jets (in the sense of the inclusive algorithm) with pt >= ptmin.
Definition ClusterSequence.cc:916
fastjet::ClusterSequence::transfer_from_sequence
void transfer_from_sequence(const ClusterSequence &from_seq, const FunctionOfPseudoJet< PseudoJet > *action_on_jets=0)
transfer the sequence contained in other_seq into our own; any plugin "extras" contained in the from_...
Definition ClusterSequence.cc:839
fastjet::ClusterSequence::jets
const std::vector< PseudoJet > & jets() const
allow the user to access the internally stored _jets() array, which contains both the initial particl...
Definition ClusterSequence.hh:1003
fastjet::ClusterSequence::exclusive_jets
std::vector< PseudoJet > exclusive_jets(const double dcut) const
return a vector of all jets (in the sense of the exclusive algorithm) that would be obtained when run...
Definition ClusterSequence.cc:987
fastjet::PseudoJet
Class to contain pseudojets, including minimal information of use to jet-clustering routines.
Definition PseudoJet.hh:68
fastjet::PseudoJet::structure_non_const_ptr
PseudoJetStructureBase * structure_non_const_ptr()
return a non-const pointer to the structure (of type PseudoJetStructureBase*) associated with this Ps...
Definition PseudoJet.cc:606
fastjet::PseudoJet::constituents
virtual std::vector< PseudoJet > constituents() const
retrieve the constituents.
Definition PseudoJet.cc:692
fastjet::PseudoJet::m2
double m2() const
returns the squared invariant mass // like CLHEP
Definition PseudoJet.hh:163
fastjet::PseudoJet::has_constituents
virtual bool has_constituents() const
returns true if the PseudoJet has constituents
Definition PseudoJet.cc:686
fastjet::PseudoJet::modp2
double modp2() const
return the squared 3-vector modulus = px^2+py^2+pz^2
Definition PseudoJet.hh:178
fastjet::RestFrameNSubjettinessTaggerStructure::_costhetas
double _costhetas
the minimal angle between the dijets and the boost axis
Definition RestFrameNSubjettinessTagger.hh:154
fastjet::RestFrameNSubjettinessTaggerStructure::_tau2
double _tau2
the value of the N-subjettiness
Definition RestFrameNSubjettinessTagger.hh:153
fastjet::RestFrameNSubjettinessTagger::StructureType
RestFrameNSubjettinessTaggerStructure StructureType
the type of Structure returned
Definition RestFrameNSubjettinessTagger.hh:120
fastjet::RestFrameNSubjettinessTagger::result
virtual PseudoJet result(const PseudoJet &jet) const
runs the tagger on the given jet and returns the tagged PseudoJet if successful, a PseudoJet==0 other...
Definition RestFrameNSubjettinessTagger.cc:59
fastjet::RestFrameNSubjettinessTagger::description
virtual std::string description() const
returns a textual description of the tagger
Definition RestFrameNSubjettinessTagger.cc:46
fastjet::sorted_by_E
vector< PseudoJet > sorted_by_E(const vector< PseudoJet > &jets)
return a vector of jets sorted into decreasing energy
Definition PseudoJet.cc:898
fastjet::dot_product
double dot_product(const PseudoJet &a, const PseudoJet &b)
returns the 4-vector dot product of a and b
Definition PseudoJet.hh:935