52 #include "fastjet/ClusterSequence.hh"
53 #include "fastjet/CMSIterativeConePlugin.hh"
61 FASTJET_BEGIN_NAMESPACE
70 T deltaPhi (T phi1, T phi2) {
71 T result = phi1 - phi2;
72 while (result > M_PI) result -= 2*M_PI;
73 while (result <= -M_PI) result += 2*M_PI;
78 T deltaR2 (T eta1, T phi1, T eta2, T phi2) {
80 T dphi = deltaPhi (phi1, phi2);
81 return deta*deta + dphi*dphi;
85 bool CMSIterativeConePlugin::_first_time =
true;
87 string CMSIterativeConePlugin::description ()
const {
89 desc <<
"CMSIterativeCone plugin with R = " << theConeRadius <<
" and seed threshold = " << theSeedThreshold;
99 list<PseudoJet> input;
100 for (
unsigned int i=0 ; i<clust_seq.
jets().size() ; i++) {
101 input.push_back(clust_seq.
jets()[i]);
103 NumericSafeGreaterByEt<PseudoJet> compCandidate;
105 input.sort(compCandidate);
109 while( !input.empty() && (input.front().Et() > theSeedThreshold )) {
111 double eta0=input.front().eta();
112 double phi0=input.front().phi();
118 list< list<PseudoJet>::iterator> cone;
119 for(
int iteration=0;iteration<100;iteration++){
125 for(list<PseudoJet>::iterator inp=input.begin();
126 inp!=input.end();inp++){
128 if( deltaR2(eta0,phi0,tower.eta(),tower.
phi()) <
129 theConeRadius*theConeRadius) {
130 double tower_et = tower.
Et();
132 eta+= tower_et*tower.eta();
133 double dphi=tower.
phi()-phi0;
134 if(dphi>M_PI) dphi-=2*M_PI;
135 else if(dphi<=-M_PI) dphi+=2*M_PI;
142 if(phi>M_PI)phi-=2*M_PI;
143 else if(phi<=-M_PI)phi+=2*M_PI;
145 if(fabs(eta-eta0)<.001 && fabs(phi-phi0)<.001)
break;
171 list< list<PseudoJet>::iterator>::const_iterator inp;
173 int jet_k = (*inp)->cluster_hist_index();
182 while (inp != cone.end()){
186 int jet_j = (*inp)->cluster_hist_index();
208 double d_iB = clust_seq.
jets()[jet_k].perp2();
217 void CMSIterativeConePlugin::_print_banner(ostream *ostr)
const{
218 if (! _first_time)
return;
224 (*ostr) <<
"#-------------------------------------------------------------------------" << endl;
225 (*ostr) <<
"# You are running the CMS Iterative Cone plugin for FastJet " << endl;
226 (*ostr) <<
"# Original code by the CMS collaboration adapted by the FastJet authors " << endl;
227 (*ostr) <<
"# If you use this plugin, please cite " << endl;
228 (*ostr) <<
"# G. L. Bayatian et al. [CMS Collaboration], " << endl;
229 (*ostr) <<
"# CMS physics: Technical design report. " << endl;
230 (*ostr) <<
"# in addition to the usual FastJet reference. " << endl;
231 (*ostr) <<
"#-------------------------------------------------------------------------" << endl;
237 FASTJET_END_NAMESPACE
const std::vector< PseudoJet > & jets() const
allow the user to access the internally stored _jets() array, which contains both the initial particl...
double Et() const
return the transverse energy
void plugin_record_ij_recombination(int jet_i, int jet_j, double dij, int &newjet_k)
record the fact that there has been a recombination between jets()[jet_i] and jets()[jet_k], with the specified dij, and return the index (newjet_k) allocated to the new jet, whose momentum is assumed to be the 4-vector sum of that of jet_i and jet_j
void plugin_record_iB_recombination(int jet_i, double diB)
record the fact that there has been a recombination between jets()[jet_i] and the beam...
double phi() const
returns phi (in the range 0..2pi)
static std::ostream * fastjet_banner_stream()
returns a pointer to the stream to be used to print banners (cout by default).
Class to contain pseudojets, including minimal information of use to jet-clustering routines...