59 #include "fastjet/ClusterSequence.hh"
60 #include "fastjet/CMSIterativeConePlugin.hh"
68 FASTJET_BEGIN_NAMESPACE
77 T deltaPhi (T phi1, T phi2) {
78 T result = phi1 - phi2;
79 while (result > M_PI) result -= 2*M_PI;
80 while (result <= -M_PI) result += 2*M_PI;
85 T deltaR2 (T eta1, T phi1, T eta2, T phi2) {
87 T dphi = deltaPhi (phi1, phi2);
88 return deta*deta + dphi*dphi;
92 bool CMSIterativeConePlugin::_first_time =
true;
94 string CMSIterativeConePlugin::description ()
const {
96 desc <<
"CMSIterativeCone plugin with R = " << theConeRadius <<
" and seed threshold = " << theSeedThreshold;
106 list<PseudoJet> input;
107 for (
unsigned int i=0 ; i<clust_seq.
jets().size() ; i++) {
108 input.push_back(clust_seq.
jets()[i]);
110 NumericSafeGreaterByEt<PseudoJet> compCandidate;
112 input.sort(compCandidate);
116 while( !input.empty() && (input.front().Et() > theSeedThreshold )) {
118 double eta0=input.front().eta();
119 double phi0=input.front().phi();
125 list< list<PseudoJet>::iterator> cone;
126 for(
int iteration=0;iteration<100;iteration++){
132 for(list<PseudoJet>::iterator inp=input.begin();
133 inp!=input.end();inp++){
135 if( deltaR2(eta0,phi0,tower.eta(),tower.
phi()) <
136 theConeRadius*theConeRadius) {
137 double tower_et = tower.
Et();
139 eta+= tower_et*tower.eta();
140 double dphi=tower.
phi()-phi0;
141 if(dphi>M_PI) dphi-=2*M_PI;
142 else if(dphi<=-M_PI) dphi+=2*M_PI;
149 if(phi>M_PI)phi-=2*M_PI;
150 else if(phi<=-M_PI)phi+=2*M_PI;
152 if(fabs(eta-eta0)<.001 && fabs(phi-phi0)<.001)
break;
178 list< list<PseudoJet>::iterator>::const_iterator inp;
180 int jet_k = (*inp)->cluster_hist_index();
189 while (inp != cone.end()){
193 int jet_j = (*inp)->cluster_hist_index();
215 double d_iB = clust_seq.
jets()[jet_k].perp2();
224 void CMSIterativeConePlugin::_print_banner(ostream *ostr)
const{
225 if (! _first_time)
return;
231 (*ostr) <<
"#-------------------------------------------------------------------------" << endl;
232 (*ostr) <<
"# You are running the CMS Iterative Cone plugin for FastJet " << endl;
233 (*ostr) <<
"# Original code by the CMS collaboration adapted by the FastJet authors " << endl;
234 (*ostr) <<
"# If you use this plugin, please cite " << endl;
235 (*ostr) <<
"# G. L. Bayatian et al. [CMS Collaboration], " << endl;
236 (*ostr) <<
"# CMS physics: Technical design report. " << endl;
237 (*ostr) <<
"# in addition to the usual FastJet reference. " << endl;
238 (*ostr) <<
"#-------------------------------------------------------------------------" << endl;
244 FASTJET_END_NAMESPACE