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 thread_safety_helpers::FirstTimeTrue CMSIterativeConePlugin::_first_time;
 
   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;
 
  223   (*ostr) << 
"#-------------------------------------------------------------------------" << endl;
 
  224   (*ostr) << 
"# You are running the CMS Iterative Cone plugin for FastJet               " << endl;
 
  225   (*ostr) << 
"# Original code by the CMS collaboration adapted by the FastJet authors   " << endl;
 
  226   (*ostr) << 
"# If you use this plugin, please cite                                     " << endl;
 
  227   (*ostr) << 
"#   G. L. Bayatian et al. [CMS Collaboration],                            " << endl;
 
  228   (*ostr) << 
"#   CMS physics: Technical design report.                                 " << endl;
 
  229   (*ostr) << 
"# in addition to the usual FastJet reference.                             " << endl;
 
  230   (*ostr) << 
"#-------------------------------------------------------------------------" << endl;
 
  236 FASTJET_END_NAMESPACE