- Timestamp:
- Sep 3, 2014, 3:18:54 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- be2222c
- Parents:
- 5b5a56b
- Location:
- external/fastjet
- Files:
-
- 30 added
- 173 edited
Legend:
- Unmodified
- Added
- Removed
-
external/fastjet/AUTHORS
r5b5a56b r35cdc46 10 10 ---------------------------------------------------------------------- 11 11 12 Many people have provided bug reports, suggestions for development and13 in some cases explicit code for plugin algorithms. We wouldin14 particular like to thank12 Many people have provided bug reports, suggestions for development, 13 documentation and in some cases explicit code for plugin 14 algorithms. We would in particular like to thank 15 15 16 16 Vanya Belyaev … … 32 32 Hartmut Stadie 33 33 Mark Sutton 34 Jesse Thaler 34 35 Chris Vermilion 35 36 Markus Wobisch -
external/fastjet/ActiveAreaSpec.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ActiveAreaSpec.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: ActiveAreaSpec.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/AreaDefinition.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: AreaDefinition.cc 3619 2014-08-13 14:17:19Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/AreaDefinition.hh" … … 68 70 break; 69 71 default: 70 cerr << "Error: unrecognized area_type in AreaDefinition::description():"72 ostr << "Error: unrecognized area_type in AreaDefinition::description():" 71 73 << area_type() << endl; 72 exit(-1);74 throw Error(ostr.str()); 73 75 } 74 76 return ostr.str(); -
external/fastjet/AreaDefinition.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: AreaDefinition.hh 2687 2011-11-14 11:17:51Z soyez$1 //FJSTARTHEADER 2 // $Id: AreaDefinition.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2006-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2006-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/BasicRandom.cc
r5b5a56b r35cdc46 1 //STARTHEADER 2 // simple random number generator class taken from nlojet++. 3 // $Id$ 1 //FJSTARTHEADER 2 // $Id: BasicRandom.cc 3433 2014-07-23 08:17:03Z salam $ 4 3 // 5 // Copyright (C) 2002 Zoltan Nagy4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 6 5 // 7 // This program is free software; you can redistribute it and/or modify 6 //---------------------------------------------------------------------- 7 // This file is part of FastJet. 8 // 9 // FastJet is free software; you can redistribute it and/or modify 8 10 // it under the terms of the GNU General Public License as published by 9 11 // the Free Software Foundation; either version 2 of the License, or 10 12 // (at your option) any later version. 11 13 // 12 // This program is distributed in the hope that it will be useful, 14 // The algorithms that underlie FastJet have required considerable 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 17 // FastJet as part of work towards a scientific publication, please 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 20 // 21 // FastJet is distributed in the hope that it will be useful, 13 22 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the … … 16 25 // 17 26 // You should have received a copy of the GNU General Public License 18 // along with this program; if not, write to the Free Software19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA20 // ENDHEADER27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 28 //---------------------------------------------------------------------- 29 //FJENDHEADER 21 30 22 31 // nlo includes -
external/fastjet/CircularRange.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: CircularRange.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: CircularRange.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/ClosestPair2D.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: ClosestPair2D.cc 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/internal/ClosestPair2D.hh" … … 36 38 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 37 39 38 const unsigned int huge_unsigned = 4294967295U;39 40 const unsigned int twopow31 = 2147483648U; 40 41 … … 183 184 ID2 = _ID(_points[ID1].neighbour); 184 185 distance2 = _points[ID1].neighbour_dist2; 186 // we make the swap explicitly in the std namespace to avoid 187 // potential conflict with the fastjet::swap introduced by 188 // SharedPtr. 189 // This is only an issue because we are in the fastjet namespace 185 190 if (ID1 > ID2) std::swap(ID1,ID2); 186 191 } -
external/fastjet/ClusterSequence.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: ClusterSequence.cc 3619 2014-08-13 14:17:19Z salam $ 3 3 // 4 // Copyright (c) 2005-201 3, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/Error.hh" … … 32 34 #include "fastjet/ClusterSequenceStructure.hh" 33 35 #include "fastjet/version.hh" // stores the current version number 36 #include "fastjet/internal/LazyTiling9Alt.hh" 37 #include "fastjet/internal/LazyTiling9.hh" 38 #include "fastjet/internal/LazyTiling25.hh" 39 #include "fastjet/internal/LazyTiling9SeparateGhosts.hh" 34 40 #include<iostream> 35 41 #include<sstream> … … 187 193 //DEP //---------------------------------------------------------------------- 188 194 //DEP void ClusterSequence::_initialise_and_run ( 189 //DEP const double &R,195 //DEP const double R, 190 196 //DEP const Strategy & strategy, 191 197 //DEP const bool & writeout_combinations) { … … 273 279 // ./fastjet_timing_plugins -kt -nhardest 30 -repeat 50000 -strategy -3 -R 0.5 -nev 1 < ../../data/Pythia-PtMin1000-LHC-1000ev.dat 274 280 if (_strategy == Best) { 281 _strategy = _best_strategy(); 282 #ifdef DROP_CGAL 283 // fall back strategy for large N when CGAL is missing 284 if (_strategy == NlnN) _strategy = N2MHTLazy25; 285 #endif // DROP_CGAL 286 } else if (_strategy == BestFJ30) { 275 287 int N = _jets.size(); 276 288 //if (N <= 55*max(0.5,min(1.0,_Rparam))) {// old empirical scaling with R … … 324 336 // run the code containing the selected strategy 325 337 // 326 // We order the strategies st qrting from the ones used by the Best338 // We order the strategies starting from the ones used by the Best 327 339 // strategy in the order of increasing N, then the remaining ones 328 340 // again in the order of increasing N. … … 334 346 } else if (_strategy == N2MinHeapTiled) { 335 347 this->_minheap_faster_tiled_N2_cluster(); 348 } else if (_strategy == N2MHTLazy9Alt) { 349 // attempt to use an external tiling routine -- it manipulates 350 // the CS history via the plugin mechanism 351 _plugin_activated = true; 352 LazyTiling9Alt tiling(*this); 353 tiling.run(); 354 _plugin_activated = false; 355 356 } else if (_strategy == N2MHTLazy25) { 357 // attempt to use an external tiling routine -- it manipulates 358 // the CS history via the plugin mechanism 359 _plugin_activated = true; 360 LazyTiling25 tiling(*this); 361 tiling.run(); 362 _plugin_activated = false; 363 364 } else if (_strategy == N2MHTLazy9) { 365 // attempt to use an external tiling routine -- it manipulates 366 // the CS history via the plugin mechanism 367 _plugin_activated = true; 368 LazyTiling9 tiling(*this); 369 tiling.run(); 370 _plugin_activated = false; 371 372 } else if (_strategy == N2MHTLazy9AntiKtSeparateGhosts) { 373 // attempt to use an external tiling routine -- it manipulates 374 // the CS history via the plugin mechanism 375 _plugin_activated = true; 376 LazyTiling9SeparateGhosts tiling(*this); 377 tiling.run(); 378 _plugin_activated = false; 379 336 380 } else if (_strategy == NlnN) { 337 381 this->_delaunay_cluster(); … … 359 403 // these needs to be defined outside the class definition. 360 404 bool ClusterSequence::_first_time = true; 361 int ClusterSequence::_n_exclusive_warnings = 0;405 LimitedWarning ClusterSequence::_exclusive_warnings; 362 406 363 407 … … 473 517 474 518 //---------------------------------------------------------------------- 475 // Return the component corresponding to the specified index.476 // taken from CLHEP477 519 string ClusterSequence::strategy_string (Strategy strategy_in) const { 478 520 string strategy; … … 492 534 case N2PoorTiled: 493 535 strategy = "N2PoorTiled"; break; 536 case N2MHTLazy9: 537 strategy = "N2MHTLazy9"; break; 538 case N2MHTLazy9Alt: 539 strategy = "N2MHTLazy9Alt"; break; 540 case N2MHTLazy25: 541 strategy = "N2MHTLazy25"; break; 542 case N2MHTLazy9AntiKtSeparateGhosts: 543 strategy = "N2MHTLazy9AntiKtSeparateGhosts"; break; 494 544 case N3Dumb: 495 545 strategy = "N3Dumb"; break; … … 528 578 } else {return 1.0;} 529 579 } else {throw Error("Unrecognised jet algorithm");} 580 } 581 582 //---------------------------------------------------------------------- 583 // returns a suggestion for the best strategy to use on event 584 // multiplicity, algorithm, R, etc. 585 // 586 // Some of the work to establish the best strategy is collected in 587 // issue-tracker/2014-07-auto-strategy-selection; 588 // transition_fit_v2.fit indicates the results of the fits that we're 589 // using here. (Automatically generated by transition_fit_v2.gp). 590 // 591 // The transition to NlnN is always present, and it is the the 592 // caller's responsibility to drop back down to N2MHTLazy25 if NlnN 593 // isn't available. 594 // 595 // This routine should be called only if the jet alg is one of kt, 596 // antikt, cam or genkt. 597 Strategy ClusterSequence::_best_strategy() const { 598 int N = _jets.size(); 599 // define bounded R, always above 0.1, because we don't trust any 600 // of our parametrizations below R = 0.1 601 double bounded_R = max(_Rparam, 0.1); 602 603 // the very first test thing is a quick hard-coded test to decide 604 // if we immediately opt for N2Plain 605 if (N <= 30 || N <= 39.0/(bounded_R + 0.6)) { 606 return N2Plain; 607 } 608 609 // Define objects that describe our various boundaries. A prefix N_ 610 // indicates that boundary is for N, while L_ means it's for log(N). 611 // 612 // Hopefully having them static will ensure minimal overhead 613 // in creating them; collecting them in one place should 614 // help with updates? 615 // 616 const static _Parabola N_Tiled_to_MHT_lowR (-45.4947,54.3528,44.6283); 617 const static _Parabola L_MHT_to_MHTLazy9_lowR (0.677807,-1.05006,10.6994); 618 const static _Parabola L_MHTLazy9_to_MHTLazy25_akt_lowR(0.169967,-0.512589,12.1572); 619 const static _Parabola L_MHTLazy9_to_MHTLazy25_kt_lowR (0.16237,-0.484612,12.3373); 620 const static _Parabola L_MHTLazy9_to_MHTLazy25_cam_lowR = L_MHTLazy9_to_MHTLazy25_kt_lowR; 621 const static _Parabola L_MHTLazy25_to_NlnN_akt_lowR (0.0472051,-0.22043,15.9196); 622 const static _Parabola L_MHTLazy25_to_NlnN_kt_lowR (0.118609,-0.326811,14.8287); 623 const static _Parabola L_MHTLazy25_to_NlnN_cam_lowR (0.10119,-0.295748,14.3924); 624 625 const static _Line L_Tiled_to_MHTLazy9_medR (-1.31304,7.29621); 626 const static _Parabola L_MHTLazy9_to_MHTLazy25_akt_medR = L_MHTLazy9_to_MHTLazy25_akt_lowR; 627 const static _Parabola L_MHTLazy9_to_MHTLazy25_kt_medR = L_MHTLazy9_to_MHTLazy25_kt_lowR; 628 const static _Parabola L_MHTLazy9_to_MHTLazy25_cam_medR = L_MHTLazy9_to_MHTLazy25_cam_lowR; 629 const static _Parabola L_MHTLazy25_to_NlnN_akt_medR = L_MHTLazy25_to_NlnN_akt_lowR; 630 const static _Parabola L_MHTLazy25_to_NlnN_kt_medR = L_MHTLazy25_to_NlnN_kt_lowR; 631 const static _Parabola L_MHTLazy25_to_NlnN_cam_medR = L_MHTLazy25_to_NlnN_cam_lowR; 632 633 const static double N_Plain_to_MHTLazy9_largeR = 75; 634 const static double N_MHTLazy9_to_MHTLazy25_akt_largeR = 700; 635 const static double N_MHTLazy9_to_MHTLazy25_kt_largeR = 1000; 636 const static double N_MHTLazy9_to_MHTLazy25_cam_largeR = 1000; 637 const static double N_MHTLazy25_to_NlnN_akt_largeR = 100000; 638 const static double N_MHTLazy25_to_NlnN_kt_largeR = 40000; 639 const static double N_MHTLazy25_to_NlnN_cam_largeR = 15000; 640 641 // We have timing studies only for kt, cam and antikt; for other 642 // algorithms we set the local jet_algorithm variable to the one of 643 // kt,cam,antikt that we think will be closest in behaviour to the 644 // other alg. 645 JetAlgorithm jet_algorithm; 646 if (_jet_algorithm == genkt_algorithm) { 647 // for genkt, then we set the local jet_algorithm variable (used 648 // only for strategy choice) to be either kt or antikt, depending on 649 // the p value. 650 double p = jet_def().extra_param(); 651 if (p < 0.0) jet_algorithm = antikt_algorithm; 652 else jet_algorithm = kt_algorithm; 653 } else if (_jet_algorithm == cambridge_for_passive_algorithm) { 654 // we assume (but haven't tested) that using the kt-alg timing 655 // transitions should be adequate for cambridge_for_passive_algorithm 656 jet_algorithm = kt_algorithm; 657 } else { 658 jet_algorithm = _jet_algorithm; 659 } 660 661 if (bounded_R < 0.65) { 662 // low R case 663 if (N < N_Tiled_to_MHT_lowR(bounded_R)) return N2Tiled; 664 double logN = log(double(N)); 665 if (logN < L_MHT_to_MHTLazy9_lowR(bounded_R)) return N2MinHeapTiled; 666 else { 667 if (jet_algorithm == antikt_algorithm){ 668 if (logN < L_MHTLazy9_to_MHTLazy25_akt_lowR(bounded_R)) return N2MHTLazy9; 669 else if (logN < L_MHTLazy25_to_NlnN_akt_lowR(bounded_R)) return N2MHTLazy25; 670 else return NlnN; 671 } else if (jet_algorithm == kt_algorithm){ 672 if (logN < L_MHTLazy9_to_MHTLazy25_kt_lowR(bounded_R)) return N2MHTLazy9; 673 else if (logN < L_MHTLazy25_to_NlnN_kt_lowR(bounded_R)) return N2MHTLazy25; 674 else return NlnN; 675 } else if (jet_algorithm == cambridge_algorithm) { 676 if (logN < L_MHTLazy9_to_MHTLazy25_cam_lowR(bounded_R)) return N2MHTLazy9; 677 else if (logN < L_MHTLazy25_to_NlnN_cam_lowR(bounded_R)) return N2MHTLazy25; 678 else return NlnNCam; 679 } 680 } 681 } else if (bounded_R < 0.5*pi) { 682 // medium R case 683 double logN = log(double(N)); 684 if (logN < L_Tiled_to_MHTLazy9_medR(bounded_R)) return N2Tiled; 685 else { 686 if (jet_algorithm == antikt_algorithm){ 687 if (logN < L_MHTLazy9_to_MHTLazy25_akt_medR(bounded_R)) return N2MHTLazy9; 688 else if (logN < L_MHTLazy25_to_NlnN_akt_medR(bounded_R)) return N2MHTLazy25; 689 else return NlnN; 690 } else if (jet_algorithm == kt_algorithm){ 691 if (logN < L_MHTLazy9_to_MHTLazy25_kt_medR(bounded_R)) return N2MHTLazy9; 692 else if (logN < L_MHTLazy25_to_NlnN_kt_medR(bounded_R)) return N2MHTLazy25; 693 else return NlnN; 694 } else if (jet_algorithm == cambridge_algorithm) { 695 if (logN < L_MHTLazy9_to_MHTLazy25_cam_medR(bounded_R)) return N2MHTLazy9; 696 else if (logN < L_MHTLazy25_to_NlnN_cam_medR(bounded_R)) return N2MHTLazy25; 697 else return NlnNCam; 698 } 699 } 700 } else { 701 // large R case (R > pi/2) 702 if (N < N_Plain_to_MHTLazy9_largeR) return N2Plain; 703 else { 704 if (jet_algorithm == antikt_algorithm){ 705 if (N < N_MHTLazy9_to_MHTLazy25_akt_largeR) return N2MHTLazy9; 706 else if (N < N_MHTLazy25_to_NlnN_akt_largeR) return N2MHTLazy25; 707 else return NlnN; 708 } else if (jet_algorithm == kt_algorithm){ 709 if (N < N_MHTLazy9_to_MHTLazy25_kt_largeR) return N2MHTLazy9; 710 else if (N < N_MHTLazy25_to_NlnN_kt_largeR) return N2MHTLazy25; 711 else return NlnN; 712 } else if (jet_algorithm == cambridge_algorithm) { 713 if (N < N_MHTLazy9_to_MHTLazy25_cam_largeR) return N2MHTLazy9; 714 else if (N < N_MHTLazy25_to_NlnN_cam_largeR) return N2MHTLazy25; 715 else return NlnNCam; 716 } 717 } 718 } 719 720 bool code_should_never_reach_here = false; 721 assert(code_should_never_reach_here); 722 return N2MHTLazy9; 723 530 724 } 531 725 … … 662 856 //---------------------------------------------------------------------- 663 857 // return all inclusive jets with pt > ptmin 664 vector<PseudoJet> ClusterSequence::inclusive_jets (const double &ptmin) const{858 vector<PseudoJet> ClusterSequence::inclusive_jets (const double ptmin) const{ 665 859 double dcut = ptmin*ptmin; 666 860 int i = _history.size() - 1; // last jet … … 714 908 // return the number of exclusive jets that would have been obtained 715 909 // running the algorithm in exclusive mode with the given dcut 716 int ClusterSequence::n_exclusive_jets (const double &dcut) const {910 int ClusterSequence::n_exclusive_jets (const double dcut) const { 717 911 718 912 // first locate the point where clustering would have stopped (i.e. the … … 733 927 // return all exclusive jets that would have been obtained running 734 928 // the algorithm in exclusive mode with the given dcut 735 vector<PseudoJet> ClusterSequence::exclusive_jets (const double &dcut) const {929 vector<PseudoJet> ClusterSequence::exclusive_jets (const double dcut) const { 736 930 int njets = n_exclusive_jets(dcut); 737 931 return exclusive_jets(njets); … … 742 936 // return the jets obtained by clustering the event to n jets. 743 937 // Throw an error if there are fewer than n particles. 744 vector<PseudoJet> ClusterSequence::exclusive_jets (const int &njets) const {938 vector<PseudoJet> ClusterSequence::exclusive_jets (const int njets) const { 745 939 746 940 // make sure the user does not ask for more than jets than there … … 759 953 // return the jets obtained by clustering the event to n jets. 760 954 // If there are fewer than n particles, simply return all particles 761 vector<PseudoJet> ClusterSequence::exclusive_jets_up_to (const int &njets) const {955 vector<PseudoJet> ClusterSequence::exclusive_jets_up_to (const int njets) const { 762 956 763 957 // provide a warning when extracting exclusive jets for algorithms 764 958 // that does not support it explicitly. 765 // Native algorithm that support it are: kt, ee_kt, cambridge,959 // Native algorithm that support it are: kt, ee_kt, Cambridge/Aachen, 766 960 // genkt and ee_genkt (both with p>=0) 767 961 // For plugins, we check Plugin::exclusive_sequence_meaningful() … … 773 967 (_jet_def.extra_param() <0)) && 774 968 ((_jet_def.jet_algorithm() != plugin_algorithm) || 775 (!_jet_def.plugin()->exclusive_sequence_meaningful())) && 776 (_n_exclusive_warnings < 5)) { 777 _n_exclusive_warnings++; 778 cerr << "FastJet WARNING: dcut and exclusive jets for jet-finders other than kt should be interpreted with care." << endl; 969 (!_jet_def.plugin()->exclusive_sequence_meaningful()))) { 970 _exclusive_warnings.warn("dcut and exclusive jets for jet-finders other than kt, C/A or genkt with p>=0 should be interpreted with care."); 779 971 } 780 972 … … 829 1021 /// return the dmin corresponding to the recombination that went from 830 1022 /// n+1 to n jets 831 double ClusterSequence::exclusive_dmerge (const int &njets) const {1023 double ClusterSequence::exclusive_dmerge (const int njets) const { 832 1024 assert(njets >= 0); 833 1025 if (njets >= _initial_n) {return 0.0;} … … 841 1033 /// exclusive_dmerge, except in cases where the dmin do not increase 842 1034 /// monotonically. 843 double ClusterSequence::exclusive_dmerge_max (const int &njets) const {1035 double ClusterSequence::exclusive_dmerge_max (const int njets) const { 844 1036 assert(njets >= 0); 845 1037 if (njets >= _initial_n) {return 0.0;} … … 853 1045 /// the algorithm with the given dcut. 854 1046 std::vector<PseudoJet> ClusterSequence::exclusive_subjets 855 (const PseudoJet & jet, const double &dcut) const {1047 (const PseudoJet & jet, const double dcut) const { 856 1048 857 1049 set<const history_element*> subhist; … … 876 1068 /// exclusive_subjets.size() 877 1069 int ClusterSequence::n_exclusive_subjets(const PseudoJet & jet, 878 const double &dcut) const {1070 const double dcut) const { 879 1071 set<const history_element*> subhist; 880 1072 // get the set of history elements that correspond to subjets at … … 1181 1373 // //---------------------------------------------------------------------- 1182 1374 // // print out all inclusive jets with pt > ptmin 1183 // void ClusterSequence::print_jets (const double &ptmin) const{1375 // void ClusterSequence::print_jets (const double ptmin) const{ 1184 1376 // vector<PseudoJet> jets = sorted_by_pt(inclusive_jets(ptmin)); 1185 1377 // … … 1257 1449 // initialise the history in a standard way 1258 1450 void ClusterSequence::_add_step_to_history ( 1259 const int & step_number, const int &parent1,1260 const int & parent2, const int &jetp_index,1261 const double &dij) {1451 const int step_number, const int parent1, 1452 const int parent2, const int jetp_index, 1453 const double dij) { 1262 1454 1263 1455 history_element element; … … 1429 1621 /// of the recombined jet, newjet_k. 1430 1622 void ClusterSequence::_do_ij_recombination_step( 1431 const int & jet_i, const int &jet_j,1432 const double &dij,1623 const int jet_i, const int jet_j, 1624 const double dij, 1433 1625 int & newjet_k) { 1434 1626 … … 1466 1658 /// jet_i with the beam 1467 1659 void ClusterSequence::_do_iB_recombination_step( 1468 const int & jet_i, const double &diB) {1660 const int jet_i, const double diB) { 1469 1661 // get history index 1470 1662 int newstep_k = _history.size(); -
external/fastjet/ClusterSequence.hh
r5b5a56b r35cdc46 1 //STARTHEADER 2 // $Id: ClusterSequence.hh 3114 2013-05-04 08:46:00Z salam $ 1 #ifndef __FASTJET_CLUSTERSEQUENCE_HH__ 2 #define __FASTJET_CLUSTERSEQUENCE_HH__ 3 4 //FJSTARTHEADER 5 // $Id: ClusterSequence.hh 3619 2014-08-13 14:17:19Z salam $ 3 6 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 8 // 6 9 //---------------------------------------------------------------------- … … 13 16 // 14 17 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 20 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 18 23 // 19 24 // FastJet is distributed in the hope that it will be useful, … … 25 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 31 //---------------------------------------------------------------------- 27 //ENDHEADER 28 29 30 #ifndef __FASTJET_CLUSTERSEQUENCE_HH__ 31 #define __FASTJET_CLUSTERSEQUENCE_HH__ 32 //FJENDHEADER 33 32 34 33 35 #include<vector> … … 65 67 ClusterSequence () : _deletes_self_when_unused(false) {} 66 68 67 // /// create a clustersequence starting from the supplied set 68 // /// of pseudojets and clustering them with the long-invariant 69 // /// kt algorithm (E-scheme recombination) with the supplied 70 // /// value for R. 71 // /// 72 // /// If strategy=DumbN3 a very stupid N^3 algorithm is used for the 73 // /// clustering; otherwise strategy = NlnN* uses cylinders algorithms 74 // /// with some number of pi coverage. If writeout_combinations=true a 75 // /// summary of the recombination sequence is written out 76 // template<class L> ClusterSequence (const std::vector<L> & pseudojets, 77 // const double & R = 1.0, 78 // const Strategy & strategy = Best, 79 // const bool & writeout_combinations = false); 80 81 82 /// create a clustersequence starting from the supplied set 83 /// of pseudojets and clustering them with jet definition specified 69 /// create a ClusterSequence, starting from the supplied set 70 /// of PseudoJets and clustering them with jet definition specified 84 71 /// by jet_def (which also specifies the clustering strategy) 85 72 template<class L> ClusterSequence ( … … 104 91 /// algorithm) with pt >= ptmin. Time taken should be of the order 105 92 /// of the number of jets returned. 106 std::vector<PseudoJet> inclusive_jets (const double &ptmin = 0.0) const;93 std::vector<PseudoJet> inclusive_jets (const double ptmin = 0.0) const; 107 94 108 95 /// return the number of jets (in the sense of the exclusive 109 96 /// algorithm) that would be obtained when running the algorithm 110 97 /// with the given dcut. 111 int n_exclusive_jets (const double &dcut) const;98 int n_exclusive_jets (const double dcut) const; 112 99 113 100 /// return a vector of all jets (in the sense of the exclusive 114 101 /// algorithm) that would be obtained when running the algorithm 115 102 /// with the given dcut. 116 std::vector<PseudoJet> exclusive_jets (const double &dcut) const;103 std::vector<PseudoJet> exclusive_jets (const double dcut) const; 117 104 118 105 /// return a vector of all jets when the event is clustered (in the … … 121 108 /// If there are fewer than njets particles in the ClusterSequence 122 109 /// an error is thrown 123 std::vector<PseudoJet> exclusive_jets (const int &njets) const;110 std::vector<PseudoJet> exclusive_jets (const int njets) const; 124 111 125 112 /// return a vector of all jets when the event is clustered (in the … … 128 115 /// If there are fewer than njets particles in the ClusterSequence 129 116 /// the function just returns however many particles there were. 130 std::vector<PseudoJet> exclusive_jets_up_to (const int &njets) const;117 std::vector<PseudoJet> exclusive_jets_up_to (const int njets) const; 131 118 132 119 /// return the dmin corresponding to the recombination that went 133 120 /// from n+1 to n jets (sometimes known as d_{n n+1}). If the number 134 121 /// of particles in the event is <= njets, the function returns 0. 135 double exclusive_dmerge (const int &njets) const;122 double exclusive_dmerge (const int njets) const; 136 123 137 124 /// return the maximum of the dmin encountered during all recombinations … … 139 126 /// exclusive_dmerge, except in cases where the dmin do not increase 140 127 /// monotonically. 141 double exclusive_dmerge_max (const int &njets) const;128 double exclusive_dmerge_max (const int njets) const; 142 129 143 130 /// return the ymin corresponding to the recombination that went from … … 158 145 159 146 160 //int n_exclusive_jets (const PseudoJet & jet, const double &dcut) const;147 //int n_exclusive_jets (const PseudoJet & jet, const double dcut) const; 161 148 162 149 /// return a vector of all subjets of the current jet (in the sense … … 169 156 /// just getting that list of constituents. 170 157 std::vector<PseudoJet> exclusive_subjets (const PseudoJet & jet, 171 const double &dcut) const;158 const double dcut) const; 172 159 173 160 /// return the size of exclusive_subjets(...); still n ln n with same … … 175 162 /// exclusive_subjets.size() 176 163 int n_exclusive_subjets(const PseudoJet & jet, 177 const double &dcut) const;164 const double dcut) const; 178 165 179 166 /// return the list of subjets obtained by unclustering the supplied … … 193 180 int nsub) const; 194 181 195 /// return the dij that was present in the merging nsub+1 -> nsub182 /// returns the dij that was present in the merging nsub+1 -> nsub 196 183 /// subjets inside this jet. 197 184 /// … … 199 186 double exclusive_subdmerge(const PseudoJet & jet, int nsub) const; 200 187 201 /// return the maximum dij that occurred in the whole event at the188 /// returns the maximum dij that occurred in the whole event at the 202 189 /// stage that the nsub+1 -> nsub merge of subjets occurred inside 203 190 /// this jet. … … 207 194 208 195 //std::vector<PseudoJet> exclusive_jets (const PseudoJet & jet, 209 // const int &njets) const;210 //double exclusive_dmerge (const PseudoJet & jet, const int &njets) const;196 // const int njets) const; 197 //double exclusive_dmerge (const PseudoJet & jet, const int njets) const; 211 198 212 199 /// returns the sum of all energies in the event (relevant mainly for e+e-) … … 272 259 // Not yet. Perhaps in a future release. 273 260 // /// print out all inclusive jets with pt > ptmin 274 // virtual void print_jets (const double &ptmin=0.0) const;261 // virtual void print_jets (const double ptmin=0.0) const; 275 262 276 263 /// add on to subjet_vector the constituents of jet (for internal use mainly) … … 300 287 /// 301 288 /// NB: after having made this call, the user is still allowed to 302 /// delete the CS or let it go out of scope. Jets associated with it 303 /// will then simply not be able to access their substructure after 304 /// that point. 289 /// delete the CS. Jets associated with it will then simply not be 290 /// able to access their substructure after that point. 305 291 void delete_self_when_unused(); 306 292 … … 313 299 314 300 /// returns the scale associated with a jet as required for this 315 /// clustering algorithm (kt^2 for the kt-algorithm, 1 for the 316 /// Cambridge algorithm). [May become virtual at some point] 301 /// clustering algorithm (kt^2 for the kt-algorithm, 1 for the 302 /// Cambridge algorithm). Intended mainly for internal use and not 303 /// valid for plugin algorithms. 317 304 double jet_scale_for_algorithm(const PseudoJet & jet) const; 318 305 … … 363 350 364 351 /// the plugin can associate some extra information with the 352 /// ClusterSequence object by calling this function. The 353 /// ClusterSequence takes ownership of the pointer (and 354 /// responsibility for deleting it when the CS gets deleted). 355 inline void plugin_associate_extras(Extras * extras_in) { 356 _extras.reset(extras_in); 357 } 358 359 /// the plugin can associate some extra information with the 365 360 /// ClusterSequence object by calling this function 361 /// 362 /// As of FJ v3.1, this is deprecated, in line with the deprecation 363 /// of auto_ptr in C++11 366 364 inline void plugin_associate_extras(std::auto_ptr<Extras> extras_in) { 367 //_extras = extras_in;368 365 _extras.reset(extras_in.release()); 369 366 } … … 599 596 //DEP /// clustering, provided for legacy purposes. The jet finder is that 600 597 //DEP /// specified in the static member _default_jet_algorithm. 601 //DEP void _initialise_and_run (const double &R,598 //DEP void _initialise_and_run (const double R, 602 599 //DEP const Strategy & strategy, 603 600 //DEP const bool & writeout_combinations); … … 622 619 /// jet_j, at distance scale dij; return the index newjet_k of the 623 620 /// result of the recombination of i and j. 624 void _do_ij_recombination_step(const int & jet_i, const int &jet_j,625 const double &dij, int & newjet_k);621 void _do_ij_recombination_step(const int jet_i, const int jet_j, 622 const double dij, int & newjet_k); 626 623 627 624 /// carry out an recombination step in which _jets[jet_i] merges with 628 625 /// the beam, 629 void _do_iB_recombination_step(const int & jet_i, const double &diB);626 void _do_iB_recombination_step(const int jet_i, const double diB); 630 627 631 628 /// every time a jet is added internally during clustering, this … … 640 637 void _update_structure_use_count(); 641 638 639 /// returns a suggestion for the best strategy to use on event 640 /// multiplicity, algorithm, R, etc. 641 Strategy _best_strategy() const; 642 643 /// returns c*(a*R**2 + b*R + 1); 644 /// Written as a class in case we want to give names to different 645 /// parabolas 646 class _Parabola { 647 public: 648 _Parabola(double a, double b, double c) : _a(a), _b(b), _c(c) {} 649 inline double operator()(const double R) const {return _c*(_a*R*R + _b*R + 1);} 650 private: 651 double _a, _b, _c; 652 }; 653 654 /// operator()(R) returns a*R+b; 655 class _Line { 656 public: 657 _Line(double a, double b) : _a(a), _b(b) {} 658 inline double operator()(const double R) const {return _a*R + _b;} 659 private: 660 double _a, _b; 661 }; 642 662 643 663 /// This contains the physical PseudoJets; for each PseudoJet one … … 681 701 682 702 bool _plugin_activated; 683 //std::auto_ptr<Extras> _extras; // things the plugin might want to add684 703 SharedPtr<Extras> _extras; // things the plugin might want to add 685 704 … … 705 724 void _fast_NsqrtN_cluster(); 706 725 707 void _add_step_to_history(const int & step_number, const int &parent1,708 const int & parent2, const int &jetp_index,709 const double &dij);726 void _add_step_to_history(const int step_number, const int parent1, 727 const int parent2, const int jetp_index, 728 const double dij); 710 729 711 730 /// internal routine associated with the construction of the unique … … 726 745 727 746 /// currently used only in the Voronoi based code 728 void _add_ktdistance_to_map(const int &ii,747 void _add_ktdistance_to_map(const int ii, 729 748 DistMap & DijMap, 730 749 const DynamicNearestNeighbours * DNN); … … 734 753 static bool _first_time; 735 754 736 /// record the number of warnings provided about the exclusive 737 /// algorithm -- so that we don't print it out more than a few 738 /// times. 739 static int _n_exclusive_warnings; 755 /// manage warnings related to exclusive jets access 756 static LimitedWarning _exclusive_warnings; 740 757 741 758 /// the limited warning member for notification of user that … … 754 771 int _jets_index; 755 772 }; 756 757 773 758 774 /// structure analogous to BriefJet, but with the extra information … … 862 878 // routines for tiled case, including some overloads of the plain 863 879 // BriefJet cases 864 int _tile_index(const double & eta, const double &phi) const;880 int _tile_index(const double eta, const double phi) const; 865 881 void _tj_set_jetinfo ( TiledJet * const jet, const int _jets_index); 866 882 void _bj_remove_from_tiles(TiledJet * const jet); … … 871 887 void _add_untagged_neighbours_to_tile_union(const int tile_index, 872 888 std::vector<int> & tile_union, int & n_near_tiles); 873 874 889 875 890 //---------------------------------------------------------------------- … … 923 938 // template<class L> ClusterSequence::ClusterSequence ( 924 939 // const std::vector<L> & pseudojets, 925 // const double &R,940 // const double R, 926 941 // const Strategy & strategy, 927 942 // const bool & writeout_combinations) { … … 966 981 967 982 inline unsigned int ClusterSequence::n_particles() const {return _initial_n;} 983 984 //---------------------------------------------------------------------- 985 // implementation of JetDefinition::operator() is here to avoid nasty 986 // issues of order of implementations and includes 987 template<class L> 988 std::vector<PseudoJet> JetDefinition::operator()(const std::vector<L> & particles) const { 989 // create a new cluster sequence 990 ClusterSequence * cs = new ClusterSequence(particles, *this); 991 992 // get the jets, and sort them according to whether the algorithm 993 // is spherical or not 994 std::vector<PseudoJet> jets; 995 if (is_spherical()) { 996 jets = sorted_by_E(cs->inclusive_jets()); 997 } else { 998 jets = sorted_by_pt(cs->inclusive_jets()); 999 } 1000 1001 // make sure the ClusterSequence gets deleted once it's no longer 1002 // needed 1003 if (jets.size() != 0) { 1004 cs->delete_self_when_unused(); 1005 } else { 1006 delete cs; 1007 } 1008 1009 return jets; 1010 } 968 1011 969 1012 -
external/fastjet/ClusterSequence1GhostPassiveArea.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: ClusterSequence1GhostPassiveArea.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/ClusterSequence1GhostPassiveArea.hh" -
external/fastjet/ClusterSequence1GhostPassiveArea.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ClusterSequence1GhostPassiveArea.hh 2687 2011-11-14 11:17:51Z soyez$1 //FJSTARTHEADER 2 // $Id: ClusterSequence1GhostPassiveArea.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_CLUSTERSEQUENCE1GHOSTPASSIVEAREA_HH__ -
external/fastjet/ClusterSequenceActiveArea.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: ClusterSequenceActiveArea.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/PseudoJet.hh" -
external/fastjet/ClusterSequenceActiveArea.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ClusterSequenceActiveArea.hh 2687 2011-11-14 11:17:51Z soyez$3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: ClusterSequenceActiveArea.hh 3619 2014-08-13 14:17:19Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_CLUSTERSEQUENCEACTIVEAREA_HH__ … … 83 85 /// the background (e.g. non-jet) activity in a highly populated event; the 84 86 /// one that has been most extensively tested is median. 87 /// 88 /// These strategies are OBSOLETE and deprecated (see comment 89 /// for pt_per_unit_area). 85 90 enum mean_pt_strategies{median=0, non_ghost_median, pttot_over_areatot, 86 91 pttot_over_areatot_cut, mean_ratio_cut, play, … … 93 98 /// have pt/area > median(pt/area)*range. 94 99 /// 95 /// NB: This call is OBSOLETE; use media_pt_per_unit_area from the 96 // ClusterSequenceAreaBase class instead 100 /// NB: This call is OBSOLETE and deprecated; use a 101 /// JetMedianBackgroundEstimator or GridMedianBackgroundEstimator 102 /// instead. 97 103 double pt_per_unit_area(mean_pt_strategies strat=median, 98 104 double range=2.0 ) const; 99 105 100 // following code removed -- now dealt with by AreaBase class (and101 // this definition here conflicts with it).102 // /// fits a form pt_per_unit_area(y) = a + b*y^2 in the range103 // /// abs(y)<raprange (for negative raprange, it defaults to104 // /// _safe_rap_for_area).105 // void parabolic_pt_per_unit_area(double & a,double & b, double raprange=-1.0,106 // double exclude_above=-1.0,107 // bool use_area_4vector=false ) const;108 //109 106 /// rewrite the empty area from the parent class, so as to use 110 107 /// all info at our disposal -
external/fastjet/ClusterSequenceActiveAreaExplicitGhosts.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: ClusterSequenceActiveAreaExplicitGhosts.cc 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh" -
external/fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ClusterSequenceActiveAreaExplicitGhosts.hh 2687 2011-11-14 11:17:51Z soyez$3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: ClusterSequenceActiveAreaExplicitGhosts.hh 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_CLUSTERSEQUENCEACTIVEAREAEXPLICITGHOSTS_HH_ -
external/fastjet/ClusterSequenceArea.cc
r5b5a56b r35cdc46 1 //FJSTARTHEADER 2 // $Id: ClusterSequenceArea.cc 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2006-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 // 6 //---------------------------------------------------------------------- 7 // This file is part of FastJet. 8 // 9 // FastJet is free software; you can redistribute it and/or modify 10 // it under the terms of the GNU General Public License as published by 11 // the Free Software Foundation; either version 2 of the License, or 12 // (at your option) any later version. 13 // 14 // The algorithms that underlie FastJet have required considerable 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 17 // FastJet as part of work towards a scientific publication, please 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 20 // 21 // FastJet is distributed in the hope that it will be useful, 22 // but WITHOUT ANY WARRANTY; without even the implied warranty of 23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 // GNU General Public License for more details. 25 // 26 // You should have received a copy of the GNU General Public License 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 28 //---------------------------------------------------------------------- 29 //FJENDHEADER 30 1 31 #include "fastjet/ClusterSequenceArea.hh" 2 32 -
external/fastjet/ClusterSequenceArea.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ClusterSequenceArea.hh 2690 2011-11-14 14:57:54Z soyez $3 // 4 // Copyright (c) 2006-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: ClusterSequenceArea.hh 3484 2014-07-29 21:39:39Z soyez $ 3 // 4 // Copyright (c) 2006-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_CLUSTERSEQUENCEAREA_HH__ … … 245 247 break; 246 248 default: 247 std::cerr << "Error: unrecognized area_type in ClusterSequenceArea:" 248 << _area_def.area_type() << std::endl; 249 exit(-1); 249 std::ostringstream err; 250 err << "Error: unrecognized area_type in ClusterSequenceArea:" 251 << _area_def.area_type(); 252 throw Error(err.str()); 253 //exit(-1); 250 254 } 251 255 // now copy across the information from the area base class -
external/fastjet/ClusterSequenceAreaBase.cc
r5b5a56b r35cdc46 1 1 2 // STARTHEADER3 // $Id $4 // 5 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez2 //FJSTARTHEADER 3 // $Id: ClusterSequenceAreaBase.cc 3433 2014-07-23 08:17:03Z salam $ 4 // 5 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 6 6 // 7 7 //---------------------------------------------------------------------- … … 14 14 // 15 15 // The algorithms that underlie FastJet have required considerable 16 // development and are described in hep-ph/0512210. If you use 16 // development. They are described in the original FastJet paper, 17 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 17 18 // FastJet as part of work towards a scientific publication, please 18 // include a citation to the FastJet paper. 19 // quote the version you use and include a citation to the manual and 20 // optionally also to hep-ph/0512210. 19 21 // 20 22 // FastJet is distributed in the hope that it will be useful, … … 26 28 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 27 29 //---------------------------------------------------------------------- 28 // ENDHEADER30 //FJENDHEADER 29 31 30 32 -
external/fastjet/ClusterSequenceAreaBase.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ClusterSequenceAreaBase.hh 2687 2011-11-14 11:17:51Z soyez$3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: ClusterSequenceAreaBase.hh 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_CLUSTERSEQUENCEAREABASE_HH__ -
external/fastjet/ClusterSequencePassiveArea.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: ClusterSequencePassiveArea.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/ClusterSequencePassiveArea.hh" -
external/fastjet/ClusterSequencePassiveArea.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ClusterSequencePassiveArea.hh 2687 2011-11-14 11:17:51Z soyez$1 //FJSTARTHEADER 2 // $Id: ClusterSequencePassiveArea.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_CLUSTERSEQUENCEPASSIVEAREA_HH__ -
external/fastjet/ClusterSequenceStructure.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: ClusterSequenceStructure.cc 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/ClusterSequenceStructure.hh" -
external/fastjet/ClusterSequenceStructure.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ClusterSequenceStructure.hh 3 071 2013-04-01 12:52:46Z cacciari$3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: ClusterSequenceStructure.hh 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/ClusterSequenceVoronoiArea.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2006-20 07 Matteo Cacciari, GavinSalam and Gregory Soyez5 // 6 //---------------------------------------------------------------------- 7 // This file is part of a simple command-line handling environment1 //FJSTARTHEADER 2 // $Id: ClusterSequenceVoronoiArea.cc 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2006-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 // 6 //---------------------------------------------------------------------- 7 // This file is part of FastJet. 8 8 // 9 9 // FastJet is free software; you can redistribute it and/or modify … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/ClusterSequenceVoronoiArea.hh" … … 276 278 // -- first the initial ones 277 279 _voronoi_area.reserve(2*n_particles()); 280 _voronoi_area_4vector.reserve(2*n_particles()); 278 281 for (unsigned int i=0; i<n_particles(); i++) { 279 282 _voronoi_area.push_back(_pa_calc->area(i)); -
external/fastjet/ClusterSequenceVoronoiArea.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ClusterSequenceVoronoiArea.hh 2687 2011-11-14 11:17:51Z soyez$1 //FJSTARTHEADER 2 // $Id: ClusterSequenceVoronoiArea.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_CLUSTERSEQUENCEVORONOIAREA_HH__ … … 66 68 return _voronoi_area[jet.cluster_hist_index()];} 67 69 68 /// return a 4-vector area associated with the given jet -- stric ly70 /// return a 4-vector area associated with the given jet -- strictly 69 71 /// this is not the exact 4-vector area, but rather an approximation 70 72 /// made of sums of centres of all Voronoi cells in jet, each -
external/fastjet/ClusterSequenceWithArea.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ClusterSequenceWithArea.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: ClusterSequenceWithArea.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2006-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2006-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_CLUSTERSEQUENCEWITHAREA_HH__ -
external/fastjet/ClusterSequence_CP2DChan.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: ClusterSequence_CP2DChan.cc 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/ClusterSequence.hh" -
external/fastjet/ClusterSequence_Delaunay.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: ClusterSequence_Delaunay.cc 3475 2014-07-29 11:57:23Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 85 87 throw Error(err.str()); 86 88 //assert(false); 87 } 89 } else 88 90 #endif // DROP_CGAL 89 91 { 90 ostringstream err; 91 err << "ERROR: Unrecognized value for strategy: "<<_strategy<<endl; 92 //ostringstream err; 93 //err << "ERROR: Unrecognized value for strategy: "<<_strategy<<endl; 94 //throw Error(err.str()); 95 //----------------------------------------------------------------- 96 // The code should never reach this point, because the checks above 97 // should always handle all _strategy values for which 98 // _delaunay_cluster() is called 92 99 assert(false); 93 throw Error(err.str());94 100 } 95 101 … … 217 223 /// 218 224 void ClusterSequence::_add_ktdistance_to_map( 219 const int &ii,225 const int ii, 220 226 DistMap & DijMap, 221 227 const DynamicNearestNeighbours * DNN) { -
external/fastjet/ClusterSequence_DumbN3.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: ClusterSequence_DumbN3.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/ClusterSequence_N2.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: ClusterSequence_N2.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/ClusterSequence_TiledN2.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: ClusterSequence_TiledN2.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER28 29 30 // The plainN^2 part of the ClusterSequence class -- separated out29 //FJENDHEADER 30 31 32 // The tiled N^2 part of the ClusterSequence class -- separated out 31 33 // from the rest of the class implementation so as to speed up 32 34 // compilation of this particular part while it is under test. … … 39 41 #include "fastjet/ClusterSequence.hh" 40 42 #include "fastjet/internal/MinHeap.hh" 43 #include "fastjet/internal/TilingExtent.hh" 41 44 42 45 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh … … 94 97 _tile_size_phi = twopi / _n_tiles_phi; // >= _Rparam and fits in 2pi 95 98 96 // always include zero rapidity in the tiling region 97 _tiles_eta_min = 0.0; 98 _tiles_eta_max = 0.0; 99 // but go no further than following 100 const double maxrap = 7.0; 101 102 // and find out how much further one should go 103 for(unsigned int i = 0; i < _jets.size(); i++) { 104 double eta = _jets[i].rap(); 105 // first check if eta is in range -- to avoid taking into account 106 // very spurious rapidities due to particles with near-zero kt. 107 if (abs(eta) < maxrap) { 108 if (eta < _tiles_eta_min) {_tiles_eta_min = eta;} 109 if (eta > _tiles_eta_max) {_tiles_eta_max = eta;} 110 } 111 } 99 TilingExtent tiling_analysis(*this); 100 _tiles_eta_min = tiling_analysis.minrap(); 101 _tiles_eta_max = tiling_analysis.maxrap(); 102 103 // // always include zero rapidity in the tiling region 104 // _tiles_eta_min = 0.0; 105 // _tiles_eta_max = 0.0; 106 // // but go no further than following 107 // const double maxrap = 7.0; 108 // 109 // // and find out how much further one should go 110 // for(unsigned int i = 0; i < _jets.size(); i++) { 111 // double eta = _jets[i].rap(); 112 // // first check if eta is in range -- to avoid taking into account 113 // // very spurious rapidities due to particles with near-zero kt. 114 // if (abs(eta) < maxrap) { 115 // if (eta < _tiles_eta_min) {_tiles_eta_min = eta;} 116 // if (eta > _tiles_eta_max) {_tiles_eta_max = eta;} 117 // } 118 // } 112 119 113 120 // now adjust the values … … 167 174 //---------------------------------------------------------------------- 168 175 /// return the tile index corresponding to the given eta,phi point 169 int ClusterSequence::_tile_index(const double & eta, const double &phi) const {176 int ClusterSequence::_tile_index(const double eta, const double phi) const { 170 177 int ieta, iphi; 171 178 if (eta <= _tiles_eta_min) {ieta = 0;} … … 249 256 /// their "tagged" status is false; when a neighbour is added its 250 257 /// tagged status is set to true. 258 /// 259 /// Note that with a high level of warnings (-pedantic -Wextra -ansi, 260 /// gcc complains about tile_index maybe being used uninitialised for 261 /// oldB in ClusterSequence::_minheap_faster_tiled_N2_cluster(). We 262 /// have explicitly checked that it was harmless so we could disable 263 /// the gcc warning by hand using the construct below 264 /// 265 /// #pragma GCC diagnostic push 266 /// #pragma GCC diagnostic ignored "-Wpragmas" 267 /// #pragma GCC diagnostic ignored "-Wuninitialized" 268 /// #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" 269 /// ... 270 /// #pragma GCC diagnostic pop 271 /// 272 /// the @GCC diagnostic push/pop directive was only introduced in 273 /// gcc-4.6, so for broader usage, we'd need to insert #pragma GCC 274 /// diagnostic ignored "-Wpragmas" at the top of this file 251 275 inline void ClusterSequence::_add_untagged_neighbours_to_tile_union( 252 276 const int tile_index, … … 274 298 TiledJet * jetA = briefjets, * jetB; 275 299 TiledJet oldB; 276 oldB.tile_index=0; // prevents a gcc warning 300 oldB.tile_index=0; // prevents a gcc warning 277 301 278 302 // will be used quite deep inside loops, but declare it here so that … … 517 541 TiledJet * jetA = briefjets, * jetB; 518 542 TiledJet oldB; 519 oldB.tile_index=0; // prevents a gcc warning 543 oldB.tile_index=0; // prevents a gcc warning 520 544 521 545 // will be used quite deep inside loops, but declare it here so that … … 555 579 // when we set NN for both jetA and jetB on the RH tiles. 556 580 } 557 558 581 559 582 // now create the diJ (where J is i's NN) table -- remember that … … 721 744 } 722 745 723 724 725 746 //---------------------------------------------------------------------- 726 747 /// run a tiled clustering, with our minheap for keeping track of the … … 735 756 TiledJet oldB; 736 757 oldB.tile_index=0; // prevents a gcc warning 737 738 758 739 759 // will be used quite deep inside loops, but declare it here so that -
external/fastjet/CompositeJetStructure.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: CompositeJetStructure.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/CompositeJetStructure.hh> … … 151 153 double a_err=0; 152 154 for (unsigned i = 0; i < _pieces.size(); i++) 153 a_err += _pieces[i].area ();155 a_err += _pieces[i].area_error(); 154 156 155 157 return a_err; -
external/fastjet/CompositeJetStructure.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: CompositeJetStructure.hh 3 071 2013-04-01 12:52:46Z cacciari$3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: CompositeJetStructure.hh 3453 2014-07-25 07:44:32Z soyez $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 110 112 virtual bool is_pure_ghost(const PseudoJet &reference) const; 111 113 112 // allow to modify the area information 113 // (for use in join()) 114 //------------------------------------------------------------------------------ 115 void set_area_information(PseudoJet *area_4vector_ptr){ 116 _area_4vector_ptr = area_4vector_ptr; 114 //unused: // allows one to modify the area information 115 //unused: // (for use in join()) 116 //unused: // 117 //unused: // This member cannot be used by users who need to create a jet with 118 //unused: // user-supplied area information, because it sets only the 4-vector 119 //unused: // part of the area, but not all the other area information 120 //unused: // (e.g. scalar area) -- that other information is always deduced 121 //unused: // dynamically from the individual constituents. 122 //unused: // ------------------------------------------------------------------------------ 123 //unused: void set_area_information(PseudoJet *area_4vector_ptr){ 124 //unused: _area_4vector_ptr = area_4vector_ptr; 125 //unused: } 126 127 /// disable the area of the composite jet 128 /// 129 /// this can be used e.g. to discard the area of a composite jet 130 /// made of pieces with non-explicit-ghost area since the area may 131 /// by erroneous in that case 132 void discard_area(){ 133 if (_area_4vector_ptr) delete _area_4vector_ptr; 134 _area_4vector_ptr = 0; 117 135 } 118 136 -
external/fastjet/Dnn2piCylinder.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: Dnn2piCylinder.cc 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/Dnn3piCylinder.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: Dnn3piCylinder.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/Dnn4piCylinder.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: Dnn4piCylinder.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/DnnPlane.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: DnnPlane.cc 3442 2014-07-24 07:20:49Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 33 35 #include<list> 34 36 #include "fastjet/internal/DnnPlane.hh" 37 35 38 using namespace std; 36 39 37 40 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 41 42 const double DnnPlane::DISTANCE_FOR_CGAL_CHECKS=1.0e-12; 38 43 39 44 … … 53 58 _TR.insert(Point(input_points[i].first, input_points[i].second)); 54 59 55 // we are not up to dealing with coincident vertices, so make 56 // sure the user knows! 57 _CrashIfVertexPresent(sv.vertex, i); 58 59 // we need to assicate an index to each vertex -- thus when we get 60 // a vertex (e.g. as a nearest neighbour) from CGAL, we will be 61 // able to figure out which particle it corresponded to. 62 sv.vertex->info() = i; 60 // check if we are dealing with coincident vertices 61 int coinciding_index = _CheckIfVertexPresent(sv.vertex, i); 62 if (coinciding_index == i){ 63 // we need to associate an index to each vertex -- thus when we get 64 // a vertex (e.g. as a nearest neighbour) from CGAL, we will be 65 // able to figure out which particle it corresponded to. 66 sv.vertex->info() = sv.coincidence = i; 67 } else { 68 //cout << " coincident with " << coinciding_index << endl; 69 // the new vertex points to the already existing one and we 70 // record the coincidence 71 // 72 // Note that we must not only set the coincidence of the 73 // currently-added particle, the one it coincides with also 74 // needs be updated (taking into account that it might already 75 // coincide with another one) 76 // 77 // An example may help. Say coinciding_index = i1 and we're adding i2==i. 78 // Then _sv[i2].coincidence = i1; _sv[i1].coincidence = i2. In both 79 // cases sv.vertex->info() == i1; 80 // 81 // Later on we add i3; we find out that its coinciding index is i1; 82 // so we set _sv[i3].coincidence = i2 and sv[i1].coincidence = i3. 83 // 84 // This gives us the structure 85 // _supervertex[i1].coincidence == in 86 // _supervertex[i2].coincidence == i1 87 // ... 88 // _supervertex[in].coincidence == in-1 89 // 90 sv.coincidence = _supervertex[coinciding_index].coincidence; // handles cases with previous coincidences 91 _supervertex[coinciding_index].coincidence = i; 92 } 93 63 94 _supervertex.push_back(sv); 64 95 } … … 76 107 /// Crashes if the given vertex handle already exists. Otherwise 77 108 /// it does the bookkeeping for future such tests 78 void DnnPlane::_CrashIfVertexPresent( 79 const Vertex_handle & vertex, const int & its_index) { 80 if (!_crash_on_coincidence) return; 81 109 int DnnPlane::_CheckIfVertexPresent( 110 const Vertex_handle & vertex, const int its_index) { 82 111 // vertices that do not have the same geometric position as any 83 112 // other vertex so far added have info().val() == NEW_VERTEX -- this … … 90 119 // DNN:DNN) to be equal to a vertex "index". 91 120 if (vertex->info().val() != NEW_VERTEX) { 92 ostringstream err; 93 err << "ERROR in DnnPlane::_CrashIfVertexPresent" 94 <<endl << "Point "<<its_index<<" coincides with point " 95 <<vertex->info().val() << endl; 96 throw DnnError(err.str()); 97 } 121 if (_crash_on_coincidence){ 122 ostringstream err; 123 err << "Error: DnnPlane::_CheckIfVertexPresent" 124 << "Point "<<its_index<<" coincides with point " 125 <<vertex->info().val() << endl; 126 throw DnnError(err.str()); 127 } 128 return vertex->info().val(); 129 } 130 131 return its_index; 98 132 } 99 133 … … 116 150 vector<int> & indices_of_updated_neighbours) { 117 151 152 if (_verbose) cout << "Starting DnnPlane::RemoveAndAddPoints" << endl; 118 153 119 154 // build set of UNION of Voronoi neighbours of a pair of nearest … … 124 159 set<int> indices_removed; 125 160 126 // for each of the indices to be removed add the voronoi neighbourhood to 127 // the NeighbourUnion set. 161 // for each of the indices to be removed add the voronoi 162 // neighbourhood to the NeighbourUnion set as well as the coinciding 163 // points that had the current point as coincidence before. 128 164 for (size_t ir = 0; ir < indices_to_remove.size(); ir++) { 129 165 int index = indices_to_remove[ir]; 130 166 indices_removed.insert(index); 131 if (_verbose) cout << " Starting RemoveAndAddPoints" << endl; 132 if (_verbose) cout << " point " << index << endl; 167 if (_verbose) cout << " scheduling point " << index << " for removal" << endl; 168 169 if (_supervertex[index].coincidence != index){ 170 // we have a coincidence 171 // 172 // The only one of the coincident points that has to be 173 // inserted in the neighbourhood list (and thus updated) is the 174 // one that has 'index' as coincidence. 175 int new_index = _supervertex[index].coincidence; 176 while (_supervertex[new_index].coincidence != index) 177 new_index = _supervertex[new_index].coincidence; 178 if (_verbose) cout << " inserted coinciding " << new_index << " to neighbours union" << endl; 179 NeighbourUnion.insert(new_index); 180 181 // if this is the point among the coiciding ones that holds the 182 // CGAL vertex, then also insert the CGAL neighbours, otherwise 183 // just skip that step. 184 if (index != _supervertex[index].vertex->info().val()) continue; 185 } 186 133 187 // have a circulators that will go round the Voronoi neighbours of 134 188 // _supervertex[index1].vertex 135 189 Vertex_circulator vc = _TR.incident_vertices(_supervertex[index].vertex); 136 190 Vertex_circulator done = vc; 137 do { 138 // if a neighbouring vertex not the infinite vertex, then add it 139 // to our union of neighbouring vertices. 140 if (_verbose) cout << "examining " << vc->info().val() << endl; 141 if (vc->info().val() != INFINITE_VERTEX) { 142 // NB: from it=1 onwards occasionally it might already have 143 // been inserted -- but double insertion still leaves only one 144 // copy in the set, so there's no problem 145 NeighbourUnion.insert(vc->info().val()); 146 if (_verbose) cout << "inserted " << vc->info().val() << endl; 147 } 148 } while (++vc != done); 191 if (vc != NULL){ // a safety check in case there is no Voronoi 192 // neighbour (which may happen e.g. if we just 193 // have a bunch of coincident points) 194 do { 195 // if a neighbouring vertex is not the infinite vertex, then add it 196 // to our union of neighbouring vertices. 197 if (_verbose) cout << "examining " << vc->info().val() << endl; 198 if (vc->info().val() != INFINITE_VERTEX) { 199 // NB: from it=1 onwards occasionally it might already have 200 // been inserted -- but double insertion still leaves only one 201 // copy in the set, so there's no problem 202 NeighbourUnion.insert(vc->info().val()); 203 if (_verbose) cout << " inserted " << vc->info().val() << " to neighbours union" << endl; 204 } 205 } while (++vc != done); 206 } 149 207 } 150 208 … … 160 218 for (size_t ir = 0; ir < indices_to_remove.size(); ir++) { 161 219 int index = indices_to_remove[ir]; 220 if (_verbose) cout << " removing " << index << endl; 162 221 163 222 // NeighbourUnion should not contain the points to be removed 164 223 // (because later we will assume they still exist). 165 224 NeighbourUnion.erase(indices_to_remove[ir]); 166 225 226 // first deal with coincidences 227 if (_supervertex[index].coincidence != index){ 228 int new_index = _supervertex[index].coincidence; 229 230 // if this is the point among the coiciding ones that "owns" the 231 // CGAL vertex we need to re-label the CGAL vertex so that it 232 // points to the coincident particle and set the current one to 233 // NULL 234 // 235 // This can be done only on the first point as they all share 236 // the same value 237 // 238 // Note that this has to be done before the following step since 239 // it will alter the coincidence information 240 if (index == _supervertex[index].vertex->info().val()) 241 _supervertex[new_index].vertex->info() = new_index; 242 243 // we need to browse the coincidences until we end the loop, at 244 // which point we reset the coincidence of the point that has 245 // the current one as a coincidence 246 while (_supervertex[new_index].coincidence != index) 247 new_index = _supervertex[new_index].coincidence; 248 _supervertex[new_index].coincidence = _supervertex[index].coincidence; 249 250 // remove the coincidence on the point being removed and mark it 251 // as removed 252 _supervertex[index].coincidence = index; 253 _supervertex[index].vertex = NULL; 254 255 continue; 256 } 257 167 258 // points to be removed should also be eliminated from the 168 259 // triangulation and the supervertex structure should be updated … … 192 283 // of the neighbour union happens to be on the wrong side. 193 284 Face_handle face; 194 if (indices_to_remove.size() > 0) { 285 //if (indices_to_remove.size() > 0) { // GS: use NeighbourUnion instead 286 // (safe also in case of coincidences) 287 if (NeighbourUnion.size() > 0) { 195 288 // face can only be found if there were points to remove in first place 196 289 face = _TR.incident_faces( … … 204 297 int index = _supervertex.size()-1; 205 298 indices_added.push_back(index); 206 207 if (indices_to_remove.size() > 0) { 299 if (_verbose) cout << " adding " << index << endl; 300 301 //if (indices_to_remove.size() > 0) { 302 if (NeighbourUnion.size() > 0) { 208 303 // be careful of using face (for location hinting) only when it exists 209 304 _supervertex[index].vertex = _TR.insert(Point(points_to_add[ia].first, … … 213 308 points_to_add[ia].second)); 214 309 } 215 // we are not up to dealing with coincident vertices, so make 216 // sure the user knows! 217 _CrashIfVertexPresent(_supervertex[index].vertex, index); 218 _supervertex[index].vertex->info() = index; 310 311 // check if this leads to a coincidence 312 int coinciding_index = _CheckIfVertexPresent(_supervertex[index].vertex, index); 313 if (coinciding_index == index){ 314 // we need to associate an index to each vertex -- thus when we get 315 // a vertex (e.g. as a nearest neighbour) from CGAL, we will be 316 // able to figure out which particle it corresponded to. 317 _supervertex[index].vertex->info() = _supervertex[index].coincidence = index; 318 } else { 319 if (_verbose) cout << " coinciding with vertex " << coinciding_index << endl; 320 // the new vertex points to an already existing one and we 321 // record the coincidence 322 // 323 // we also update the NN of the coinciding particle (to avoid 324 // having to loop over the list of coinciding neighbours later) 325 // This is done first as it allows us to check if this is a new 326 // coincidence or a coincidence added to a particle that was 327 // previously "alone" 328 _supervertex[coinciding_index].NNindex = index; 329 _supervertex[coinciding_index].NNdistance = 0.0; 330 indices_of_updated_neighbours.push_back(coinciding_index); 331 332 // Note that we must not only set the coincidence of the 333 // currently-added particle, the one it coincides with also 334 // needs be updated (taking into account that it might already 335 // coincide with another one) 336 _supervertex[index].coincidence = _supervertex[coinciding_index].coincidence; // handles cases with previous coincidences 337 _supervertex[coinciding_index].coincidence = index; 338 339 } 219 340 220 341 // first find nearest neighbour of "newpoint" (shorthand for … … 227 348 indices_of_updated_neighbours.push_back(index); 228 349 _SetAndUpdateNearest(index, indices_of_updated_neighbours); 350 351 //cout << "Added: " << setprecision(20) << " (" 352 // << points_to_add[ia].first << "," << points_to_add[ia].second 353 // << ") with index " << index << endl; 229 354 } 230 355 … … 251 376 } 252 377 378 if (_verbose) cout << "Leaving DnnPlane::RemoveAndAddPoints" << endl; 253 379 } 254 255 380 256 381 //---------------------------------------------------------------------- 257 382 /// Determines the index and distance of the nearest neighbour to 258 383 /// point j and puts the information into the _supervertex entry for j. 259 void DnnPlane::_SetNearest (const int & j) { 384 void DnnPlane::_SetNearest (const int j) { 385 // first deal with the cases where we have a coincidence 386 if (_supervertex[j].coincidence != j){ 387 _supervertex[j].NNindex = _supervertex[j].coincidence; 388 _supervertex[j].NNdistance = 0.0; 389 return; 390 } 391 392 // The code below entirely uses CGAL distance comparisons to compute 393 // the nearest neighbour. It has the mais drawback to induice a 394 // 10-20% time penalty so we switched to our own comparison (which 395 // only turns to CGAL for dangerous situations) 396 // 397 // Vertex_handle current = _supervertex[j].vertex; 398 // Vertex_circulator vc = _TR.incident_vertices(current); 399 // Vertex_circulator done = vc; 400 // Vertex_handle nearest = _TR.infinite_vertex(); 401 // double mindist = HUGE_DOUBLE; 402 // 403 // // when there is only one finite point left in the triangulation, 404 // // there are no triangles. Presumably this is why voronoi returns 405 // // NULL for the incident vertex circulator. Check if this is 406 // // happening before circulating over it... (Otherwise it crashes 407 // // when looking for neighbours of last point) 408 // if (vc != NULL){ 409 // // initialise the nearest vertex handle to the first incident 410 // // vertex that is not INFINITE_VERTEX 411 // while (vc->info().val() == INFINITE_VERTEX){ 412 // vc++; 413 // if (vc==done) break; // if vc==done, then INFINITE_VERTEX is the 414 // // only element in the neighbourhood 415 // } 416 // 417 // // if there is just the infinite vertex, we have vc->info().val() 418 // // == INFINITE_VERTEX and nothing has to be done 419 // // otherwise, use the current vc as an initialisation 420 // if (vc->info().val() != INFINITE_VERTEX){ 421 // nearest = vc; // initialisation to the first non-infinite vertex 422 // 423 // // and loop over the following ones 424 // while (++vc != done){ 425 // // we should not compare with the infinite vertex 426 // if (vc->info().val() == INFINITE_VERTEX) continue; 427 // 428 // if (_verbose) cout << current->info().val() << " " << vc->info().val() << endl; 429 // // use CGAL's distance comparison to check if 'vc' is closer to 430 // // 'current' than the nearest so far (we include the == case for 431 // // safety though it should not matter in this precise case) 432 // if (CGAL::compare_distance_to_point(current->point(), vc->point(), nearest->point())!=CGAL::LARGER){ 433 // nearest = vc; 434 // if (_verbose) cout << "nearer"; 435 // } 436 // } 437 // 438 // // now compute the distance 439 // // 440 // // Note that since we're always using CGAL to compare distances 441 // // (and never the distance computed using _euclid_distance) we 442 // // should not worry about rounding errors in mindist 443 // mindist = _euclid_distance(current->point(), nearest->point()); 444 // } 445 // } 446 // 447 // // set j's supervertex info about nearest neighbour 448 // _supervertex[j].NNindex = nearest->info().val(); 449 // _supervertex[j].NNdistance = mindist; 450 260 451 Vertex_handle current = _supervertex[j].vertex; 261 452 Vertex_circulator vc = _TR.incident_vertices(current); … … 264 455 double mindist = HUGE_DOUBLE; // change this to "HUGE" or max_double? 265 456 Vertex_handle nearest = _TR.infinite_vertex(); 266 457 267 458 // when there is only one finite point left in the triangulation, 268 459 // there are no triangles. Presumably this is why voronoi returns … … 274 465 // find distance between j and its Voronoi neighbour (vc) 275 466 if (_verbose) cout << current->info().val() << " " << vc->info().val() << endl; 276 dist = _euclid_distance(current->point(), vc->point()); 467 277 468 // check if j is closer to vc than vc's currently registered 278 469 // nearest neighbour (and update things if it is) 279 if ( dist < mindist){280 mindist = dist;nearest = vc;281 if (_verbose) cout << "nearer ";470 if (_is_closer_to(current->point(), vc->point(), nearest, dist, mindist)){ 471 nearest = vc; 472 if (_verbose) cout << "nearer "; 282 473 } 283 474 if (_verbose) cout << vc->point() << "; "<< dist << endl; 284 475 } 285 476 } while (++vc != done); // move on to next Voronoi neighbour 477 286 478 // set j's supervertex info about nearest neighbour 287 479 _supervertex[j].NNindex = nearest->info().val(); … … 291 483 //---------------------------------------------------------------------- 292 484 /// Determines and stores the nearest neighbour of j, and where 293 /// necessary update the nearest-neighbour info of Voronoi neighbours485 /// necessary updates the nearest-neighbour info of Voronoi neighbours 294 486 /// of j; 295 487 /// … … 304 496 /// NB: note that we have _SetAndUpdateNearest as a completely 305 497 /// separate routine from _SetNearest because we want to 306 /// use one single cir uclation over voronoi neighbours to find the498 /// use one single circulation over voronoi neighbours to find the 307 499 /// nearest neighbour and to update the voronoi neighbours if need 308 500 /// be. 309 501 void DnnPlane::_SetAndUpdateNearest( 310 const int &j,502 const int j, 311 503 vector<int> & indices_of_updated_neighbours) { 504 //cout << "SetAndUpdateNearest for point " << j << endl; 505 // first deal with coincidences 506 if (_supervertex[j].coincidence != j){ 507 _supervertex[j].NNindex = _supervertex[j].coincidence; 508 _supervertex[j].NNdistance = 0.0; 509 //cout << " set to coinciding point " << _supervertex[j].coincidence << endl; 510 return; 511 } 312 512 313 513 Vertex_handle current = _supervertex[j].vertex; … … 326 526 if (vc->info().val() != INFINITE_VERTEX) { 327 527 if (_verbose) cout << current->info().val() << " " << vc->info().val() << endl; 328 // find distance between j and its Voronoi neighbour (vc) 329 dist = _euclid_distance(current->point(), vc->point()); 528 330 529 // update the mindist if we are closer than anything found so far 331 if ( dist < mindist){332 mindist = dist;nearest = vc;333 if (_verbose) cout << "nearer ";530 if (_is_closer_to(current->point(), vc->point(), nearest, dist, mindist)){ 531 nearest = vc; 532 if (_verbose) cout << "nearer "; 334 533 } 534 335 535 // find index corresponding to vc for easy manipulation 336 536 int vcindx = vc->info().val(); 337 537 if (_verbose) cout << vc->point() << "; "<< dist << endl; 338 // check if j is closer to vc than vc's currently registered 339 // nearest neighbour (and update things if it is) 340 if (dist < _supervertex[vcindx].NNdistance) { 538 539 if (_is_closer_to_with_hint(vc->point(), current->point(), 540 _supervertex[_supervertex[vcindx].NNindex].vertex, 541 dist, _supervertex[vcindx].NNdistance)){ 341 542 if (_verbose) cout << vcindx << "'s NN becomes " << current->info().val() << endl; 342 _supervertex[vcindx].NNdistance = dist;343 543 _supervertex[vcindx].NNindex = j; 344 544 indices_of_updated_neighbours.push_back(vcindx); 345 545 } 546 547 // original code without the use of CGAL distance in potentially 548 // dangerous cases 549 // 550 // // check if j is closer to vc than vc's currently registered 551 // // nearest neighbour (and update things if it is) 552 // // 553 // // GS: originally, the distance test below was a strict <. It 554 // // has to be <= because if the two distances are ==, it is 555 // // possible that the old NN is no longer connected to vc in 556 // // the triangulation, and we are sure that the newly 557 // // inserted point (j) is (since we loop over j's 558 // // neighbouring points in the triangulation). 559 // if (dist <= _supervertex[vcindx].NNdistance) { 560 // if (_verbose) cout << vcindx << "'s NN becomes " << current->info().val() << endl; 561 // _supervertex[vcindx].NNdistance = dist; 562 // _supervertex[vcindx].NNindex = j; 563 // indices_of_updated_neighbours.push_back(vcindx); 564 // } 346 565 } 347 566 } while (++vc != done); // move on to next Voronoi neighbour 348 567 // set j's supervertex info about nearest neighbour 568 //cout << " set to point " << nearest->info().val() << endl; 349 569 _supervertex[j].NNindex = nearest->info().val(); 350 570 _supervertex[j].NNdistance = mindist; -
external/fastjet/Error.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: Error.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/Error.hh" -
external/fastjet/Error.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_ERROR_HH__ 3 3 4 // STARTHEADER5 // $Id: Error.hh 2577 2011-09-13 15:11:38Z salam $4 //FJSTARTHEADER 5 // $Id: Error.hh 3433 2014-07-23 08:17:03Z salam $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include<iostream> -
external/fastjet/FunctionOfPseudoJet.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: FunctionOfPseudoJet.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/FunctionOfPseudoJet.hh> -
external/fastjet/FunctionOfPseudoJet.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_FUNCTION_OF_PSEUDOJET_HH__ 3 3 4 // STARTHEADER5 // $Id: FunctionOfPseudoJet.hh 2577 2011-09-13 15:11:38Z salam $4 //FJSTARTHEADER 5 // $Id: FunctionOfPseudoJet.hh 3433 2014-07-23 08:17:03Z salam $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/PseudoJet.hh> … … 49 51 FunctionOfPseudoJet(){} 50 52 51 /// ctor that creates a constant function 52 FunctionOfPseudoJet(const TOut &constant_value); 53 // ctor that creates a constant function 54 //---------- 55 // this declaration was present in versions of FJ from 3.0.0 to 3.0.6, 56 // but never implemented. It is being removed from 3.0.7 upwards 57 // to avoid misleading users 58 //FunctionOfPseudoJet(const TOut &constant_value); 53 59 54 60 /// default dtor (virtual to allow safe polymorphism) -
external/fastjet/GhostedAreaSpec.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: GhostedAreaSpec.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/GhostedAreaSpec.hh" -
external/fastjet/GhostedAreaSpec.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: GhostedAreaSpec.hh 2728 2011-11-20 14:18:59Z salam $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: GhostedAreaSpec.hh 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 122 124 123 125 // for accessing values set by the user 126 inline double ghost_rapmax () const {return _ghost_maxrap;} 127 inline double ghost_maxrap () const {return _ghost_maxrap;} 124 128 inline double ghost_etamax () const {return _ghost_maxrap;} 125 inline double ghost_max rap() const {return _ghost_maxrap;}129 inline double ghost_maxeta () const {return _ghost_maxrap;} 126 130 inline double ghost_area () const {return _ghost_area ;} 127 131 inline double grid_scatter () const {return _grid_scatter;} … … 140 144 // when explicitly modifying values, sometimes call the initializer 141 145 inline void set_ghost_area (double val) {_ghost_area = val; _initialize();} 146 inline void set_ghost_rapmax (double val) {_ghost_maxrap = val; _initialize();} 147 inline void set_ghost_maxrap (double val) {_ghost_maxrap = val; _initialize();} 142 148 inline void set_ghost_etamax (double val) {_ghost_maxrap = val; _initialize();} 143 inline void set_ghost_max rap(double val) {_ghost_maxrap = val; _initialize();}149 inline void set_ghost_maxeta (double val) {_ghost_maxrap = val; _initialize();} 144 150 inline void set_grid_scatter (double val) {_grid_scatter = val; } 145 151 inline void set_pt_scatter (double val) {_pt_scatter = val; } -
external/fastjet/JetDefinition.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: JetDefinition.cc 3492 2014-07-30 16:58:20Z soyez $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/JetDefinition.hh" … … 68 70 // cross-check the number of parameters that were declared in setting up the 69 71 // algorithm (passed internally from the public constructors) 70 switch (jet_algorithm_in) { 71 case ee_kt_algorithm: 72 if (nparameters != 0) { 73 ostringstream oss; 74 oss << "ee_kt_algorithm should be constructed with 0 parameters but was called with " 75 << nparameters << " parameter(s)\n"; 76 throw Error(oss.str()); 77 } 78 break; 79 case genkt_algorithm: 80 case ee_genkt_algorithm: 81 if (nparameters != 2) { 82 ostringstream oss; 83 oss << "(ee_)genkt_algorithm should be constructed with 2 parameters but was called with " 84 << nparameters << " parameter(s)\n"; 85 throw Error(oss.str()); 86 } 87 break; 88 default: 89 if (nparameters != 1) { 90 ostringstream oss; 91 oss << "The jet algorithm you requested (" 92 << jet_algorithm_in << ") should be constructed with 1 parameter but was called with " 93 << nparameters << " parameter(s)\n"; 94 throw Error(oss.str()); 95 } 72 unsigned int nparameters_expected = n_parameters_for_algorithm(jet_algorithm_in); 73 if (nparameters != (int) nparameters_expected){ 74 ostringstream oss; 75 oss << "The jet algorithm you requested (" 76 << jet_algorithm_in << ") should be constructed with " << nparameters_expected 77 << " parameter(s) but was called with " << nparameters << " parameter(s)\n"; 78 throw Error(oss.str()); 96 79 } 97 80 … … 106 89 107 90 //---------------------------------------------------------------------- 91 // returns true if the jet definition involves an algorithm 92 // intended for use on a spherical geometry (e.g. e+e- algorithms, 93 // as opposed to most pp algorithms, which use a cylindrical, 94 // rapidity-phi geometry). 95 bool JetDefinition::is_spherical() const { 96 if (jet_algorithm() == plugin_algorithm) { 97 return plugin()->is_spherical(); 98 } else { 99 return (jet_algorithm() == ee_kt_algorithm || // as of 2013-02-14, the two 100 jet_algorithm() == ee_genkt_algorithm // native spherical algorithms 101 ); 102 } 103 } 104 105 //---------------------------------------------------------------------- 108 106 string JetDefinition::description() const { 107 ostringstream name; 108 109 name << description_no_recombiner(); 110 111 if ((jet_algorithm() == plugin_algorithm) || (jet_algorithm() == undefined_jet_algorithm)){ 112 return name.str(); 113 } 114 115 if (n_parameters_for_algorithm(jet_algorithm()) == 0) 116 name << " with "; 117 else 118 name << " and "; 119 name << recombiner()->description(); 120 121 return name.str(); 122 } 123 124 //---------------------------------------------------------------------- 125 string JetDefinition::description_no_recombiner() const { 126 109 127 ostringstream name; 110 128 if (jet_algorithm() == plugin_algorithm) { 111 129 return plugin()->description(); 112 } else if (jet_algorithm() == kt_algorithm) {113 name << "Longitudinally invariant kt algorithm with R = " << R();114 name << " and " << recombiner()->description();115 } else if (jet_algorithm() == cambridge_algorithm) {116 name << "Longitudinally invariant Cambridge/Aachen algorithm with R = "117 << R() ;118 name << " and " << recombiner()->description();119 } else if (jet_algorithm() == antikt_algorithm) {120 name << "Longitudinally invariant anti-kt algorithm with R = "121 << R() ;122 name << " and " << recombiner()->description();123 } else if (jet_algorithm() == genkt_algorithm) {124 name << "Longitudinally invariant generalised kt algorithm with R = "125 << R() << ", p = " << extra_param();126 name << " and " << recombiner()->description();127 } else if (jet_algorithm() == cambridge_for_passive_algorithm) {128 name << "Longitudinally invariant Cambridge/Aachen algorithm with R = "129 << R() << "and a special hack whereby particles with kt < "130 << extra_param() << "are treated as passive ghosts";131 } else if (jet_algorithm() == ee_kt_algorithm) {132 name << "e+e- kt (Durham) algorithm (NB: no R)";133 name << " with " << recombiner()->description();134 } else if (jet_algorithm() == ee_genkt_algorithm) {135 name << "e+e- generalised kt algorithm with R = "136 << R() << ", p = " << extra_param();137 name << " and " << recombiner()->description();138 130 } else if (jet_algorithm() == undefined_jet_algorithm) { 139 name << "uninitialised JetDefinition (jet_algorithm=undefined_jet_algorithm)" ; 140 } else { 141 throw Error("JetDefinition::description(): unrecognized jet_algorithm"); 142 } 131 return "uninitialised JetDefinition (jet_algorithm=undefined_jet_algorithm)" ; 132 } 133 134 name << algorithm_description(jet_algorithm()); 135 switch (n_parameters_for_algorithm(jet_algorithm())){ 136 case 0: name << " (NB: no R)"; break; 137 case 1: name << " with R = " << R(); break; // the parameter is always R 138 case 2: 139 // the 1st parameter is always R 140 name << " with R = " << R(); 141 // the 2nd depends on the algorithm 142 if (jet_algorithm() == cambridge_for_passive_algorithm){ 143 name << "and a special hack whereby particles with kt < " 144 << extra_param() << "are treated as passive ghosts"; 145 } else { 146 name << ", p = " << extra_param(); 147 } 148 }; 149 143 150 return name.str(); 144 151 } 145 152 146 153 //---------------------------------------------------------------------- 154 string JetDefinition::algorithm_description(const JetAlgorithm jet_alg){ 155 ostringstream name; 156 switch (jet_alg){ 157 case plugin_algorithm: return "plugin algorithm"; 158 case kt_algorithm: return "Longitudinally invariant kt algorithm"; 159 case cambridge_algorithm: return "Longitudinally invariant Cambridge/Aachen algorithm"; 160 case antikt_algorithm: return "Longitudinally invariant anti-kt algorithm"; 161 case genkt_algorithm: return "Longitudinally invariant generalised kt algorithm"; 162 case cambridge_for_passive_algorithm: return "Longitudinally invariant Cambridge/Aachen algorithm"; 163 case ee_kt_algorithm: return "e+e- kt (Durham) algorithm (NB: no R)"; 164 case ee_genkt_algorithm: return "e+e- generalised kt algorithm"; 165 case undefined_jet_algorithm: return "undefined jet algorithm"; 166 default: 167 throw Error("JetDefinition::algorithm_description(): unrecognized jet_algorithm"); 168 }; 169 } 170 171 //---------------------------------------------------------------------- 172 unsigned int JetDefinition::n_parameters_for_algorithm(const JetAlgorithm jet_alg){ 173 switch (jet_alg) { 174 case ee_kt_algorithm: return 0; 175 case genkt_algorithm: 176 case ee_genkt_algorithm: return 2; 177 default: return 1; 178 }; 179 } 180 181 //---------------------------------------------------------------------- 147 182 void JetDefinition::set_recombination_scheme( 148 183 RecombinationScheme recomb_scheme) { … … 150 185 151 186 // do not forget to delete the existing recombiner if needed 152 if (_ recombiner_shared()) _recombiner_shared.reset();187 if (_shared_recombiner()) _shared_recombiner.reset(); 153 188 154 189 _recombiner = 0; 190 } 191 192 void JetDefinition::set_recombiner(const JetDefinition &other_jet_def){ 193 // make sure the "invariants" of the other jet def are sensible 194 assert(other_jet_def._recombiner || 195 other_jet_def.recombination_scheme() != external_scheme); 196 197 // first treat the situation where we're using the default recombiner 198 if (other_jet_def._recombiner == 0){ 199 set_recombination_scheme(other_jet_def.recombination_scheme()); 200 return; 201 } 202 203 // in other cases, copy the pointer to the recombiner 204 _recombiner = other_jet_def._recombiner; 205 // set the default recombiner appropriately 206 _default_recombiner = DefaultRecombiner(external_scheme); 207 // and set the _shared_recombiner to the same state 208 // as in the other_jet_def, whatever that was 209 _shared_recombiner.reset(other_jet_def._shared_recombiner); 210 211 // NB: it is tempting to go via set_recombiner and then to sort 212 // out the shared part, but this would be dangerous in the 213 // specific (rare?) case where other_jet_def is the same as this 214 // it deletes_recombiner_when_unused. In that case the shared 215 // pointer reset would delete the recombiner. 155 216 } 156 217 … … 163 224 if (other_jd.recombination_scheme() != scheme) return false; 164 225 165 // if the scheme is "external", also check that they ahve the same226 // if the scheme is "external", also check that they have the same 166 227 // recombiner 167 228 return (scheme != external_scheme) … … 169 230 } 170 231 171 /// allows to let the JetDefinitionhandle the deletion of the232 /// causes the JetDefinition to handle the deletion of the 172 233 /// recombiner when it is no longer used 173 234 void JetDefinition::delete_recombiner_when_unused(){ 174 235 if (_recombiner == 0){ 175 236 throw Error("tried to call JetDefinition::delete_recombiner_when_unused() for a JetDefinition without a user-defined recombination scheme"); 176 } 177 178 _recombiner_shared.reset(_recombiner); 237 } else if (_shared_recombiner.get()) { 238 throw Error("Error in JetDefinition::delete_recombiner_when_unused: the recombiner is already scheduled for deletion when unused (or was already set as shared)"); 239 } 240 241 _shared_recombiner.reset(_recombiner); 179 242 } 180 243 -
external/fastjet/JetDefinition.hh
r5b5a56b r35cdc46 1 //STARTHEADER 2 // $Id: JetDefinition.hh 2687 2011-11-14 11:17:51Z soyez $ 3 // 4 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 1 #ifndef __FASTJET_JETDEFINITION_HH__ 2 #define __FASTJET_JETDEFINITION_HH__ 3 4 //FJSTARTHEADER 5 // $Id: JetDefinition.hh 3523 2014-08-02 13:15:21Z salam $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 8 // 6 9 //---------------------------------------------------------------------- … … 13 16 // 14 17 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 20 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 18 23 // 19 24 // FastJet is distributed in the hope that it will be useful, … … 25 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 31 //---------------------------------------------------------------------- 27 //ENDHEADER 28 29 #ifndef __FASTJET_JETDEFINITION_HH__ 30 #define __FASTJET_JETDEFINITION_HH__ 32 //FJENDHEADER 31 33 32 34 #include<cassert> … … 47 49 /// clustering events with kt and cambridge style algorithms. 48 50 enum Strategy { 49 /// fastest form about 500..10^4 51 /// Like N2MHTLazy9 in a number of respects, but does not calculate 52 /// ghost-ghost distances and so does not carry out ghost-ghost 53 /// recombination. 54 /// 55 /// If you want active ghosted areas, then this is only suitable for 56 /// use with the anti-kt algorithm (or genkt with negative p), and 57 /// does not produce any pure ghost jets. If used with active areas 58 /// with Kt or Cam algorithms it will actually produce a passive 59 /// area. 60 /// 61 /// Particles are deemed to be ghosts if their pt is below a 62 /// threshold (currently 1e-50, hard coded as ghost_limit in 63 /// LazyTiling9SeparateGhosts). 64 /// 65 /// Currently for events with a couple of thousand normal particles 66 /// and O(10k) ghosts, this can be quicker than N2MHTLazy9, which 67 /// would otherwise be the best strategy. 68 /// 69 /// New in FJ3.1 70 N2MHTLazy9AntiKtSeparateGhosts = -10, 71 /// only looks into a neighbouring tile for a particle's nearest 72 /// neighbour (NN) if that particle's in-tile NN is further than the 73 /// distance to the edge of the neighbouring tile. Uses tiles of 74 /// size R and a 3x3 tile grid around the particle. 75 /// New in FJ3.1 76 N2MHTLazy9 = -7, 77 /// Similar to N2MHTLazy9, but uses tiles of size R/2 and a 5x5 tile 78 /// grid around the particle. 79 /// New in FJ3.1 80 N2MHTLazy25 = -6, 81 /// Like to N2MHTLazy9 but uses slightly different optimizations, 82 /// e.g. for calculations of distance to nearest tile; as of 83 /// 2014-07-18 it is slightly slower and not recommended for 84 /// production use. To considered deprecated. 85 /// New in FJ3.1 86 N2MHTLazy9Alt = -5, 87 /// faster that N2Tiled above about 500 particles; differs from it 88 /// by retainig the di(closest j) distances in a MinHeap (sort of 89 /// priority queue) rather than a simple vector. 50 90 N2MinHeapTiled = -4, 51 91 /// fastest from about 50..500 … … 57 97 /// worse even than the usual N^3 algorithms 58 98 N3Dumb = 0, 59 /// automatic selection of the best (based on N) 99 /// automatic selection of the best (based on N), including 100 /// the LazyTiled strategies that are new to FJ3.1 60 101 Best = 1, 61 102 /// best of the NlnN variants -- best overall for N>10^4. … … 79 120 /// (Does not work for R>=2pi) 80 121 NlnNCam = 12, // 2piMultD 122 /// the automatic strategy choice that was being made in FJ 3.0 123 /// (restricted to strategies that were present in FJ 3.0) 124 BestFJ30 = 21, 81 125 /// the plugin has been used... 82 126 plugin_strategy = 999 … … 87 131 /// \enum JetAlgorithm 88 132 /// the various families of jet-clustering algorithm 133 // 134 // [Remember to update the "is_spherical()" routine if any further 135 // spherical algorithms are added to the list below] 89 136 enum JetAlgorithm { 90 137 /// the longitudinally invariant kt algorithm … … 102 149 /// where p = extra_param() 103 150 genkt_algorithm=3, 104 /// a version of cambridge with a special distance measure for particles 105 /// whose pt is < extra_param() 151 /// a version of cambridge with a special distance measure for 152 /// particles whose pt is < extra_param(); this is not usually 153 /// intended for end users, but is instead automatically selected 154 /// when requesting a passive Cambridge area. 106 155 cambridge_for_passive_algorithm=11, 107 156 /// a version of genkt with a special distance measure for particles 108 157 /// whose pt is < extra_param() [relevant for passive areas when p<=0] 158 /// ***** NB: THERE IS CURRENTLY NO IMPLEMENTATION FOR THIS ALG ******* 109 159 genkt_for_passive_algorithm=13, 110 160 //................................................................. … … 244 294 const Recombiner * recombiner_in, 245 295 Strategy strategy_in = Best) { 246 *this = JetDefinition(jet_algorithm_in, R_in, external_scheme, strategy_in);296 *this = JetDefinition(jet_algorithm_in, R_in, xtra_param_in, external_scheme, strategy_in); 247 297 _recombiner = recombiner_in; 248 set_extra_param(xtra_param_in);249 298 } 250 299 … … 284 333 RecombinationScheme recomb_scheme_in = E_scheme, 285 334 int nparameters_in = 1); 335 336 /// cluster the supplied particles and returns a vector of resulting 337 /// jets, sorted by pt (or energy in the case of spherical, 338 /// i.e. e+e-, algorithms). This routine currently only makes 339 /// sense for "inclusive" type algorithms. 340 template <class L> 341 std::vector<PseudoJet> operator()(const std::vector<L> & particles) const; 286 342 287 343 /// R values larger than max_allowable_R are not allowed. … … 297 353 298 354 /// set the recombiner class to the one provided 355 /// 356 /// Note that in order to associate to a jet definition a recombiner 357 /// from another jet definition, it is strongly recommended to use 358 /// the set_recombiner(const JetDefinition &) method below. The 359 /// latter correctly handles the situations where the jet definition 360 /// owns the recombiner (i.e. where delete_recombiner_when_unused 361 /// has been called). In such cases, using set_recombiner(const 362 /// Recombiner *) may lead to memory corruption. 299 363 void set_recombiner(const Recombiner * recomb) { 300 if (_ recombiner_shared()) _recombiner_shared.reset(recomb);364 if (_shared_recombiner()) _shared_recombiner.reset(recomb); 301 365 _recombiner = recomb; 302 366 _default_recombiner = DefaultRecombiner(external_scheme); 303 367 } 304 368 369 /// set the recombiner to be the same as the one of 'other_jet_def' 370 /// 371 /// Note that this is the recommended method to associate to a jet 372 /// definition the recombiner from another jet definition. Compared 373 /// to the set_recombiner(const Recombiner *) above, it correctly 374 /// handles the case where the jet definition owns the recombiner 375 /// (i.e. where delete_recombiner_when_unused has been called) 376 void set_recombiner(const JetDefinition &other_jet_def); 377 305 378 /// calling this tells the JetDefinition to handle the deletion of 306 /// the recombiner when it is no longer used 379 /// the recombiner when it is no longer used. (Should not be called 380 /// if the recombiner was initialised from a JetDef whose recombiner 381 /// was already scheduled to delete itself - memory handling will 382 /// already be automatic across both JetDef's in that case). 307 383 void delete_recombiner_when_unused(); 308 384 … … 310 386 const Plugin * plugin() const {return _plugin;}; 311 387 312 /// allows to let the JetDefinitionhandle the deletion of the388 /// calling this causes the JetDefinition to handle the deletion of the 313 389 /// plugin when it is no longer used 314 390 void delete_plugin_when_unused(); … … 333 409 void set_extra_param(double xtra_param) {_extra_param = xtra_param;} 334 410 335 /// return a pointer to the currently defined recombiner.411 /// returns a pointer to the currently defined recombiner. 336 412 /// 337 413 /// Warning: the pointer may be to an internal recombiner (for … … 347 423 348 424 /// returns true if the current jet definitions shares the same 349 /// recombiner as t ehone passed as an argument425 /// recombiner as the one passed as an argument 350 426 bool has_same_recombiner(const JetDefinition &other_jd) const; 427 428 /// returns true if the jet definition involves an algorithm 429 /// intended for use on a spherical geometry (e.g. e+e- algorithms, 430 /// as opposed to most pp algorithms, which use a cylindrical, 431 /// rapidity-phi geometry). 432 bool is_spherical() const; 351 433 352 434 /// return a textual description of the current jet definition 353 435 std::string description() const; 354 436 437 /// returns a description not including the recombiner information 438 std::string description_no_recombiner() const; 439 440 /// a short textual description of the algorithm jet_alg 441 static std::string algorithm_description(const JetAlgorithm jet_alg); 442 443 /// the number of parameters associated to a given jet algorithm 444 static unsigned int n_parameters_for_algorithm(const JetAlgorithm jet_alg); 355 445 356 446 public: … … 462 552 virtual bool exclusive_sequence_meaningful() const {return false;} 463 553 554 /// returns true if the plugin implements an algorithm intended 555 /// for use on a spherical geometry (e.g. e+e- algorithms, as 556 /// opposed to most pp algorithms, which use a cylindrical, 557 /// rapidity-phi geometry). 558 virtual bool is_spherical() const {return false;} 559 464 560 /// a destructor to be replaced if necessary in derived classes... 465 561 virtual ~Plugin() {}; … … 481 577 DefaultRecombiner _default_recombiner; 482 578 const Recombiner * _recombiner; 483 SharedPtr<const Recombiner> _ recombiner_shared;579 SharedPtr<const Recombiner> _shared_recombiner; 484 580 485 581 }; … … 516 612 517 613 518 519 520 521 614 FASTJET_END_NAMESPACE 522 615 616 // include ClusterSequence which includes the implementation of the 617 // templated JetDefinition::operator()(...) member 618 #include "fastjet/ClusterSequence.hh" 619 620 523 621 #endif // __FASTJET_JETDEFINITION_HH__ -
external/fastjet/LimitedWarning.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: LimitedWarning.cc 3619 2014-08-13 14:17:19Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/LimitedWarning.hh" … … 40 42 41 43 42 // / output a warning to ostr43 void LimitedWarning::warn(const std::string & warning) {44 warn(warning, _default_ostr);45 }44 // /// output a warning to ostr 45 // void LimitedWarning::warn(const std::string & warning) { 46 // warn(warning, _default_ostr); 47 // } 46 48 47 void LimitedWarning::warn(const std::string &warning, std::ostream * ostr) {49 void LimitedWarning::warn(const char * warning, std::ostream * ostr) { 48 50 if (_this_warning_summary == 0) { 49 51 // prepare the information for the summary … … 54 56 // prepare the warning within a string stream 55 57 ostringstream warnstr; 56 warnstr << "WARNING : ";58 warnstr << "WARNING from FastJet: "; 57 59 warnstr << warning; 58 60 _n_warn_so_far++; -
external/fastjet/LimitedWarning.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_LIMITEDWARNING_HH__ 3 3 4 // STARTHEADER5 // $Id: LimitedWarning.hh 2577 2011-09-13 15:11:38Z salam $4 //FJSTARTHEADER 5 // $Id: LimitedWarning.hh 3622 2014-08-13 14:45:45Z salam $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 … … 50 52 51 53 /// constructor that provides a user-set max number of warnings 52 LimitedWarning(int max_warn ) : _max_warn(max_warn), _n_warn_so_far(0), _this_warning_summary(0) {}54 LimitedWarning(int max_warn_in) : _max_warn(max_warn_in), _n_warn_so_far(0), _this_warning_summary(0) {} 53 55 54 56 /// outputs a warning to standard error (or the user's default 55 57 /// warning stream if set) 56 void warn(const std::string & warning); 58 void warn(const char * warning) {warn(warning, _default_ostr);} 59 60 /// outputs a warning to standard error (or the user's default 61 /// warning stream if set) 62 void warn(const std::string & warning) {warn(warning.c_str(), _default_ostr);} 57 63 58 64 /// outputs a warning to the specified stream 59 void warn(const std::string & warning, std::ostream * ostr); 65 void warn(const char * warning, std::ostream * ostr); 66 67 /// outputs a warning to the specified stream 68 void warn(const std::string & warning, std::ostream * ostr) {warn(warning.c_str(), ostr);} 60 69 61 70 /// sets the default output stream for all warnings (by default … … 70 79 _max_warn_default = max_warn; 71 80 } 81 82 /// the maximum number of warning messages that will be printed 83 /// by this instance of the class 84 int max_warn() const {return _max_warn;} 85 86 /// the number of times so far that a warning has been registered 87 /// with this instance of the class. 88 int n_warn_so_far() const {return _n_warn_so_far;} 72 89 73 90 /// returns a summary of all the warnings that came through the -
external/fastjet/MinHeap.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: MinHeap.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/internal/MinHeap.hh" … … 43 45 /// 44 46 /// . for _heap[i], the "parent" is to be found at (i-1)/2 45 void MinHeap:: _initialise(const std::vector<double> & values){47 void MinHeap::initialise(const std::vector<double> & values){ 46 48 47 49 // fill the high-range of the heap with the largest possible value -
external/fastjet/NNH.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_NNH_HH__ 3 3 4 // STARTHEADER5 // $Id: NNH.hh 3 203 2013-09-15 07:49:50Z salam $6 // 7 // Copyright (c) 200 9, Matteo Cacciari, GavinSalam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: NNH.hh 3433 2014-07-23 08:17:03Z salam $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include<fastjet/ClusterSequence.hh> … … 138 140 class NNBJ; // forward declaration 139 141 140 /// establish the nearest neighbour for jet, and cross check cons tistency142 /// establish the nearest neighbour for jet, and cross check consistency 141 143 /// of distances for the other jets that are encountered. Assumes 142 144 /// jet not contained within begin...end -
external/fastjet/PseudoJet.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: PseudoJet.cc 3565 2014-08-11 15:24:39Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 176 178 // return the product, coeff * jet 177 179 PseudoJet operator* (double coeff, const PseudoJet & jet) { 180 // see the comment in operator*= about ensuring valid rap phi 181 // before a multiplication to handle case of multiplication by 182 // zero, while maintaining rapidity and phi 183 jet._ensure_valid_rap_phi(); 178 184 //return PseudoJet(coeff*jet.four_mom()); 179 185 // the following code is hopefully more efficient … … 198 204 /// multiply the jet's momentum by the coefficient 199 205 void PseudoJet::operator*=(double coeff) { 206 // operator*= aims to maintain the rapidity and azimuth 207 // for the PseudoJet; if they have already been evaluated 208 // this is fine, but if they haven't and coeff is sufficiently 209 // small as to cause a zero or underflow result, then a subsequent 210 // invocation of rap or phi will lead to a non-sensical result. 211 // So, here, we preemptively ensure that rapidity and phi 212 // are correctly cached 213 _ensure_valid_rap_phi(); 200 214 _px *= coeff; 201 215 _py *= coeff; … … 261 275 262 276 //---------------------------------------------------------------------- 263 /// transform this jet (given in lab) into a jet in the rest264 /// frame of prest277 /// transform this jet (given in the rest frame of prest) into a jet 278 /// in the lab frame 265 279 // 266 280 // NB: code adapted from that in herwig f77 (checked how it worked … … 288 302 289 303 //---------------------------------------------------------------------- 290 /// transform this jet (given in the rest frame of prest) into a jet291 /// in the lab frame;304 /// transform this jet (given in lab) into a jet in the rest 305 /// frame of prest 292 306 // 293 307 // NB: code adapted from that in herwig f77 (checked how it worked … … 587 601 // an Error is thrown if this PseudoJet has no currently valid 588 602 // associated ClusterSequence 589 std::vector<PseudoJet> PseudoJet::exclusive_subjets (const double &dcut) const {603 std::vector<PseudoJet> PseudoJet::exclusive_subjets (const double dcut) const { 590 604 return validated_structure_ptr()->exclusive_subjets(*this, dcut); 591 605 } … … 598 612 // an Error is thrown if this PseudoJet has no currently valid 599 613 // associated ClusterSequence 600 int PseudoJet::n_exclusive_subjets(const double &dcut) const {614 int PseudoJet::n_exclusive_subjets(const double dcut) const { 601 615 return validated_structure_ptr()->n_exclusive_subjets(*this, dcut); 602 616 } -
external/fastjet/PseudoJet.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: PseudoJet.hh 3 111 2013-05-04 08:17:27Z salam $1 //FJSTARTHEADER 2 // $Id: PseudoJet.hh 3566 2014-08-11 15:36:34Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 571 573 /// structure type 572 574 /// 573 /// If there is no s ructure associated, an Error is thrown.575 /// If there is no structure associated, an Error is thrown. 574 576 /// If the type is not met, a std::bad_cast error is thrown. 575 577 template<typename StructureType> … … 664 666 /// an Error is thrown if this PseudoJet has no currently valid 665 667 /// associated ClusterSequence 666 std::vector<PseudoJet> exclusive_subjets (const double &dcut) const;668 std::vector<PseudoJet> exclusive_subjets (const double dcut) const; 667 669 668 670 /// return the size of exclusive_subjets(...); still n ln n with same … … 672 674 /// an Error is thrown if this PseudoJet has no currently valid 673 675 /// associated ClusterSequence 674 int n_exclusive_subjets(const double &dcut) const;676 int n_exclusive_subjets(const double dcut) const; 675 677 676 678 /// return the list of subjets obtained by unclustering the supplied … … 694 696 std::vector<PseudoJet> exclusive_subjets_up_to (int nsub) const; 695 697 696 /// returnthe dij that was present in the merging nsub+1 -> nsub698 /// Returns the dij that was present in the merging nsub+1 -> nsub 697 699 /// subjets inside this jet. 700 /// 701 /// Returns 0 if there were nsub or fewer constituents in the jet. 698 702 /// 699 703 /// an Error is thrown if this PseudoJet has no currently valid … … 701 705 double exclusive_subdmerge(int nsub) const; 702 706 703 /// returnthe maximum dij that occurred in the whole event at the707 /// Returns the maximum dij that occurred in the whole event at the 704 708 /// stage that the nsub+1 -> nsub merge of subjets occurred inside 705 709 /// this jet. 710 /// 711 /// Returns 0 if there were nsub or fewer constituents in the jet. 706 712 /// 707 713 /// an Error is thrown if this PseudoJet has no currently valid … … 802 808 /// set cached rapidity and phi values 803 809 void _set_rap_phi() const; 810 811 // needed for operator* to have access to _ensure_valid_rap_phi() 812 friend PseudoJet operator*(double, const PseudoJet &); 804 813 }; 805 814 … … 825 834 /// momentum components are equal to val (=0.0) 826 835 bool operator==(const PseudoJet & jet, const double val); 836 inline bool operator==(const double val, const PseudoJet & jet) {return jet == val;} 827 837 828 838 /// Can only be used with val=0 and tests whether at least one of the 829 839 /// four momentum components is different from val (=0.0) 830 inline bool operator!=(const PseudoJet & a, const double & val) {return !(a==val);} 840 inline bool operator!=(const PseudoJet & a, const double val) {return !(a==val);} 841 inline bool operator!=( const double val, const PseudoJet & a) {return !(a==val);} 831 842 832 843 inline double dot_product(const PseudoJet & a, const PseudoJet & b) { … … 881 892 _ref_values = reference_values; 882 893 }; 883 inline int operator() (const int & i1, const int &i2) const {894 inline int operator() (const int i1, const int i2) const { 884 895 return (*_ref_values)[i1] < (*_ref_values)[i2]; 885 896 }; -
external/fastjet/PseudoJetStructureBase.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: PseudoJetStructureBase.cc 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/PseudoJetStructureBase.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_PSEUDOJET_STRUCTURE_BASE_HH__ 3 3 4 // STARTHEADER5 // $Id: PseudoJetStructureBase.hh 3 071 2013-04-01 12:52:46Z cacciari$6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: PseudoJetStructureBase.hh 3433 2014-07-23 08:17:03Z salam $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 … … 156 158 /// 157 159 /// By default, throws an Error 160 /// 161 /// Note: in a future major release of FastJet (4 or higher), 162 /// "const double & dcut" may be replaced with "const double dcut", 163 /// requiring a modification of derived classes that overload 164 /// this function. 158 165 virtual std::vector<PseudoJet> exclusive_subjets(const PseudoJet &reference, const double & dcut) const; 159 166 … … 163 170 /// 164 171 /// By default, throws an Error 172 /// 173 /// Note: in a future major release of FastJet (4 or higher), 174 /// "const double & dcut" may be replaced with "const double dcut", 175 /// requiring a modification of derived classes that overload 176 /// this function. 165 177 virtual int n_exclusive_subjets(const PseudoJet &reference, const double & dcut) const; 166 178 -
external/fastjet/RangeDefinition.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: RangeDefinition.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/RangeDefinition.hh" -
external/fastjet/RangeDefinition.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: RangeDefinition.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: RangeDefinition.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_RANGEDEFINITION_HH__ -
external/fastjet/Selector.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: Selector.cc 3504 2014-08-01 06:07:54Z soyez $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 95 97 } 96 98 99 //---------------------------------------------------------------------- 100 // sum the momenta of the jets that pass the cuts 101 PseudoJet Selector::sum(const std::vector<PseudoJet> & jets) const { 102 PseudoJet this_sum(0,0,0,0); 103 const SelectorWorker * worker_local = validated_worker(); 104 105 // separate strategies according to whether the worker applies jet by jet 106 if (worker_local->applies_jet_by_jet()) { 107 for (unsigned i = 0; i < jets.size(); i++) { 108 if (worker_local->pass(jets[i])) this_sum += jets[i]; 109 } 110 } else { 111 std::vector<const PseudoJet *> jetptrs(jets.size()); 112 for (unsigned i = 0; i < jets.size(); i++) { 113 jetptrs[i] = & jets[i]; 114 } 115 worker_local->terminator(jetptrs); 116 for (unsigned i = 0; i < jetptrs.size(); i++) { 117 if (jetptrs[i]) this_sum += jets[i]; 118 } 119 } 120 121 return this_sum; 122 } 123 124 //---------------------------------------------------------------------- 125 // sum the (scalar) pt of the jets that pass the cuts 126 double Selector::scalar_pt_sum(const std::vector<PseudoJet> & jets) const { 127 double this_sum = 0.0; 128 const SelectorWorker * worker_local = validated_worker(); 129 130 // separate strategies according to whether the worker applies jet by jet 131 if (worker_local->applies_jet_by_jet()) { 132 for (unsigned i = 0; i < jets.size(); i++) { 133 if (worker_local->pass(jets[i])) this_sum += jets[i].pt(); 134 } 135 } else { 136 std::vector<const PseudoJet *> jetptrs(jets.size()); 137 for (unsigned i = 0; i < jets.size(); i++) { 138 jetptrs[i] = & jets[i]; 139 } 140 worker_local->terminator(jetptrs); 141 for (unsigned i = 0; i < jetptrs.size(); i++) { 142 if (jetptrs[i]) this_sum += jets[i].pt(); 143 } 144 } 145 146 return this_sum; 147 } 148 97 149 98 150 //---------------------------------------------------------------------- … … 1055 1107 class SW_Circle : public SW_WithReference { 1056 1108 public: 1057 SW_Circle(const double &radius) : _radius2(radius*radius) {}1109 SW_Circle(const double radius) : _radius2(radius*radius) {} 1058 1110 1059 1111 /// return a copy of the current object … … 1100 1152 1101 1153 // select on objets within a distance 'radius' of a variable location 1102 Selector SelectorCircle(const double &radius) {1154 Selector SelectorCircle(const double radius) { 1103 1155 return Selector(new SW_Circle(radius)); 1104 1156 } … … 1110 1162 class SW_Doughnut : public SW_WithReference { 1111 1163 public: 1112 SW_Doughnut(const double &radius_in, const double &radius_out)1164 SW_Doughnut(const double radius_in, const double radius_out) 1113 1165 : _radius_in2(radius_in*radius_in), _radius_out2(radius_out*radius_out) {} 1114 1166 … … 1159 1211 1160 1212 // select on objets with distance from the centre is between 'radius_in' and 'radius_out' 1161 Selector SelectorDoughnut(const double & radius_in, const double &radius_out) {1213 Selector SelectorDoughnut(const double radius_in, const double radius_out) { 1162 1214 return Selector(new SW_Doughnut(radius_in, radius_out)); 1163 1215 } … … 1168 1220 class SW_Strip : public SW_WithReference { 1169 1221 public: 1170 SW_Strip(const double &delta) : _delta(delta) {}1222 SW_Strip(const double delta) : _delta(delta) {} 1171 1223 1172 1224 /// return a copy of the current object … … 1213 1265 1214 1266 // select on objets within a distance 'radius' of a variable location 1215 Selector SelectorStrip(const double &half_width) {1267 Selector SelectorStrip(const double half_width) { 1216 1268 return Selector(new SW_Strip(half_width)); 1217 1269 } … … 1224 1276 class SW_Rectangle : public SW_WithReference { 1225 1277 public: 1226 SW_Rectangle(const double &delta_rap, const double &delta_phi)1278 SW_Rectangle(const double delta_rap, const double delta_phi) 1227 1279 : _delta_rap(delta_rap), _delta_phi(delta_phi) {} 1228 1280 … … 1270 1322 1271 1323 // select on objets within a distance 'radius' of a variable location 1272 Selector SelectorRectangle(const double & half_rap_width, const double &half_phi_width) {1324 Selector SelectorRectangle(const double half_rap_width, const double half_phi_width) { 1273 1325 return Selector(new SW_Rectangle(half_rap_width, half_phi_width)); 1274 1326 } -
external/fastjet/Selector.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_SELECTOR_HH__ 3 3 4 // STARTHEADER5 // $Id: Selector.hh 3 203 2013-09-15 07:49:50Z salam$6 // 7 // Copyright (c) 2009-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: Selector.hh 3504 2014-08-01 06:07:54Z soyez $ 6 // 7 // Copyright (c) 2009-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include "fastjet/PseudoJet.hh" … … 67 69 //---------------------------------------------------------- 68 70 69 /// returns true if a given object passes the selection criterion. 70 /// This has to be overloaded by derived workers 71 /// returns true if a given object passes the selection criterion, 72 /// and is the main function that needs to be overloaded by derived 73 /// workers. 74 /// 75 /// NB: this function is used only if applies_jet_by_jet() returns 76 /// true. If it does not, then derived classes are expected to 77 /// (re)implement the terminator function() 71 78 virtual bool pass(const PseudoJet & jet) const = 0; 72 79 73 80 /// For each jet that does not pass the cuts, this routine sets the 74 /// pointer to 0. 75 /// 76 /// It does not assume that the PseudoJet* passed as argume tnare not NULL81 /// pointer to 0. 82 /// 83 /// It does not assume that the PseudoJet* passed as argument are not NULL 77 84 virtual void terminator(std::vector<const PseudoJet *> & jets) const { 78 85 for (unsigned i = 0; i < jets.size(); i++) { … … 133 140 throw Error("this selector has no computable area"); 134 141 } 142 135 143 }; 136 144 … … 151 159 Selector(SelectorWorker * worker_in) {_worker.reset(worker_in);} 152 160 153 154 161 #ifndef __FJCORE__ 155 162 /// ctor from a RangeDefinition … … 186 193 /// passes and then evaluating the size of the vector 187 194 unsigned int count(const std::vector<PseudoJet> & jets) const; 195 196 /// Return the 4-vector sum of the objects that pass the selection. 197 /// 198 /// This will often be more efficient that getting the vector of objects that 199 /// passes and then evaluating the size of the vector 200 PseudoJet sum(const std::vector<PseudoJet> & jets) const; 201 202 /// Return the scalar pt sum of the objects that pass the selection. 203 /// 204 /// This will often be more efficient that getting the vector of objects that 205 /// passes and then evaluating the size of the vector 206 double scalar_pt_sum(const std::vector<PseudoJet> & jets) const; 188 207 189 208 /// sift the input jets into two vectors -- those that pass the selector … … 433 452 /// select objets within a distance 'radius' from the location of the 434 453 /// reference jet, set by Selector::set_reference(...) 435 Selector SelectorCircle(const double &radius);454 Selector SelectorCircle(const double radius); 436 455 437 456 /// select objets with distance from the reference jet is between 'radius_in' 438 457 /// and 'radius_out'; the reference jet is set by Selector::set_reference(...) 439 Selector SelectorDoughnut(const double & radius_in, const double &radius_out);458 Selector SelectorDoughnut(const double radius_in, const double radius_out); 440 459 441 460 /// select objets within a rapidity distance 'half_width' from the 442 461 /// location of the reference jet, set by Selector::set_reference(...) 443 Selector SelectorStrip(const double &half_width);462 Selector SelectorStrip(const double half_width); 444 463 445 464 /// select objets within rapidity distance 'half_rap_width' from the 446 465 /// reference jet and azimuthal-angle distance within 'half_phi_width'; the 447 466 /// reference jet is set by Selector::set_reference(...) 448 Selector SelectorRectangle(const double & half_rap_width, const double &half_phi_width);467 Selector SelectorRectangle(const double half_rap_width, const double half_phi_width); 449 468 450 469 -
external/fastjet/SharedPtr.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_SHARED_PTR_HH__ 3 3 4 // STARTHEADER5 // $Id: SharedPtr.hh 3 129 2013-06-05 08:48:36Z salam $6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: SharedPtr.hh 3433 2014-07-23 08:17:03Z salam $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include "fastjet/internal/base.hh" -
external/fastjet/VERSION
r5b5a56b r35cdc46 1 3. 0.61 3.1.0-beta.1 -
external/fastjet/Voronoi.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: Voronoi.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 1994 by AT&T Bell Laboratories (see below) 5 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 6 5 // 7 6 //---------------------------------------------------------------------- 8 // This file is included as part of FastJet but was mostly written by 9 // S. Fortune in C, put into C++ with memory management by S 10 // O'Sullivan, and with further interface and memory management 11 // modifications by Gregory Soyez. 7 // This file is part of FastJet. 12 8 // 13 // Permission to use, copy, modify, and distribute this software for 14 // any purpose without fee is hereby granted, provided that this 15 // entire notice is included in all copies of any software which is or 16 // includes a copy or modification of this software and in all copies 17 // of the supporting documentation for such software. THIS SOFTWARE IS 18 // BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTY. 19 // IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY REPRESENTATION 20 // OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS 21 // SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. 9 // FastJet is free software; you can redistribute it and/or modify 10 // it under the terms of the GNU General Public License as published by 11 // the Free Software Foundation; either version 2 of the License, or 12 // (at your option) any later version. 22 13 // 14 // The algorithms that underlie FastJet have required considerable 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 17 // FastJet as part of work towards a scientific publication, please 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 20 // 21 // FastJet is distributed in the hope that it will be useful, 22 // but WITHOUT ANY WARRANTY; without even the implied warranty of 23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 // GNU General Public License for more details. 25 // 26 // You should have received a copy of the GNU General Public License 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 23 28 //---------------------------------------------------------------------- 24 // ENDHEADER29 //FJENDHEADER 25 30 26 31 -
external/fastjet/WrappedStructure.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: WrappedStructure.hh 2577 2011-09-13 15:11:38Z salam $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: WrappedStructure.hh 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/config_auto.h
r5b5a56b r35cdc46 147 147 /* Define to the full name and version of this package. */ 148 148 #ifndef FASTJET_PACKAGE_STRING 149 #define FASTJET_PACKAGE_STRING "FastJet 3. 0.6"149 #define FASTJET_PACKAGE_STRING "FastJet 3.1.0-beta.1" 150 150 #endif 151 151 … … 157 157 /* Define to the version of this package. */ 158 158 #ifndef FASTJET_PACKAGE_VERSION 159 #define FASTJET_PACKAGE_VERSION "3. 0.6"159 #define FASTJET_PACKAGE_VERSION "3.1.0-beta.1" 160 160 #endif 161 161 … … 167 167 /* Version number of package */ 168 168 #ifndef FASTJET_VERSION 169 #define FASTJET_VERSION "3.0.6" 169 #define FASTJET_VERSION "3.1.0-beta.1" 170 #endif 171 172 /* Major version of this package */ 173 #ifndef FASTJET_VERSION_MAJOR 174 #define FASTJET_VERSION_MAJOR 3 175 #endif 176 177 /* Minor version of this package */ 178 #ifndef FASTJET_VERSION_MINOR 179 #define FASTJET_VERSION_MINOR 1 180 #endif 181 182 /* Version of the package under the form XYYZZ (instead of X.Y.Z) */ 183 #ifndef FASTJET_VERSION_NUMBER 184 #define FASTJET_VERSION_NUMBER 30103 185 #endif 186 187 /* Patch version of this package */ 188 #ifndef FASTJET_VERSION_PATCHLEVEL 189 #define FASTJET_VERSION_PATCHLEVEL 3 190 #endif 191 192 /* Pre-release version of this package */ 193 #ifndef FASTJET_VERSION_PRERELEASE 194 #define FASTJET_VERSION_PRERELEASE ".1.0-beta.1" 170 195 #endif 171 196 -
external/fastjet/config_raw.h
r5b5a56b r35cdc46 88 88 89 89 /* Define to the full name and version of this package. */ 90 #define PACKAGE_STRING "FastJet 3. 0.6"90 #define PACKAGE_STRING "FastJet 3.1.0-beta.1" 91 91 92 92 /* Define to the one symbol short name of this package. */ … … 94 94 95 95 /* Define to the version of this package. */ 96 #define PACKAGE_VERSION "3. 0.6"96 #define PACKAGE_VERSION "3.1.0-beta.1" 97 97 98 98 /* Define to 1 if you have the ANSI C header files. */ … … 100 100 101 101 /* Version number of package */ 102 #define VERSION "3.0.6" 102 #define VERSION "3.1.0-beta.1" 103 104 /* Major version of this package */ 105 #define VERSION_MAJOR 3 106 107 /* Minor version of this package */ 108 #define VERSION_MINOR 1 109 110 /* Version of the package under the form XYYZZ (instead of X.Y.Z) */ 111 #define VERSION_NUMBER 30103 112 113 /* Patch version of this package */ 114 #define VERSION_PATCHLEVEL 3 115 116 /* Pre-release version of this package */ 117 #define VERSION_PRERELEASE ".1.0-beta.1" -
external/fastjet/config_win.h
r5b5a56b r35cdc46 1 #define FASTJET_PACKAGE_STRING "FastJet 3.0.6" 2 #define FASTJET_PACKAGE_VERSION "3.0.6" 1 #define FASTJET_PACKAGE_STRING "FastJet 3.1.0-beta.1" 2 #define FASTJET_PACKAGE_VERSION "3.1.0-beta.1" 3 #define FASTJET_VERSION "3.1.0-beta.1" 4 #define FASTJET_VERSION_MAJOR 3 5 #define FASTJET_VERSION_MINOR 1 6 #define FASTJET_VERSION_PATCHLEVEL 3 7 #define FASTJET_VERSION_PRERELEASE ".1.0-beta.1" 8 #define FASTJET_VERSION_NUMBER 30103 3 9 4 10 /* The ATLASCone plugin is disabled by default*/ -
external/fastjet/contribs/Nsubjettiness/AUTHORS
r5b5a56b r35cdc46 18 18 JHEP 1202:093 (2012), arXiv:1108.2701. 19 19 20 New in v2.0 is the winner-take-all axis, described in: 21 22 Jet Shapes with the Broadening Axis. 23 Andrew J. Larkoski, Duff Neill, and Jesse Thaler. 24 JHEP 1404:017 (2014), arXiv:1401.2158. 25 26 as well as in unpublished work by Gavin Salam. 27 20 28 ---------------------------------------------------------------------- -
external/fastjet/contribs/Nsubjettiness/AxesFinder.cc
r5b5a56b r35cdc46 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: AxesFinder.cc 670 2014-06-06 01:24:42Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. … … 37 38 template <int N> 38 39 std::vector<LightLikeAxis> AxesFinderFromOnePassMinimization::UpdateAxesFast(const std::vector <LightLikeAxis> & old_axes, 39 const std::vector <fastjet::PseudoJet> & inputJets) {40 const std::vector <fastjet::PseudoJet> & inputJets) const { 40 41 assert(old_axes.size() == N); 41 42 … … 45 46 for (int n = 0; n < N; ++n) { 46 47 new_axes[n].reset(0.0,0.0,0.0,0.0); 47 #ifdef FASTJET248 new_jets[n].reset(0.0,0.0,0.0,0.0);49 #else50 // use cheaper reset if available51 48 new_jets[n].reset_momentum(0.0,0.0,0.0,0.0); 52 #endif53 49 } 54 50 … … 135 131 // (This is just a wrapper for the templated version above.) 136 132 std::vector<LightLikeAxis> AxesFinderFromOnePassMinimization::UpdateAxes(const std::vector <LightLikeAxis> & old_axes, 137 const std::vector <fastjet::PseudoJet> & inputJets) {133 const std::vector <fastjet::PseudoJet> & inputJets) const { 138 134 int N = old_axes.size(); 139 135 switch (N) { … … 166 162 // uses minimization of N-jettiness to continually update axes until convergence. 167 163 // The function returns the axes found at the (local) minimum 168 std::vector<fastjet::PseudoJet> AxesFinderFromOnePassMinimization::get BetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& seedAxes){164 std::vector<fastjet::PseudoJet> AxesFinderFromOnePassMinimization::getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& seedAxes) const { 169 165 170 166 // convert from PseudoJets to LightLikeAxes … … 211 207 } 212 208 213 PseudoJet AxesFinderFromKmeansMinimization::jiggle(const PseudoJet& axis) {209 PseudoJet AxesFinderFromKmeansMinimization::jiggle(const PseudoJet& axis) const { 214 210 double phi_noise = ((double)rand()/(double)RAND_MAX) * _noise_range * 2.0 - _noise_range; 215 211 double rap_noise = ((double)rand()/(double)RAND_MAX) * _noise_range * 2.0 - _noise_range; … … 226 222 227 223 // Repeatedly calls the one pass finder to try to find global minimum 228 std::vector<fastjet::PseudoJet> AxesFinderFromKmeansMinimization::get BetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& seedAxes){224 std::vector<fastjet::PseudoJet> AxesFinderFromKmeansMinimization::getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& seedAxes) const { 229 225 230 226 // first iteration … … 256 252 // It continually updates until it reaches convergence or it reaches the maximum number of attempts. 257 253 // This is essentially the same as a stable cone finder. 258 std::vector<fastjet::PseudoJet> AxesFinderFromGeometricMinimization::get BetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & particles, const std::vector<fastjet::PseudoJet>& currentAxes){254 std::vector<fastjet::PseudoJet> AxesFinderFromGeometricMinimization::getAxes(int /*n_jets*/, const std::vector <fastjet::PseudoJet> & particles, const std::vector<fastjet::PseudoJet>& currentAxes) const { 259 255 260 256 std::vector<fastjet::PseudoJet> seedAxes = currentAxes; 261 double seedTau = _function ->tau(particles, seedAxes);257 double seedTau = _function.tau(particles, seedAxes); 262 258 263 259 for (int i = 0; i < _nAttempts; i++) { … … 270 266 // start from unclustered beam measure 271 267 int minJ = -1; 272 double minDist = _function ->beam_distance_squared(particles[i]);268 double minDist = _function.beam_distance_squared(particles[i]); 273 269 274 270 // which axis am I closest to? 275 271 for (unsigned int j = 0; j < seedAxes.size(); j++) { 276 double tempDist = _function ->jet_distance_squared(particles[i],seedAxes[j]);272 double tempDist = _function.jet_distance_squared(particles[i],seedAxes[j]); 277 273 if (tempDist < minDist) { 278 274 minDist = tempDist; … … 287 283 // calculate tau on new axes 288 284 seedAxes = newAxes; 289 double tempTau = _function ->tau(particles, newAxes);285 double tempTau = _function.tau(particles, newAxes); 290 286 291 287 // close enough to stop? -
external/fastjet/contribs/Nsubjettiness/AxesFinder.hh
r5b5a56b r35cdc46 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: AxesFinder.hh 678 2014-06-12 20:43:03Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. … … 53 54 class AxesFinder { 54 55 55 protected: 56 AxesFinder* _startingFinder; // storing a possible starting finder if needed 57 std::vector<fastjet::PseudoJet> _seedAxes; 58 59 AxesFinder(AxesFinder* startingFinder = NULL) : _startingFinder(startingFinder) {} 60 61 public: 62 virtual ~AxesFinder(){ 63 if (_startingFinder) delete _startingFinder; //TODO: Convert to smart pointers to avoid this. 64 } 65 66 // Allow setting of seedAxes from a starting finder 67 std::vector<fastjet::PseudoJet> getAxes(int n_jets, const std::vector<fastjet::PseudoJet> & inputs, const std::vector<fastjet::PseudoJet>& currentAxes) { 68 if (_startingFinder) { 69 _seedAxes = _startingFinder->getAxes(n_jets,inputs,currentAxes); 70 return getBetterAxes(n_jets,inputs,_seedAxes); 71 } else { 72 _seedAxes = getBetterAxes(n_jets,inputs,currentAxes); 73 return _seedAxes; 74 } 75 } 76 77 // say what the current seed axes are 78 std::vector<fastjet::PseudoJet> seedAxes() const { 79 return _seedAxes; 80 } 81 82 // This function should be overloaded, and updates the seedAxes 83 virtual std::vector<fastjet::PseudoJet> getBetterAxes(int n_jets, const std::vector<fastjet::PseudoJet> & inputs, const std::vector<fastjet::PseudoJet>& seedAxes) = 0; 84 85 }; 86 56 public: 57 58 // This function should be overloaded, and updates the seedAxes to return new axes 59 virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets, 60 const std::vector<fastjet::PseudoJet>& inputs, 61 const std::vector<fastjet::PseudoJet>& seedAxes) const = 0; 62 // convenient shorthand for squaring 63 static inline double sq(double x) {return x*x;} 64 65 //virtual destructor 66 virtual ~AxesFinder(){} 67 68 }; 69 70 87 71 //------------------------------------------------------------------------ 88 72 /// \class AxesFinderFromExclusiveJetDefinition … … 90 74 // with different jet algorithms. 91 75 class AxesFinderFromExclusiveJetDefinition : public AxesFinder { 92 93 private: 94 fastjet::JetDefinition _def; 95 96 public: 97 AxesFinderFromExclusiveJetDefinition(fastjet::JetDefinition def) : _def(def) {} 98 99 virtual std::vector<fastjet::PseudoJet> getBetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputs, const std::vector<fastjet::PseudoJet>& currentAxes) { 100 fastjet::ClusterSequence jet_clust_seq(inputs, _def); 101 return jet_clust_seq.exclusive_jets(n_jets); 102 } 76 77 public: 78 AxesFinderFromExclusiveJetDefinition(fastjet::JetDefinition def) 79 : _def(def) {} 80 81 virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets, 82 const std::vector <fastjet::PseudoJet> & inputs, 83 const std::vector<fastjet::PseudoJet>& /*seedAxes*/) const { 84 fastjet::ClusterSequence jet_clust_seq(inputs, _def); 85 return jet_clust_seq.exclusive_jets(n_jets); 86 } 87 88 private: 89 fastjet::JetDefinition _def; 90 103 91 }; 104 92 … … 108 96 // winner take all recombination scheme. 109 97 class AxesFinderFromWTA_KT : public AxesFinderFromExclusiveJetDefinition { 110 private: 111 const WinnerTakeAllRecombiner *recomb; 112 public: 113 AxesFinderFromWTA_KT() : AxesFinderFromExclusiveJetDefinition( 114 fastjet::JetDefinition(fastjet::kt_algorithm, 115 fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant 116 recomb = new WinnerTakeAllRecombiner(), 117 fastjet::Best)) {} 118 ~AxesFinderFromWTA_KT() {delete recomb;} 119 }; 98 99 public: 100 AxesFinderFromWTA_KT() 101 : AxesFinderFromExclusiveJetDefinition( 102 fastjet::JetDefinition(fastjet::kt_algorithm, 103 fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant 104 &_recomb, 105 fastjet::Best)) {} 106 107 private: 108 const WinnerTakeAllRecombiner _recomb; 109 110 }; 120 111 121 112 //------------------------------------------------------------------------ … … 124 115 // winner take all recombination scheme. 125 116 class AxesFinderFromWTA_CA : public AxesFinderFromExclusiveJetDefinition { 126 private: 127 const WinnerTakeAllRecombiner *recomb; 128 public: 129 AxesFinderFromWTA_CA() : AxesFinderFromExclusiveJetDefinition( 130 fastjet::JetDefinition(fastjet::cambridge_algorithm, 131 fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant 132 recomb = new WinnerTakeAllRecombiner(), 133 fastjet::Best)) {} 134 ~AxesFinderFromWTA_CA() {delete recomb;} 135 }; 136 137 // The following classes are for testing, and are commented out for initial release 138 // 139 ////------------------------------------------------------------------------ 140 ///// \class AxesFinderFromWTA2_KT 141 //// This class finds axes by finding the exlusive jets after clustering according to a kT algorithm and a 142 //// winner take all recombination scheme with alpha = 2. 143 //class AxesFinderFromWTA2_KT : public AxesFinderFromExclusiveJetDefinition { 144 // private: 145 // const WinnerTakeAllRecombiner *recomb; 146 // public: 147 // AxesFinderFromWTA2_KT() : AxesFinderFromExclusiveJetDefinition( 148 // fastjet::JetDefinition(fastjet::kt_algorithm, 149 // fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant 150 // recomb = new WinnerTakeAllRecombiner(2), // uses alpha = 2 here 151 // fastjet::Best)) {} 152 // ~AxesFinderFromWTA2_KT() {delete recomb;} 153 // }; 154 // 155 ////------------------------------------------------------------------------ 156 ///// \class AxesFinderFromWTA2_CA 157 //// This class finds axes by finding the exlusive jets after clustering according to a CA algorithm and a 158 //// winner take all recombination scheme with alpha = 2. 159 //class AxesFinderFromWTA2_CA : public AxesFinderFromExclusiveJetDefinition { 160 // private: 161 // const WinnerTakeAllRecombiner *recomb; 162 // public: 163 // AxesFinderFromWTA2_CA() : AxesFinderFromExclusiveJetDefinition( 164 // fastjet::JetDefinition(fastjet::cambridge_algorithm, 165 // fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant 166 // recomb = new WinnerTakeAllRecombiner(2), //uses alpha = 2 here 167 // fastjet::Best)) {} 168 // ~AxesFinderFromWTA2_CA() {delete recomb;} 169 //}; 117 public: 118 AxesFinderFromWTA_CA() 119 : AxesFinderFromExclusiveJetDefinition( 120 fastjet::JetDefinition(fastjet::cambridge_algorithm, 121 fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant 122 &_recomb, 123 fastjet::Best)) {} 124 125 private: 126 const WinnerTakeAllRecombiner _recomb; 127 }; 128 170 129 171 130 //------------------------------------------------------------------------ … … 174 133 // E_scheme recombination. 175 134 class AxesFinderFromKT : public AxesFinderFromExclusiveJetDefinition { 176 public: 177 AxesFinderFromKT() : AxesFinderFromExclusiveJetDefinition( 178 fastjet::JetDefinition(fastjet::kt_algorithm, 179 fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant 180 fastjet::E_scheme, 181 fastjet::Best)) {} 135 public: 136 AxesFinderFromKT() 137 : AxesFinderFromExclusiveJetDefinition( 138 fastjet::JetDefinition(fastjet::kt_algorithm, 139 fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant 140 fastjet::E_scheme, 141 fastjet::Best)) {} 182 142 }; 183 143 … … 187 147 // E_scheme recombination. 188 148 class AxesFinderFromCA : public AxesFinderFromExclusiveJetDefinition { 189 public: 190 AxesFinderFromCA() : AxesFinderFromExclusiveJetDefinition( 191 fastjet::JetDefinition(fastjet::cambridge_algorithm, 192 fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant 193 fastjet::E_scheme, 194 fastjet::Best)) {} 149 public: 150 AxesFinderFromCA() 151 : AxesFinderFromExclusiveJetDefinition( 152 fastjet::JetDefinition(fastjet::cambridge_algorithm, 153 fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant 154 fastjet::E_scheme, 155 fastjet::Best)) {} 195 156 }; 196 157 … … 201 162 // This can be implemented with different jet algorithms. 202 163 class AxesFinderFromHardestJetDefinition : public AxesFinder { 203 204 private: 205 fastjet::JetDefinition _def; 206 207 public: 208 AxesFinderFromHardestJetDefinition(fastjet::JetDefinition def) : _def(def) {} 209 210 virtual std::vector<fastjet::PseudoJet> getBetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputs, const std::vector<fastjet::PseudoJet>& currentAxes) { 211 fastjet::ClusterSequence jet_clust_seq(inputs, _def); 212 std::vector<fastjet::PseudoJet> myJets = sorted_by_pt(jet_clust_seq.inclusive_jets()); 213 myJets.resize(n_jets); // only keep n hardest 214 return myJets; 215 } 164 public: 165 AxesFinderFromHardestJetDefinition(fastjet::JetDefinition def) 166 : _def(def) {} 167 168 virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets, 169 const std::vector <fastjet::PseudoJet> & inputs, 170 const std::vector<fastjet::PseudoJet>& /*seedAxes*/) const { 171 fastjet::ClusterSequence jet_clust_seq(inputs, _def); 172 std::vector<fastjet::PseudoJet> myJets = sorted_by_pt(jet_clust_seq.inclusive_jets()); 173 myJets.resize(n_jets); // only keep n hardest 174 return myJets; 175 } 176 177 private: 178 fastjet::JetDefinition _def; 216 179 }; 217 180 … … 221 184 // to an anti kT algorithm and E_scheme. 222 185 class AxesFinderFromAntiKT : public AxesFinderFromHardestJetDefinition { 223 public: 224 AxesFinderFromAntiKT(double R0) : AxesFinderFromHardestJetDefinition(fastjet::JetDefinition(fastjet::antikt_algorithm,R0,fastjet::E_scheme,fastjet::Best)) {} 186 public: 187 AxesFinderFromAntiKT(double R0) 188 : AxesFinderFromHardestJetDefinition( 189 fastjet::JetDefinition(fastjet::antikt_algorithm, 190 R0,fastjet::E_scheme,fastjet::Best)) {} 225 191 }; 226 192 … … 231 197 class AxesFinderFromUserInput : public AxesFinder { 232 198 233 public: 234 AxesFinderFromUserInput() {} 235 236 virtual std::vector<fastjet::PseudoJet> getBetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputs, const std::vector<fastjet::PseudoJet>& currentAxes) { 237 assert(currentAxes.size() == (unsigned int) n_jets); 238 return currentAxes; 239 } 199 public: 200 AxesFinderFromUserInput() {} 201 202 virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & /*inputs*/, const std::vector<fastjet::PseudoJet>& currentAxes) const { 203 assert(currentAxes.size() == (unsigned int) n_jets); 204 (void)(n_jets); // adding this line to fix unused-parameter warning 205 return currentAxes; 206 } 240 207 }; 241 208 … … 249 216 class AxesFinderFromOnePassMinimization : public AxesFinder { 250 217 251 private: 252 double _precision; // Desired precision in axes alignment 253 int _halt; // maximum number of steps per iteration 254 255 double _beta; 256 double _Rcutoff; 257 258 DefaultUnnormalizedMeasure _measureFunction; 259 260 public: 261 262 // From a startingFinder, try to minimize the unnormalized_measure 263 AxesFinderFromOnePassMinimization(AxesFinder* startingFinder, double beta, double Rcutoff) 264 : AxesFinder(startingFinder), 265 _precision(0.0001), //hard coded for now 266 _halt(1000), //hard coded for now 267 _beta(beta), 268 _Rcutoff(Rcutoff), 269 _measureFunction(beta, Rcutoff) 270 {} 271 272 virtual std::vector<fastjet::PseudoJet> getBetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& currentAxes); 273 274 template <int N> std::vector<LightLikeAxis> UpdateAxesFast(const std::vector <LightLikeAxis> & old_axes, 275 const std::vector <fastjet::PseudoJet> & inputJets); 276 277 std::vector<LightLikeAxis> UpdateAxes(const std::vector <LightLikeAxis> & old_axes, 278 const std::vector <fastjet::PseudoJet> & inputJets); 218 public: 219 220 // From a startingFinder, try to minimize the unnormalized_measure 221 AxesFinderFromOnePassMinimization(double beta, double Rcutoff) 222 : _precision(0.0001), //hard coded for now 223 _halt(1000), //hard coded for now 224 _beta(beta), 225 _Rcutoff(Rcutoff), 226 _measureFunction(beta, Rcutoff) 227 {} 228 229 virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets, 230 const std::vector <fastjet::PseudoJet> & inputJets, 231 const std::vector<fastjet::PseudoJet>& currentAxes) const; 232 233 private: 234 double _precision; // Desired precision in axes alignment 235 int _halt; // maximum number of steps per iteration 236 237 double _beta; 238 double _Rcutoff; 239 240 DefaultUnnormalizedMeasureFunction _measureFunction; 241 242 template <int N> std::vector<LightLikeAxis> UpdateAxesFast(const std::vector <LightLikeAxis> & old_axes, 243 const std::vector <fastjet::PseudoJet> & inputJets) const; 244 245 std::vector<LightLikeAxis> UpdateAxes(const std::vector <LightLikeAxis> & old_axes, 246 const std::vector <fastjet::PseudoJet> & inputJets) const; 279 247 280 248 }; … … 288 256 class AxesFinderFromKmeansMinimization : public AxesFinder{ 289 257 290 private: 291 int _n_iterations; // Number of iterations to run (0 for no minimization, 1 for one-pass, >>1 for global minimum) 292 double _noise_range; // noise range for random initialization 293 294 DefaultUnnormalizedMeasure _measureFunction; //function to test whether minimum is reached 295 296 AxesFinderFromOnePassMinimization _onePassFinder; //one pass finder for minimization 297 298 PseudoJet jiggle(const PseudoJet& axis); 299 300 public: 301 AxesFinderFromKmeansMinimization(AxesFinder *startingFinder, double beta, double Rcutoff, int n_iterations) : 302 AxesFinder(startingFinder), 303 _n_iterations(n_iterations), 304 _noise_range(1.0), // hard coded for the time being 305 _measureFunction(beta, Rcutoff), 306 _onePassFinder(NULL, beta, Rcutoff) 307 {} 308 309 virtual std::vector<fastjet::PseudoJet> getBetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& currentAxes); 310 258 public: 259 AxesFinderFromKmeansMinimization(double beta, double Rcutoff, int n_iterations) 260 : _n_iterations(n_iterations), 261 _noise_range(1.0), // hard coded for the time being 262 _measureFunction(beta, Rcutoff), 263 _onePassFinder(beta, Rcutoff) 264 {} 265 266 virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& currentAxes) const; 267 268 private: 269 int _n_iterations; // Number of iterations to run (0 for no minimization, 1 for one-pass, >>1 for global minimum) 270 double _noise_range; // noise range for random initialization 271 272 DefaultUnnormalizedMeasureFunction _measureFunction; //function to test whether minimum is reached 273 274 AxesFinderFromOnePassMinimization _onePassFinder; //one pass finder that is repeatedly called 275 276 PseudoJet jiggle(const PseudoJet& axis) const; 311 277 }; 312 278 … … 317 283 class AxesFinderFromGeometricMinimization : public AxesFinder { 318 284 319 private: 320 MeasureFunction* _function; 321 double _Rcutoff; 322 double _nAttempts; 323 double _accuracy; 324 325 326 public: 327 AxesFinderFromGeometricMinimization(AxesFinder* startingFinder, double beta, double Rcutoff) : AxesFinder(startingFinder), _Rcutoff(Rcutoff) { 328 if (beta != 2.0) { 329 std::cerr << "Geometric minimization is currently only defined for beta = 2.0." << std::endl; 330 exit(1); 331 } 332 333 _nAttempts = 100; 334 _accuracy = 0.000000001; 335 _function = new GeometricMeasure(beta,_Rcutoff); 285 public: 286 AxesFinderFromGeometricMinimization(double beta, double Rcutoff) 287 : _nAttempts(100), 288 _accuracy(0.000000001), 289 _function(beta,Rcutoff) 290 { 291 if (beta != 2.0) { 292 throw Error("Geometric minimization is currently only defined for beta = 2.0."); 336 293 } 337 338 ~AxesFinderFromGeometricMinimization() { 339 delete _function; 340 } 341 342 virtual std::vector<fastjet::PseudoJet> getBetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & particles, const std::vector<fastjet::PseudoJet>& currentAxes); 294 } 295 296 virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & particles, const std::vector<fastjet::PseudoJet>& currentAxes) const; 297 298 private: 299 double _nAttempts; 300 double _accuracy; 301 GeometricMeasureFunction _function; 302 303 343 304 }; 344 305 … … 348 309 // in order to better facilitate calculations. 349 310 class LightLikeAxis { 350 private: 351 double _rap, _phi, _weight, _mom; 352 353 double DistanceSq(double rap2, double phi2) const { 354 double rap1 = _rap; 355 double phi1 = _phi; 356 357 double distRap = rap1-rap2; 358 double distPhi = std::fabs(phi1-phi2); 359 if (distPhi > M_PI) {distPhi = 2.0*M_PI - distPhi;} 360 return sq(distRap) + sq(distPhi); 361 } 362 363 double Distance(double rap2, double phi2) const { 364 return std::sqrt(DistanceSq(rap2,phi2)); 365 } 366 367 311 368 312 public: 369 313 LightLikeAxis() : _rap(0.0), _phi(0.0), _weight(0.0), _mom(0.0) {} … … 399 343 } 400 344 345 private: 346 double _rap, _phi, _weight, _mom; 347 348 double DistanceSq(double rap2, double phi2) const { 349 double rap1 = _rap; 350 double phi1 = _phi; 351 352 double distRap = rap1-rap2; 353 double distPhi = std::fabs(phi1-phi2); 354 if (distPhi > M_PI) {distPhi = 2.0*M_PI - distPhi;} 355 return distRap*distRap + distPhi*distPhi; 356 } 357 358 double Distance(double rap2, double phi2) const { 359 return std::sqrt(DistanceSq(rap2,phi2)); 360 } 361 362 401 363 }; 402 364 -
external/fastjet/contribs/Nsubjettiness/MeasureFunction.cc
r5b5a56b r35cdc46 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: MeasureFunction.cc 670 2014-06-06 01:24:42Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. … … 36 37 37 38 // Return all of the necessary TauComponents for specific input particles and axes 38 TauComponents MeasureFunction::result(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) { 39 TauComponents MeasureFunction::result(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const { 40 41 // first find partition 42 // this sets jetPartitionStorage and beamPartitionStorage 43 PseudoJet beamPartitionStorage; 44 std::vector<fastjet::PseudoJet> jetPartitionStorage = get_partition(particles,axes,&beamPartitionStorage); 45 46 // then return result calculated from partition 47 return result_from_partition(jetPartitionStorage,axes,&beamPartitionStorage); 48 } 39 49 40 std::vector<double> jetPieces(axes.size(), 0.0); 41 double beamPiece = 0.0; 50 std::vector<fastjet::PseudoJet> MeasureFunction::get_partition(const std::vector<fastjet::PseudoJet>& particles, 51 const std::vector<fastjet::PseudoJet>& axes, 52 PseudoJet * beamPartitionStorage) const { 42 53 43 // Calculates the unnormalized sub-tau values, i.e. a std::vector of the contributions to tau_N of each Voronoi region (or region within R_0) 54 std::vector<std::vector<PseudoJet> > jetPartition(axes.size()); 55 std::vector<PseudoJet> beamPartition; 56 57 // Figures out the partiting of the input particles into the various jet pieces 58 // Based on which axis the parition is closest to 44 59 for (unsigned i = 0; i < particles.size(); i++) { 45 60 … … 60 75 61 76 if (j_min == -1) { 62 if (_has_beam) beamP iece += beam_numerator(particles[i]);77 if (_has_beam) beamPartition.push_back(particles[i]); 63 78 else assert(_has_beam); // this should never happen. 64 79 } else { 65 jetP ieces[j_min] += jet_numerator(particles[i],axes[j_min]);80 jetPartition[j_min].push_back(particles[i]); 66 81 } 67 82 } 68 83 69 // Calculates normalization for tau and subTau if _has_denominator is true, otherwise returns 1.0 (i.e. no normalization) 70 double tauDen = 0.0; 71 if (_has_denominator) { 72 for (unsigned i = 0; i < particles.size(); i++) { 73 tauDen += denominator(particles[i]); 74 } 75 } else { 76 tauDen = 1.0; // if no denominator, then 1.0 for no normalization factor 84 // Store beam partition 85 if (beamPartitionStorage) { 86 *beamPartitionStorage = join(beamPartition); 87 } 88 89 // Store jet partitions 90 std::vector<PseudoJet> jetPartitionStorage(axes.size(),PseudoJet(0,0,0,0)); 91 for (unsigned j = 0; j < axes.size(); j++) { 92 jetPartitionStorage[j] = join(jetPartition[j]); 77 93 } 78 94 95 return jetPartitionStorage; 96 } 97 98 // does partition, but only stores index of PseudoJets 99 std::vector<std::list<int> > MeasureFunction::get_partition_list(const std::vector<fastjet::PseudoJet>& particles, 100 const std::vector<fastjet::PseudoJet>& axes) const { 101 102 std::vector<std::list<int> > jetPartition(axes.size()); 103 104 // Figures out the partiting of the input particles into the various jet pieces 105 // Based on which axis the parition is closest to 106 for (unsigned i = 0; i < particles.size(); i++) { 107 108 // find minimum distance; start with beam (-1) for reference 109 int j_min = -1; 110 double minRsq; 111 if (_has_beam) minRsq = beam_distance_squared(particles[i]); 112 else minRsq = std::numeric_limits<double>::max(); // make it large value 113 114 // check to see which axis the particle is closest to 115 for (unsigned j = 0; j < axes.size(); j++) { 116 double tempRsq = jet_distance_squared(particles[i],axes[j]); // delta R distance 117 if (tempRsq < minRsq) { 118 minRsq = tempRsq; 119 j_min = j; 120 } 121 } 122 123 if (j_min == -1) { 124 assert(_has_beam); // consistency check 125 } else { 126 jetPartition[j_min].push_back(i); 127 } 128 } 129 130 return jetPartition; 131 } 132 133 134 // Uses existing partition and calculates result 135 // TODO: Can we cache this for speed up when doing area subtraction? 136 TauComponents MeasureFunction::result_from_partition(const std::vector<fastjet::PseudoJet>& jet_partition, 137 const std::vector<fastjet::PseudoJet>& axes, 138 PseudoJet * beamPartitionStorage) const { 139 140 std::vector<double> jetPieces(axes.size(), 0.0); 141 double beamPiece = 0.0; 142 143 double tauDen = 0.0; 144 if (!_has_denominator) tauDen = 1.0; // if no denominator, then 1.0 for no normalization factor 145 146 // first find jet pieces 147 for (unsigned j = 0; j < axes.size(); j++) { 148 std::vector<PseudoJet> thisPartition = jet_partition[j].constituents(); 149 for (unsigned i = 0; i < thisPartition.size(); i++) { 150 jetPieces[j] += jet_numerator(thisPartition[i],axes[j]); //numerator jet piece 151 if (_has_denominator) tauDen += denominator(thisPartition[i]); // denominator 152 } 153 } 154 155 // then find beam piece 156 if (_has_beam) { 157 assert(beamPartitionStorage); // make sure I have beam information 158 std::vector<PseudoJet> beamPartition = beamPartitionStorage->constituents(); 159 160 for (unsigned i = 0; i < beamPartition.size(); i++) { 161 beamPiece += beam_numerator(beamPartition[i]); //numerator beam piece 162 if (_has_denominator) tauDen += denominator(beamPartition[i]); // denominator 163 } 164 } 79 165 return TauComponents(jetPieces, beamPiece, tauDen, _has_denominator, _has_beam); 80 166 } 167 168 169 170 81 171 82 172 } //namespace contrib -
external/fastjet/contribs/Nsubjettiness/MeasureFunction.hh
r5b5a56b r35cdc46 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: MeasureFunction.hh 678 2014-06-12 20:43:03Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. … … 31 32 #include <limits> 32 33 34 33 35 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 34 36 35 37 namespace contrib{ 36 38 37 inline double sq(double x) {return x*x;} 38 39 /////// 40 // 41 // Measure Function 42 // 43 /////// 44 39 /////// 40 // 41 // TauComponents 42 // (eventually we might want to put this in a separate header file) 43 // 44 /////// 45 45 46 /// \class TauComponents 46 47 // This class creates a wrapper for the various tau/subtau values calculated in Njettiness. This class allows Njettiness access to these variables 47 48 // without ever having to do the calculation itself. It takes in subtau numerators and tau denominator from MeasureFunction 48 49 // and outputs tau numerator, and normalized tau and subtau. 49 // TODO: Consider merging with NjettinessExtras. Add axes information?50 50 class TauComponents { 51 private:52 53 // these values are input in the constructor54 std::vector<double> _jet_pieces_numerator;55 double _beam_piece_numerator;56 double _denominator;57 bool _has_denominator; //added so that TauComponents knows if denominator is used or not58 bool _has_beam; //added so that TauComponents knows if beam regions is used or not59 60 // these values are derived from above values61 std::vector<double> _jet_pieces;62 double _beam_piece;63 double _numerator;64 double _tau;65 66 51 67 52 public: … … 115 100 double beam_piece() const { return _beam_piece; } 116 101 double tau() const { return _tau; } 117 118 }; 102 103 private: 104 105 // these values are input in the constructor 106 std::vector<double> _jet_pieces_numerator; 107 double _beam_piece_numerator; 108 double _denominator; 109 bool _has_denominator; //added so that TauComponents knows if denominator is used or not 110 bool _has_beam; //added so that TauComponents knows if beam regions is used or not 111 112 // these values are derived from above values 113 std::vector<double> _jet_pieces; 114 double _beam_piece; 115 double _numerator; 116 double _tau; 117 118 }; 119 120 /////// 121 // 122 // Measure Function 123 // 124 /////// 125 119 126 120 127 //------------------------------------------------------------------------ … … 125 132 class MeasureFunction { 126 133 134 public: 135 //These functions define the measure by which tau_N is calculated, 136 //and are overloaded by the various measures below 137 138 // Distanes to axes. These are called many times, so need to be as fast as possible 139 virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const = 0; 140 virtual double beam_distance_squared(const fastjet::PseudoJet& particle) const = 0; 141 142 // The actual measures used in N-(sub)jettiness 143 virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const = 0; 144 virtual double beam_numerator(const fastjet::PseudoJet& particle) const = 0; 145 146 // a possible normalization factor 147 virtual double denominator(const fastjet::PseudoJet& particle) const = 0; 148 149 //------ 150 // The functions below call the above functions and are not virtual 151 //------ 152 153 // Return all of the necessary TauComponents for specific input particles and axes 154 // Also have optional pointers to get out information about partitioning 155 TauComponents result(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const; 156 157 // Just getting tau value if that is all that is needed 158 double tau(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const { 159 return result(particles,axes).tau(); 160 } 161 162 // Create the partitioning and stores internally 163 std::vector<fastjet::PseudoJet> get_partition(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes, PseudoJet * beamPartitionStorage = NULL) const; 164 165 // Essentially same as get_partition, but in the form needed for the jet algorithm 166 std::vector<std::list<int> > get_partition_list(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const; 167 168 // calculates the tau result using an existing partition 169 TauComponents result_from_partition(const std::vector<fastjet::PseudoJet>& jet_partitioning, const std::vector<fastjet::PseudoJet>& axes, PseudoJet * beamPartitionStorage = NULL) const; 170 171 // shorthand for squaring 172 static inline double sq(double x) {return x*x;} 173 174 //virtual destructor 175 virtual ~MeasureFunction(){} 176 127 177 protected: 128 178 //bool set by derived classes to choose whether or not to use the denominator … … 133 183 MeasureFunction(bool has_denominator = true, bool has_beam = true) : _has_denominator(has_denominator), _has_beam(has_beam) {} 134 184 135 public: 136 virtual ~MeasureFunction(){} 137 138 //These functions define the measure by which tau_N is calculated, 139 //and are overloaded by the various measures below 140 141 // Distanes to axes. These are called many times, so need to be as fast as possible 142 virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) = 0; 143 virtual double beam_distance_squared(const fastjet::PseudoJet& particle) = 0; 144 145 // The actual measures used in N-(sub)jettiness 146 virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) = 0; 147 virtual double beam_numerator(const fastjet::PseudoJet& particle) = 0; 148 149 // a possible normalization factor 150 virtual double denominator(const fastjet::PseudoJet& particle) = 0; 151 152 153 // These functions call the above functions and are not virtual 154 155 // Do I cluster a particle into a jet? 156 bool do_cluster(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) { 157 return (jet_distance_squared(particle,axis) <= beam_distance_squared(particle)); 158 } 159 160 // Return all of the necessary TauComponents for specific input particles and axes 161 TauComponents result(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes); 162 163 double tau(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) { 164 return result(particles,axes).tau(); 165 } 166 167 168 }; 169 170 171 /// \class DefaultNormalizedMeasure 185 }; 186 187 188 /// \class DefaultNormalizedMeasureFunction 172 189 // This class is the default measure, inheriting from the class above. This class will calculate tau_N 173 190 // of a jet according to this measure. This measure is defined as the pT of the particle multiplied by deltaR 174 191 // to the power of beta. This class includes the normalization factor determined by R0 175 class DefaultNormalizedMeasure : public MeasureFunction { 176 177 private: 178 double _beta; 179 double _R0; 180 double _Rcutoff; 181 182 public: 183 184 DefaultNormalizedMeasure(double beta, double R0, double Rcutoff, bool normalized = true) 185 : MeasureFunction(normalized), _beta(beta), _R0(R0), _Rcutoff(Rcutoff) {} 186 187 virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) { 188 return particle.squared_distance(axis); 189 } 190 191 virtual double beam_distance_squared(const fastjet::PseudoJet& particle) { 192 return sq(_Rcutoff); 193 } 194 195 virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) { 196 return particle.perp() * std::pow(jet_distance_squared(particle,axis),_beta/2.0); 197 } 198 199 virtual double beam_numerator(const fastjet::PseudoJet& particle) { 200 return particle.perp() * std::pow(_Rcutoff,_beta); 201 } 202 203 virtual double denominator(const fastjet::PseudoJet& particle) { 204 return particle.perp() * std::pow(_R0,_beta); 205 } 206 192 class DefaultNormalizedMeasureFunction : public MeasureFunction { 193 194 public: 195 196 DefaultNormalizedMeasureFunction(double beta, double R0, double Rcutoff, bool normalized = true) 197 : MeasureFunction(normalized), _beta(beta), _R0(R0), _Rcutoff(Rcutoff) {} 198 199 virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const { 200 return particle.squared_distance(axis); 201 } 202 203 virtual double beam_distance_squared(const fastjet::PseudoJet& /*particle*/) const { 204 return sq(_Rcutoff); 205 } 206 207 virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const{ 208 return particle.perp() * std::pow(jet_distance_squared(particle,axis),_beta/2.0); 209 } 210 211 virtual double beam_numerator(const fastjet::PseudoJet& particle) const { 212 return particle.perp() * std::pow(_Rcutoff,_beta); 213 } 214 215 virtual double denominator(const fastjet::PseudoJet& particle) const { 216 return particle.perp() * std::pow(_R0,_beta); 217 } 218 219 private: 220 double _beta; 221 double _R0; 222 double _Rcutoff; 223 224 207 225 }; 208 226 209 227 //------------------------------------------------------------------------ 210 /// \class DefaultUnnormalizedMeasure 228 /// \class DefaultUnnormalizedMeasureFunction 211 229 // This class is the unnormalized default measure, inheriting from the class above. The only difference from above 212 230 // is that the denominator is defined to be 1.0 by setting _has_denominator to false. 213 class DefaultUnnormalizedMeasure : public DefaultNormalizedMeasure{214 215 216 // Since all methods are identical, UnnormalizedMeasure inherits directly from NormalizedMeasure. R0 is defaulted to NAN since the value of R0 is unecessary for this class.217 // the "false" flag sets _has_denominator in MeasureFunction to false so no denominator is used.218 DefaultUnnormalizedMeasure(double beta, double Rcutoff) : DefaultNormalizedMeasure(beta, NAN, Rcutoff, false) {}219 220 231 class DefaultUnnormalizedMeasureFunction : public DefaultNormalizedMeasureFunction { 232 233 public: 234 // Since all methods are identical, UnnormalizedMeasure inherits directly 235 // from NormalizedMeasure. R0 is a dummy value since the value of R0 is unecessary for this class, 236 // and the "false" flag sets _has_denominator in MeasureFunction to false so no denominator is used. 237 DefaultUnnormalizedMeasureFunction(double beta, double Rcutoff) 238 : DefaultNormalizedMeasureFunction(beta, std::numeric_limits<double>::quiet_NaN(), Rcutoff, false) {} 221 239 }; 222 240 223 241 //------------------------------------------------------------------------ 224 /// \class GeometricMeasure 242 /// \class GeometricMeasureFunction 225 243 // This class is the geometic measure, inheriting from the class above. This class will calculate tau_N 226 244 // of a jet according to this measure. This measure is defined by the Lorentz dot product between 227 245 // the particle and the axis. This class includes normalization of tau_N. 228 class GeometricMeasure : public MeasureFunction { 229 230 private: 231 double _jet_beta; 232 double _beam_beta; 233 double _Rcutoff; 234 235 // create light-like axis 236 fastjet::PseudoJet lightFrom(const fastjet::PseudoJet& input) const { 237 double length = sqrt(pow(input.px(),2) + pow(input.py(),2) + pow(input.pz(),2)); 238 return fastjet::PseudoJet(input.px()/length,input.py()/length,input.pz()/length,1.0); 239 } 240 241 public: 242 // Right now, we are hard coded for beam_beta = 1.0, but that will need to change 243 GeometricMeasure(double jet_beta, double Rcutoff) : _jet_beta(jet_beta), _beam_beta(1.0), _Rcutoff(Rcutoff) {} 244 245 virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) { 246 fastjet::PseudoJet lightAxis = lightFrom(axis); 247 double pseudoRsquared = 2.0*dot_product(lightFrom(axis),particle)/(lightAxis.pt()*particle.pt()); 248 return pseudoRsquared; 249 } 250 251 virtual double beam_distance_squared(const fastjet::PseudoJet& particle) { 252 return sq(_Rcutoff); 253 } 254 255 virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) { 256 fastjet::PseudoJet lightAxis = lightFrom(axis); 257 double weight = (_beam_beta == 1.0) ? 1.0 : std::pow(lightAxis.pt(),_beam_beta - 1.0); 258 return particle.pt() * weight * std::pow(jet_distance_squared(particle,axis),_jet_beta/2.0); 259 } 260 261 virtual double beam_numerator(const fastjet::PseudoJet& particle) { 262 double weight = (_beam_beta == 1.0) ? 1.0 : std::pow(particle.pt()/particle.e(),_beam_beta - 1.0); 263 return particle.pt() * weight * std::pow(_Rcutoff,_jet_beta); 264 } 265 266 virtual double denominator(const fastjet::PseudoJet& particle) { 267 return 1.0; 268 } 269 }; 270 271 246 class GeometricMeasureFunction : public MeasureFunction { 247 248 public: 249 // Right now, we are hard coded for beam_beta = 1.0, but that will need to change 250 GeometricMeasureFunction(double jet_beta, double Rcutoff) : 251 MeasureFunction(false), // doesn't have denominator 252 _jet_beta(jet_beta), _beam_beta(1.0), _Rcutoff(Rcutoff) {} 253 254 virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const { 255 fastjet::PseudoJet lightAxis = lightFrom(axis); 256 double pseudoRsquared = 2.0*dot_product(lightFrom(axis),particle)/(lightAxis.pt()*particle.pt()); 257 return pseudoRsquared; 258 } 259 260 virtual double beam_distance_squared(const fastjet::PseudoJet& /*particle*/) const { 261 return sq(_Rcutoff); 262 } 263 264 virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const { 265 fastjet::PseudoJet lightAxis = lightFrom(axis); 266 double weight = (_beam_beta == 1.0) ? 1.0 : std::pow(lightAxis.pt(),_beam_beta - 1.0); 267 return particle.pt() * weight * std::pow(jet_distance_squared(particle,axis),_jet_beta/2.0); 268 } 269 270 virtual double beam_numerator(const fastjet::PseudoJet& particle) const { 271 double weight = (_beam_beta == 1.0) ? 1.0 : std::pow(particle.pt()/particle.e(),_beam_beta - 1.0); 272 return particle.pt() * weight * std::pow(_Rcutoff,_jet_beta); 273 } 274 275 virtual double denominator(const fastjet::PseudoJet& /*particle*/) const { 276 return std::numeric_limits<double>::quiet_NaN(); 277 } 278 279 280 private: 281 double _jet_beta; 282 double _beam_beta; 283 double _Rcutoff; 284 285 // create light-like axis 286 fastjet::PseudoJet lightFrom(const fastjet::PseudoJet& input) const { 287 double length = sqrt(pow(input.px(),2) + pow(input.py(),2) + pow(input.pz(),2)); 288 return fastjet::PseudoJet(input.px()/length,input.py()/length,input.pz()/length,1.0); 289 } 290 291 }; 292 293 272 294 } //namespace contrib 273 295 -
external/fastjet/contribs/Nsubjettiness/Njettiness.cc
r5b5a56b r35cdc46 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: Njettiness.cc 677 2014-06-12 18:56:46Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. … … 35 36 /////// 36 37 37 // Helper function to correlate one pass minimization with appropriate measure 38 void Njettiness::setOnePassAxesFinder(MeasureMode measure_mode, AxesFinder* startingFinder, double beta, double Rcutoff) { 39 if (measure_mode == normalized_measure || measure_mode == unnormalized_measure || measure_mode == normalized_cutoff_measure || measure_mode == unnormalized_cutoff_measure) { 40 _axesFinder = new AxesFinderFromOnePassMinimization(startingFinder, beta, Rcutoff); 41 } 42 else if (measure_mode == geometric_measure || measure_mode == geometric_cutoff_measure) { 43 _axesFinder = new AxesFinderFromGeometricMinimization(startingFinder, beta, Rcutoff); 44 } 45 else { 46 std::cerr << "Minimization only set up for normalized_measure, unnormalized_measure, normalized_cutoff_measure, unnormalized_cutoff_measure, geometric_measure, geometric_cutoff_measure" << std::endl; 47 exit(1); } 48 } 49 50 // Parsing needed for constructor to set AxesFinder and MeasureFunction 51 // All of the parameter handling is here, and checking that number of parameters is correct. 52 void Njettiness::setMeasureFunctionandAxesFinder(AxesMode axes_mode, MeasureMode measure_mode, double para1, double para2, double para3, double para4) { 38 Njettiness::Njettiness(const AxesDefinition & axes_def, const MeasureDefinition & measure_def) 39 : _axes_def(axes_def.create()), _measure_def(measure_def.create()) { 40 setMeasureFunctionAndAxesFinder(); // call helper function to do the hard work 41 } 42 43 Njettiness::Njettiness(AxesMode axes_mode, const MeasureDefinition & measure_def) 44 : _axes_def(createAxesDef(axes_mode)), _measure_def(measure_def.create()) { 45 setMeasureFunctionAndAxesFinder(); // call helper function to do the hard work 46 } 47 48 // Convert from MeasureMode enum to MeasureDefinition 49 // This returns a pointer that will be claimed by a SharedPtr 50 MeasureDefinition* Njettiness::createMeasureDef(MeasureMode measure_mode, int num_para, double para1, double para2, double para3) const { 53 51 54 52 // definition of maximum Rcutoff for non-cutoff measures, changed later by other measures 55 53 double Rcutoff = std::numeric_limits<double>::max(); //large number 56 // Most (but all measures have some kind of beta value)57 double beta = NAN;54 // Most (but not all) measures have some kind of beta value 55 double beta = std::numeric_limits<double>::quiet_NaN(); 58 56 // The normalized measures have an R0 value. 59 double R0 = NAN;60 57 double R0 = std::numeric_limits<double>::quiet_NaN(); 58 61 59 // Find the MeasureFunction and set the parameters. 62 60 switch (measure_mode) { … … 64 62 beta = para1; 65 63 R0 = para2; 66 if( correctParameterCount(2, para1, para2, para3, para4))67 _measureFunction = new DefaultNormalizedMeasure(beta, R0, Rcutoff); //normalized_measure requires 2 parameters, beta and R068 else {69 std::cerr << "normalized_measure needs 2 parameters (beta and R0)" << std::endl;70 exit(1);}64 if(num_para == 2) { 65 return new NormalizedMeasure(beta,R0); 66 } else { 67 throw Error("normalized_measure needs 2 parameters (beta and R0)"); 68 } 71 69 break; 72 70 case unnormalized_measure: 73 71 beta = para1; 74 if( correctParameterCount(1, para1, para2, para3, para4))75 _measureFunction = new DefaultUnnormalizedMeasure(beta, Rcutoff); //unnormalized_measure requires 1 parameter, beta76 else {77 std::cerr << "unnormalized_measure needs 1 parameter (beta)" << std::endl;78 exit(1);}72 if(num_para == 1) { 73 return new UnnormalizedMeasure(beta); 74 } else { 75 throw Error("unnormalized_measure needs 1 parameter (beta)"); 76 } 79 77 break; 80 78 case geometric_measure: 81 79 beta = para1; 82 if (correctParameterCount(1, para1, para2, para3, para4))83 _measureFunction = new GeometricMeasure(beta,Rcutoff); //geometric_measure requires 1 parameter, beta84 else {85 std::cerr << "geometric_measure needs 1 parameter (beta)" << std::endl;86 exit(1);}80 if (num_para == 1) { 81 return new GeometricMeasure(beta); 82 } else { 83 throw Error("geometric_measure needs 1 parameter (beta)"); 84 } 87 85 break; 88 86 case normalized_cutoff_measure: … … 90 88 R0 = para2; 91 89 Rcutoff = para3; //Rcutoff parameter is 3rd parameter in normalized_cutoff_measure 92 if (correctParameterCount(3, para1, para2, para3, para4))93 _measureFunction = new DefaultNormalizedMeasure(beta, R0, Rcutoff); //normalized_cutoff_measure requires 3 parameters, beta, R0, and Rcutoff94 else {95 std::cerr << "normalized_cutoff_measure has 3 parameters (beta, R0, Rcutoff)" << std::endl;96 exit(1);}90 if (num_para == 3) { 91 return new NormalizedCutoffMeasure(beta,R0,Rcutoff); 92 } else { 93 throw Error("normalized_cutoff_measure has 3 parameters (beta, R0, Rcutoff)"); 94 } 97 95 break; 98 96 case unnormalized_cutoff_measure: 99 97 beta = para1; 100 98 Rcutoff = para2; //Rcutoff parameter is 2nd parameter in normalized_cutoff_measure 101 if ( correctParameterCount(2, para1, para2, para3, para4))102 _measureFunction = new DefaultUnnormalizedMeasure(beta, Rcutoff); //unnormalized_cutoff_measure requires 2 parameters, beta and Rcutoff103 else {104 std::cerr << "unnormalized_cutoff_measure has 2 parameters (beta, Rcutoff)" << std::endl;105 exit(1);}99 if (num_para == 2) { 100 return new UnnormalizedCutoffMeasure(beta,Rcutoff); 101 } else { 102 throw Error("unnormalized_cutoff_measure has 2 parameters (beta, Rcutoff)"); 103 } 106 104 break; 107 105 case geometric_cutoff_measure: 108 106 beta = para1; 109 107 Rcutoff = para2; //Rcutoff parameter is 2nd parameter in geometric_cutoff_measure 110 if( correctParameterCount(2, para1, para2, para3, para4))111 _measureFunction = new GeometricMeasure(beta,Rcutoff); //geometric_cutoff_measure requires 2 parameters, beta and Rcutoff112 else {113 std::cerr << "geometric_cutoff_measure has 2 parameters (beta,Rcutoff)" << std::endl;114 exit(1);}108 if(num_para == 2) { 109 return new GeometricCutoffMeasure(beta,Rcutoff); 110 } else { 111 throw Error("geometric_cutoff_measure has 2 parameters (beta, Rcutoff)"); 112 } 115 113 break; 116 114 default: 117 115 assert(false); 118 116 break; 119 } 120 121 // Choose which AxesFinder from user input. 122 // Uses setOnePassAxesFinder helpful function to use beta and Rcutoff values about (if needed) 117 } 118 return NULL; 119 } 120 121 // Convert from AxesMode enum to AxesDefinition 122 // This returns a pointer that will be claimed by a SharedPtr 123 AxesDefinition* Njettiness::createAxesDef(Njettiness::AxesMode axes_mode) const { 124 123 125 switch (axes_mode) { 124 126 case wta_kt_axes: 125 _axesFinder = new AxesFinderFromWTA_KT(); 126 break; 127 return new WTA_KT_Axes(); 127 128 case wta_ca_axes: 128 _axesFinder = new AxesFinderFromWTA_CA(); 129 break; 129 return new WTA_CA_Axes(); 130 130 case kt_axes: 131 _axesFinder = new AxesFinderFromKT(); 132 break; 131 return new KT_Axes(); 133 132 case ca_axes: 134 _axesFinder = new AxesFinderFromCA(); 135 break; 133 return new CA_Axes(); 136 134 case antikt_0p2_axes: 137 _axesFinder = new AxesFinderFromAntiKT(0.2); 138 break; 135 return new AntiKT_Axes(0.2); 139 136 case onepass_wta_kt_axes: 140 setOnePassAxesFinder(measure_mode, new AxesFinderFromWTA_KT(), beta, Rcutoff); 141 break; 137 return new OnePass_WTA_KT_Axes(); 142 138 case onepass_wta_ca_axes: 143 setOnePassAxesFinder(measure_mode, new AxesFinderFromWTA_CA(), beta, Rcutoff); 144 break; 139 return new OnePass_WTA_CA_Axes(); 145 140 case onepass_kt_axes: 146 setOnePassAxesFinder(measure_mode, new AxesFinderFromKT(), beta, Rcutoff); 147 break; 141 return new OnePass_KT_Axes(); 148 142 case onepass_ca_axes: 149 setOnePassAxesFinder(measure_mode, new AxesFinderFromCA(), beta, Rcutoff); 150 break; 143 return new OnePass_CA_Axes(); 151 144 case onepass_antikt_0p2_axes: 152 setOnePassAxesFinder(measure_mode, new AxesFinderFromAntiKT(0.2), beta, Rcutoff); 153 break; 145 return new OnePass_AntiKT_Axes(0.2); 154 146 case onepass_manual_axes: 155 setOnePassAxesFinder(measure_mode, new AxesFinderFromUserInput(), beta, Rcutoff); 156 break; 157 case min_axes: //full minimization is not defined for geometric_measure. 158 if (measure_mode == normalized_measure || measure_mode == unnormalized_measure || measure_mode == normalized_cutoff_measure || measure_mode == unnormalized_cutoff_measure) 159 //Defaults to 100 iteration to find minimum 160 _axesFinder = new AxesFinderFromKmeansMinimization(new AxesFinderFromKT(), beta, Rcutoff, 100); 161 else { 162 std::cerr << "Multi-pass minimization only set up for normalized_measure, unnormalized_measure, normalized_cutoff_measure, unnormalized_cutoff_measure." << std::endl; 163 exit(1); 164 } 165 break; 147 return new OnePass_Manual_Axes(); 148 case min_axes: 149 return new MultiPass_Axes(100); 166 150 case manual_axes: 167 _axesFinder = new AxesFinderFromUserInput(); 168 break; 169 // These options have been commented out because they have not been fully tested 170 // case wta2_kt_axes: // option for alpha = 2 added 171 // _axesFinder = new AxesFinderFromWTA2_KT(); 172 // break; 173 // case wta2_ca_axes: // option for alpha = 2 added 174 // _axesFinder = new AxesFinderFromWTA2_CA(); 175 // break; 176 // case onepass_wta2_kt_axes: // option for alpha = 2 added 177 // setOnePassAxesFinder(measure_mode, new AxesFinderFromWTA2_KT(), beta, Rcutoff); 178 // break; 179 // case onepass_wta2_ca_axes: // option for alpha = 2 added 180 // setOnePassAxesFinder(measure_mode, new AxesFinderFromWTA2_CA(), beta, Rcutoff); 181 // break; 151 return new Manual_Axes(); 182 152 default: 183 153 assert(false); 184 break; 185 } 186 154 return NULL; 155 } 156 } 157 158 159 // Parsing needed for constructor to set AxesFinder and MeasureFunction 160 // All of the parameter handling is here, and checking that number of parameters is correct. 161 void Njettiness::setMeasureFunctionAndAxesFinder() { 162 // Get the correct MeasureFunction and AxesFinders 163 _measureFunction.reset(_measure_def->createMeasureFunction()); 164 _startingAxesFinder.reset(_axes_def->createStartingAxesFinder(*_measure_def)); 165 _finishingAxesFinder.reset(_axes_def->createFinishingAxesFinder(*_measure_def)); 187 166 } 188 167 189 168 // setAxes for Manual mode 190 void Njettiness::setAxes( std::vector<fastjet::PseudoJet>myAxes) {191 if (_ current_axes_mode == manual_axes || _current_axes_mode == onepass_manual_axes) {169 void Njettiness::setAxes(const std::vector<fastjet::PseudoJet> & myAxes) { 170 if (_axes_def->supportsManualAxes()) { 192 171 _currentAxes = myAxes; 193 } 194 else { 195 std::cerr << "You can only use setAxes if using manual_axes or onepass_manual_axes measure mode" << std::endl; 196 exit(1); 172 } else { 173 throw Error("You can only use setAxes for manual AxesDefinitions"); 197 174 } 198 175 } … … 200 177 // Calculates and returns all TauComponents that user would want. 201 178 // This information is stored in _current_tau_components for later access as well. 202 TauComponents Njettiness::getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) {179 TauComponents Njettiness::getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const { 203 180 if (inputJets.size() <= n_jets) { //if not enough particles, return zero 204 181 _currentAxes = inputJets; … … 206 183 _current_tau_components = TauComponents(); 207 184 _seedAxes = _currentAxes; 185 _currentJets = _currentAxes; 186 _currentBeam = PseudoJet(0.0,0.0,0.0,0.0); 208 187 } else { 209 _currentAxes = _axesFinder->getAxes(n_jets,inputJets,_currentAxes); // sets current Axes 210 _seedAxes = _axesFinder->seedAxes(); // sets seed Axes (if one pass minimization was used) 211 _current_tau_components = _measureFunction->result(inputJets, _currentAxes); // sets current Tau Values 188 189 _seedAxes = _startingAxesFinder->getAxes(n_jets,inputJets,_currentAxes); //sets starting point for minimization 190 if (_finishingAxesFinder) { 191 _currentAxes = _finishingAxesFinder->getAxes(n_jets,inputJets,_seedAxes); 192 } else { 193 _currentAxes = _seedAxes; 194 } 195 196 // Find partition and store information 197 // (jet information in _currentJets, beam in _currentBeam) 198 _currentJets = _measureFunction->get_partition(inputJets,_currentAxes,&_currentBeam); 199 200 // Find tau value and store information 201 _current_tau_components = _measureFunction->result_from_partition(_currentJets, _currentAxes,&_currentBeam); // sets current Tau Values 212 202 } 213 203 return _current_tau_components; … … 219 209 // Each vector element is a list of ints corresponding to the indices in 220 210 // particles of the particles belonging to that jet. 221 // TODO: Consider moving to MeasureFunction 222 std::vector<std::list<int> > Njettiness::getPartition(const std::vector<fastjet::PseudoJet> & particles) { 223 std::vector<std::list<int> > partitions(_currentAxes.size()); 224 225 for (unsigned i = 0; i < particles.size(); i++) { 226 227 int j_min = -1; 228 // find minimum distance 229 double minR = std::numeric_limits<double>::max(); //large number 230 for (unsigned j = 0; j < _currentAxes.size(); j++) { 231 double tempR = _measureFunction->jet_distance_squared(particles[i],_currentAxes[j]); // delta R distance 232 if (tempR < minR) { 233 minR = tempR; 234 j_min = j; 235 } 236 } 237 if (_measureFunction->do_cluster(particles[i],_currentAxes[j_min])) partitions[j_min].push_back(i); 238 } 239 return partitions; 240 } 241 242 // Having found axes, assign each particle in particles to an axis, and return a set of jets. 243 // Each jet is the sum of particles closest to an axis (Njet = Naxes). 244 // TODO: Consider moving to MeasureFunction 245 std::vector<fastjet::PseudoJet> Njettiness::getJets(const std::vector<fastjet::PseudoJet> & particles) { 246 247 std::vector<fastjet::PseudoJet> jets(_currentAxes.size()); 248 249 std::vector<std::list<int> > partition = getPartition(particles); 250 for (unsigned j = 0; j < partition.size(); ++j) { 251 std::list<int>::const_iterator it, itE; 252 for (it = partition[j].begin(), itE = partition[j].end(); it != itE; ++it) { 253 jets[j] += particles[*it]; 254 } 255 } 256 return jets; 257 } 258 211 std::vector<std::list<int> > Njettiness::getPartitionList(const std::vector<fastjet::PseudoJet> & particles) const { 212 // core code is in MeasureFunction 213 return _measureFunction->get_partition_list(particles,_currentAxes); 214 } 215 216 259 217 } // namespace contrib 260 218 -
external/fastjet/contribs/Nsubjettiness/Njettiness.hh
r5b5a56b r35cdc46 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: Njettiness.hh 670 2014-06-06 01:24:42Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. … … 25 26 #define __FASTJET_CONTRIB_NJETTINESS_HH__ 26 27 28 27 29 #include "MeasureFunction.hh" 28 30 #include "AxesFinder.hh" 31 #include "NjettinessDefinition.hh" 29 32 30 33 #include "fastjet/PseudoJet.hh" 34 #include "fastjet/SharedPtr.hh" 35 #include <fastjet/LimitedWarning.hh> 36 31 37 #include <cmath> 32 38 #include <vector> 33 39 #include <list> 34 40 35 36 41 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 37 42 38 43 namespace contrib { 39 44 40 45 /////// 41 46 // … … 54 59 55 60 // The various axes choices available to the user 61 // It is recommended to use AxesDefinition instead of these. 56 62 enum AxesMode { 57 63 kt_axes, // exclusive kt axes … … 78 84 // "normalized_cutoff_measure" was the default in v1.0 of Nsubjettiness 79 85 // "unnormalized_measure" is now the recommended default usage 86 // But it is recommended to use MeasureDefinition instead of these. 80 87 enum MeasureMode { 81 88 normalized_measure, //default normalized measure … … 87 94 }; 88 95 89 private: 90 // The chosen axes/measure modes 91 AxesFinder* _axesFinder; // The chosen axes 92 MeasureFunction* _measureFunction; // The chosen measure 96 // Main constructor that uses AxesMode and MeasureDefinition to specify measure 97 // Unlike Nsubjettiness or NjettinessPlugin, the value N is not chosen 98 Njettiness(const AxesDefinition & axes_def, const MeasureDefinition & measure_def); 93 99 94 // Enum information so functions can specify output based on specific options, primarily for setAxes 95 AxesMode _current_axes_mode; 96 MeasureMode _current_measure_mode; 97 98 // Information about the current information 99 TauComponents _current_tau_components; //automatically set to have components of 0; these values will be set by the getTau function call 100 std::vector<fastjet::PseudoJet> _currentAxes; 101 std::vector<fastjet::PseudoJet> _seedAxes; // axes used prior to minimization (if applicable) 102 103 // Needed for compilation of non C++11 users 104 bool isnan(double para) { return para != para; } 100 // Intermediate constructor (needed to enable v1.0.3 backwards compatibility?) 101 Njettiness(AxesMode axes_mode, const MeasureDefinition & measure_def); 105 102 106 // Helpful function to check to make sure input has correct number of parameters 107 bool correctParameterCount(int n, double para1, double para2, double para3, double para4){ 108 int numpara; 109 if (!isnan(para1) && !isnan(para2) && !isnan(para3) && !isnan(para4)) numpara = 4; 110 else if (!isnan(para1) && !isnan(para2) && !isnan(para3) && isnan(para4)) numpara = 3; 111 else if (!isnan(para1) && !isnan(para2) && isnan(para3) && isnan(para4)) numpara = 2; 112 else if (!isnan(para1) && isnan(para2) && isnan(para3) && isnan(para4)) numpara = 1; 113 else numpara = 0; 114 return n == numpara; 103 // Alternative constructor which takes axes/measure information as enums with measure parameters 104 // This version is not recommended 105 Njettiness(AxesMode axes_mode, 106 MeasureMode measure_mode, 107 int num_para, 108 double para1 = std::numeric_limits<double>::quiet_NaN(), 109 double para2 = std::numeric_limits<double>::quiet_NaN(), 110 double para3 = std::numeric_limits<double>::quiet_NaN()) 111 : _axes_def(createAxesDef(axes_mode)), _measure_def(createMeasureDef(measure_mode, num_para, para1, para2, para3)) { 112 setMeasureFunctionAndAxesFinder(); // call helper function to do the hard work 115 113 } 116 114 117 // Helper function to set onepass_axes depending on input measure_mode and startingFinder 118 void setOnePassAxesFinder(MeasureMode measure_mode, AxesFinder* startingFinder, double para1, double Rcutoff); 119 120 // created separate function to set MeasureFunction and AxesFinder in order to keep constructor cleaner. 121 void setMeasureFunctionandAxesFinder(AxesMode axes_mode, MeasureMode measure_mode, double para1, double para2, double para3, double para4); 122 123 public: 124 125 126 // Main constructor which takes axes/measure information, and possible parameters. 127 // Unlike Nsubjettiness or NjettinessPlugin, the value N is not chosen 128 Njettiness(AxesMode axes_mode, 129 MeasureMode measure_mode, 130 double para1 = NAN, 131 double para2 = NAN, 132 double para3 = NAN, 133 double para4 = NAN) 134 : _current_axes_mode(axes_mode), 135 _current_measure_mode(measure_mode) { 136 setMeasureFunctionandAxesFinder(axes_mode, measure_mode, para1, para2, para3, para4); // call helper function to do the hard work 137 } 138 139 ~Njettiness() { 140 // clean house 141 delete _measureFunction; 142 delete _axesFinder; 143 } 115 // destructor 116 ~Njettiness() {}; 144 117 145 118 // setAxes for Manual mode 146 void setAxes( std::vector<fastjet::PseudoJet>myAxes);119 void setAxes(const std::vector<fastjet::PseudoJet> & myAxes); 147 120 148 121 // Calculates and returns all TauComponents that user would want. 149 122 // This information is stored in _current_tau_components for later access as well. 150 TauComponents getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) ;123 TauComponents getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const; 151 124 152 125 // Calculates the value of N-subjettiness, 153 126 // but only returns the tau value from _current_tau_components 154 double getTau(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) {127 double getTau(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const { 155 128 return getTauComponents(n_jets, inputJets).tau(); 156 129 } 157 158 // returns enum information159 MeasureMode currentMeasureMode() { return _current_measure_mode;}160 AxesMode currentAxesMode() { return _current_axes_mode;}161 130 162 131 // Return all relevant information about tau components 163 TauComponents currentTauComponents() {return _current_tau_components;} 164 132 TauComponents currentTauComponents() const {return _current_tau_components;} 165 133 // Return axes found by getTauComponents. 166 std::vector<fastjet::PseudoJet> currentAxes() { return _currentAxes;}134 std::vector<fastjet::PseudoJet> currentAxes() const { return _currentAxes;} 167 135 // Return seedAxes used if onepass minimization (otherwise, same as currentAxes) 168 std::vector<fastjet::PseudoJet> seedAxes() { return _seedAxes;} 136 std::vector<fastjet::PseudoJet> seedAxes() const { return _seedAxes;} 137 // Return jet partition found by getTauComponents. 138 std::vector<fastjet::PseudoJet> currentJets() const {return _currentJets;} 139 // Return beam partition found by getTauComponents. 140 fastjet::PseudoJet currentBeam() const {return _currentBeam;} 169 141 170 142 // partition inputs by Voronoi (each vector stores indices corresponding to inputJets) 171 std::vector<std::list<int> > getPartition (const std::vector<fastjet::PseudoJet> & inputJets);143 std::vector<std::list<int> > getPartitionList(const std::vector<fastjet::PseudoJet> & inputJets) const; 172 144 173 // partition inputs by Voronoi 174 std::vector<fastjet::PseudoJet> getJets(const std::vector<fastjet::PseudoJet> & inputJets); 145 private: 146 147 // Information about Axes and Measures to be Used 148 // Implemented as SharedPtrs to avoid memory management headaches 149 SharedPtr<const AxesDefinition> _axes_def; 150 SharedPtr<const MeasureDefinition> _measure_def; 151 152 // The chosen axes/measure mode workers 153 // Implemented as SharedPtrs to avoid memory management headaches 154 // TODO: make into a SharedPtr<const AxesFinder>? 155 SharedPtr<MeasureFunction> _measureFunction; // The chosen measure 156 SharedPtr<AxesFinder> _startingAxesFinder; // The initial axes finder 157 SharedPtr<AxesFinder> _finishingAxesFinder; // A possible minimization step 158 159 // Information about the current information 160 // Defined as mutables, so user should be aware that these change when getTau is called. 161 mutable TauComponents _current_tau_components; //automatically set to have components of 0; these values will be set by the getTau function call 162 mutable std::vector<fastjet::PseudoJet> _currentAxes; //axes found after minimization 163 mutable std::vector<fastjet::PseudoJet> _seedAxes; // axes used prior to minimization (if applicable) 164 mutable std::vector<fastjet::PseudoJet> _currentJets; //partitioning information 165 mutable fastjet::PseudoJet _currentBeam; //return beam, if requested 166 167 // created separate function to set MeasureFunction and AxesFinder in order to keep constructor cleaner. 168 void setMeasureFunctionAndAxesFinder(); 169 170 // Convert old style enums into new style MeasureDefinition 171 AxesDefinition* createAxesDef(AxesMode axes_mode) const; 172 173 // Convert old style enums into new style MeasureDefinition 174 MeasureDefinition* createMeasureDef(MeasureMode measure_mode, int num_para, double para1, double para2, double para3) const; 175 175 176 176 }; 177 177 178 178 } // namespace contrib 179 179 -
external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.cc
r5b5a56b r35cdc46 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: NjettinessPlugin.cc 663 2014-06-03 21:26:41Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. … … 29 30 30 31 31 // Constructor with same arguments as Nsubjettiness.32 NjettinessPlugin::NjettinessPlugin(int N, Njettiness::AxesMode axes_mode, Njettiness::MeasureMode measure_mode, double para1, double para2, double para3, double para4)33 : _N(N), _njettinessFinder(axes_mode, measure_mode, para1, para2, para3, para4) {}34 35 // Old constructor for compatibility36 NjettinessPlugin::NjettinessPlugin(int N, Njettiness::AxesMode mode, double beta, double R0, double Rcutoff)37 : _N(N), _njettinessFinder(mode, Njettiness::normalized_cutoff_measure, beta, R0, Rcutoff) {}38 32 39 33 std::string NjettinessPlugin::description() const {return "N-jettiness jet finder";} 40 34 35 41 36 // Clusters the particles according to the Njettiness jet algorithm 42 // TODO: this code should be revisited to see if if can be made more clear. 37 // Apologies for the complication with this code, but we need to make 38 // a fake jet clustering tree. The partitioning is done by getPartitionList 43 39 void NjettinessPlugin::run_clustering(ClusterSequence& cs) const 44 40 { 45 41 std::vector<fastjet::PseudoJet> particles = cs.jets(); 42 43 // HACK: remove area information from particles (in case this is called by 44 // a ClusterSequenceArea. Will be fixed in a future FastJet release) 45 for (unsigned i = 0; i < particles.size(); i++) { 46 particles[i].set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>()); 47 } 48 49 46 50 _njettinessFinder.getTau(_N, particles); 47 std::vector<std::list<int> > partition = _njettinessFinder.getPartition(particles); 51 52 std::vector<std::list<int> > partition = _njettinessFinder.getPartitionList(particles); 48 53 49 54 std::vector<fastjet::PseudoJet> jet_indices_for_extras; 50 55 51 56 // output clusterings for each jet 52 for (size_t i = 0; i < partition.size(); ++i) { 57 for (size_t i0 = 0; i0 < partition.size(); ++i0) { 58 size_t i = partition.size() - 1 - i0; // reversed order of reading to match axes order 53 59 std::list<int>& indices = partition[i]; 54 60 if (indices.size() == 0) continue; … … 70 76 } 71 77 78 //HACK: Re-reverse order of reading to match CS order 79 reverse(jet_indices_for_extras.begin(),jet_indices_for_extras.end()); 80 72 81 NjettinessExtras * extras = new NjettinessExtras(_njettinessFinder.currentTauComponents(),jet_indices_for_extras,_njettinessFinder.currentAxes()); 73 82 cs.plugin_associate_extras(std::auto_ptr<ClusterSequence::Extras>(extras)); -
external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh
r5b5a56b r35cdc46 1 // $Id$2 //3 1 // Nsubjettiness Package 4 2 // Questions/Comments? jthaler@jthaler.net … … 7 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 8 6 // 7 // $Id: NjettinessPlugin.hh 671 2014-06-10 17:47:52Z jthaler $ 9 8 //---------------------------------------------------------------------- 10 9 // This file is part of FastJet contrib. … … 49 48 // to similar information 50 49 class NjettinessExtras : public ClusterSequence::Extras { 51 private: 52 53 TauComponents _tau_components; 54 std::vector<fastjet::PseudoJet> _jets; 55 std::vector<fastjet::PseudoJet> _axes; 56 57 int labelOf(const fastjet::PseudoJet& jet) const { 58 int thisJet = -1; 59 for (unsigned int i = 0; i < _jets.size(); i++) { 60 if (_jets[i].cluster_hist_index() == jet.cluster_hist_index()) { 61 thisJet = i; 62 break; 63 } 64 } 65 return thisJet; 66 } 67 50 68 51 public: 69 52 NjettinessExtras(TauComponents tau_components, std::vector<fastjet::PseudoJet> jets, std::vector<fastjet::PseudoJet> axes) : _tau_components(tau_components), _jets(jets), _axes(axes) {} … … 74 57 std::vector<fastjet::PseudoJet> axes() const {return _axes;} 75 58 76 double totalTau(const fastjet::PseudoJet& jet) const {59 double totalTau(const fastjet::PseudoJet& /*jet*/) const { 77 60 return _tau_components.tau(); 78 61 } 62 79 63 double subTau(const fastjet::PseudoJet& jet) const { 80 if (labelOf(jet) == -1) return NAN;64 if (labelOf(jet) == -1) return std::numeric_limits<double>::quiet_NaN(); // nonsense 81 65 return _tau_components.jet_pieces()[labelOf(jet)]; 82 66 } … … 93 77 return (labelOf(jet) >= 0); 94 78 } 95 79 80 private: 81 82 TauComponents _tau_components; 83 std::vector<fastjet::PseudoJet> _jets; 84 std::vector<fastjet::PseudoJet> _axes; 85 86 int labelOf(const fastjet::PseudoJet& jet) const { 87 int thisJet = -1; 88 for (unsigned int i = 0; i < _jets.size(); i++) { 89 if (_jets[i].cluster_hist_index() == jet.cluster_hist_index()) { 90 thisJet = i; 91 break; 92 } 93 } 94 return thisJet; 95 } 96 96 }; 97 97 … … 122 122 * onepass_wta_kt_axes : one-pass minimization seeded by wta_kt 123 123 * 124 * For the unnormalized_measure, N-jettiness is defined as:124 * For the UnnormalizedMeasure(beta), N-jettiness is defined as: 125 125 * 126 126 * tau_N = Sum_{all particles i} p_T^i min((DR_i1)^beta, (DR_i2)^beta, ...) … … 129 129 * and jet j. 130 130 * 131 * The normalized_meausure include an extra parameter R0, and the various cutoff131 * The NormalizedMeausure include an extra parameter R0, and the various cutoff 132 132 * measures include an Rcutoff, which effectively defines an angular cutoff 133 133 * similar in effect to a cone-jet radius. … … 138 138 public: 139 139 140 NjettinessPlugin(int N, 141 Njettiness::AxesMode axes_mode, 142 Njettiness::MeasureMode measure_mode, 143 double para1 = NAN, 144 double para2 = NAN, 145 double para3 = NAN, 146 double para4 = NAN); 140 // Constructor with same arguments as Nsubjettiness. 141 NjettinessPlugin(int N, 142 const AxesDefinition & axes_def, 143 const MeasureDefinition & measure_def) 144 : _njettinessFinder(axes_def, measure_def), _N(N) {} 145 146 147 // Alternative constructors that define the measure via enums and parameters 148 // These constructors are likely be removed 149 NjettinessPlugin(int N, 150 Njettiness::AxesMode axes_mode, 151 Njettiness::MeasureMode measure_mode) 152 : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {} 153 154 155 NjettinessPlugin(int N, 156 Njettiness::AxesMode axes_mode, 157 Njettiness::MeasureMode measure_mode, 158 double para1) 159 : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {} 160 161 162 NjettinessPlugin(int N, 163 Njettiness::AxesMode axes_mode, 164 Njettiness::MeasureMode measure_mode, 165 double para1, 166 double para2) 167 : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {} 168 169 170 NjettinessPlugin(int N, 171 Njettiness::AxesMode axes_mode, 172 Njettiness::MeasureMode measure_mode, 173 double para1, 174 double para2, 175 double para3) 176 : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {} 177 147 178 148 179 // Old constructor for backwards compatibility with v1.0, 149 // where normalized_cutoff_measure was the only option180 // where NormalizedCutoffMeasure was the only option 150 181 NjettinessPlugin(int N, 151 182 Njettiness::AxesMode mode, 152 183 double beta, 153 184 double R0, 154 double Rcutoff=std::numeric_limits<double>::max()); 185 double Rcutoff=std::numeric_limits<double>::max()) 186 : _njettinessFinder(mode, NormalizedCutoffMeasure(beta, R0, Rcutoff)), _N(N) {} 187 155 188 156 189 … … 164 197 private: 165 198 199 Njettiness _njettinessFinder; 166 200 int _N; 167 mutable Njettiness _njettinessFinder; // TODO: should muck with this so run_clustering can be const without this mutable168 201 169 202 }; -
external/fastjet/contribs/Nsubjettiness/Nsubjettiness.cc
r5b5a56b r35cdc46 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: Nsubjettiness.cc 597 2014-04-16 23:07:55Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. -
external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh
r5b5a56b r35cdc46 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: Nsubjettiness.hh 670 2014-06-06 01:24:42Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. … … 32 33 #include <string> 33 34 #include <climits> 34 35 35 36 36 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh … … 49 49 public: 50 50 51 // Main constructor, which takes N, axes/measure modes, 52 // and up to four parameters for parameters (i.e. beta, Rcutoff, etc depending on measure) 51 52 // Main constructor, which takes N, the AxesDefiniation, and the MeasureDefinition. 53 // The Definitions are given in NjettinessDefinition.hh 54 // 55 // The recommended AxesDefinitions are (more are available as listed in the README 56 // and defined in NjettinessDefinition.hh): 57 // KT_Axes : exclusive kt axes 58 // WTA_KT_Axes : exclusive kt with winner-take-all recombination 59 // OnePass_KT_Axes : one-pass minimization from kt starting point 60 // OnePass_WTA_KT_Axes : one-pass min. from wta_kt starting point 61 // 62 // The recommended measure definitions are (with the corresponding parameters) 63 // NormalizedMeasure(beta,R0) 64 // : This was the original N-subjettiness measure (dimensionless) 65 // UnnormalizedMeasure(beta) 66 // : This is the new recommended default, same as above but without 67 // : the normalization factor, and hence has units of GeV 68 // NormalizedCutoffMeasure(beta,R0,Rcutoff) 69 // : Same as normalized_measure, but cuts off at Rcutoff 70 // UnnormalizedCutoffMeasure(beta,Rcutoff) 71 // : Same as unnormalized_measure, but cuts off at Rcutoff 72 Nsubjettiness(int N, 73 const AxesDefinition& axes_def, 74 const MeasureDefinition& measure_def) 75 : _njettinessFinder(axes_def,measure_def), _N(N) {} 76 77 78 // Alternative constructors that define the measure via enums and parameters 79 // These constructors are likely be removed 80 // Zero parameter arguments 81 // (Currently, no measure uses this) 82 Nsubjettiness(int N, 83 Njettiness::AxesMode axes_mode, 84 Njettiness::MeasureMode measure_mode) 85 : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {} 86 87 // One parameter argument 88 // (for unnormalized_measure, para1=beta) 53 89 Nsubjettiness(int N, 54 90 Njettiness::AxesMode axes_mode, 55 91 Njettiness::MeasureMode measure_mode, 56 double para1 = NAN, 57 double para2 = NAN, 58 double para3 = NAN, 59 double para4 = NAN) 60 : _njettinessFinder(axes_mode, measure_mode, para1, para2, para3, para4), _N(N) {} 92 double para1) 93 : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {} 94 95 // Two parameter arguments 96 // (for normalized_measure, para1=beta, para2=R0) 97 // (for unnormalized_cutoff_measure, para1=beta, para2=Rcutoff) 98 Nsubjettiness(int N, 99 Njettiness::AxesMode axes_mode, 100 Njettiness::MeasureMode measure_mode, 101 double para1, 102 double para2) 103 : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {} 104 105 // Three parameter arguments 106 // (for unnormalized_cutoff_measure, para1=beta, para2=R0, para3=Rcutoff) 107 Nsubjettiness(int N, 108 Njettiness::AxesMode axes_mode, 109 Njettiness::MeasureMode measure_mode, 110 double para1, 111 double para2, 112 double para3) 113 : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {} 61 114 62 115 // Old constructor for backwards compatibility with v1.0, … … 67 120 double R0, 68 121 double Rcutoff=std::numeric_limits<double>::max()) 69 : _njettinessFinder(axes_mode, Njettiness::normalized_cutoff_measure, beta, R0, Rcutoff), _N(N) {} 70 71 122 : _njettinessFinder(axes_mode, NormalizedCutoffMeasure(beta,R0,Rcutoff)), _N(N) {} 123 72 124 /// returns tau_N, measured on the constituents of this jet 73 125 double result(const PseudoJet& jet) const; … … 86 138 } 87 139 140 /// returns subjet regions found by result() calculation (these have valid constituents) 141 /// Note that the axes and the subjets are not the same 142 std::vector<fastjet::PseudoJet> currentSubjets() const { 143 return _njettinessFinder.currentJets(); 144 } 145 146 /// returns components of tau_N without recalculating anything 147 TauComponents currentTauComponents() const { 148 return _njettinessFinder.currentTauComponents(); 149 } 150 88 151 // To set axes for manual use 89 void setAxes( std::vector<fastjet::PseudoJet>myAxes) {152 void setAxes(const std::vector<fastjet::PseudoJet> & myAxes) { 90 153 // Cross check that manual axes are being used is in Njettiness 91 154 _njettinessFinder.setAxes(myAxes); … … 95 158 private: 96 159 97 mutableNjettiness _njettinessFinder; // TODO: should muck with this so result can be const without this mutable160 Njettiness _njettinessFinder; // TODO: should muck with this so result can be const without this mutable 98 161 int _N; 99 162 … … 112 175 NsubjettinessRatio(int N, 113 176 int M, 177 const AxesDefinition & axes_def, 178 const MeasureDefinition & measure_def) 179 : _nsub_numerator(N,axes_def,measure_def), 180 _nsub_denominator(M,axes_def,measure_def) {} 181 182 // Alternative constructor with enums and parameters 183 // Again, likely to be removed 184 NsubjettinessRatio(int N, 185 int M, 186 Njettiness::AxesMode axes_mode, 187 Njettiness::MeasureMode measure_mode) 188 : _nsub_numerator(N, axes_mode, measure_mode), 189 _nsub_denominator(M, axes_mode, measure_mode) {} 190 191 192 NsubjettinessRatio(int N, 193 int M, 114 194 Njettiness::AxesMode axes_mode, 115 195 Njettiness::MeasureMode measure_mode, 116 double para1 = NAN, 117 double para2 = NAN, 118 double para3 = NAN, 119 double para4 = NAN) 120 : _nsub_numerator(N, axes_mode, measure_mode, para1, para2, para3, para4), 121 _nsub_denominator(M, axes_mode, measure_mode, para1, para2, para3, para4) {} 122 123 //returns tau_N/tau_M based off the input jet using result function from Nsubjettiness 196 double para1) 197 : _nsub_numerator(N, axes_mode, measure_mode, para1), 198 _nsub_denominator(M, axes_mode, measure_mode, para1) {} 199 200 NsubjettinessRatio(int N, 201 int M, 202 Njettiness::AxesMode axes_mode, 203 Njettiness::MeasureMode measure_mode, 204 double para1, 205 double para2) 206 : _nsub_numerator(N, axes_mode, measure_mode, para1, para2), 207 _nsub_denominator(M, axes_mode, measure_mode, para1, para2) {} 208 209 NsubjettinessRatio(int N, 210 int M, 211 Njettiness::AxesMode axes_mode, 212 Njettiness::MeasureMode measure_mode, 213 double para1, 214 double para2, 215 double para3) 216 : _nsub_numerator(N, axes_mode, measure_mode, para1, para2, para3), 217 _nsub_denominator(M, axes_mode, measure_mode, para1, para2, para3) {} 218 219 //returns tau_N/tau_M based off the input jet using result function from Nsubjettiness 124 220 double result(const PseudoJet& jet) const; 125 221 -
external/fastjet/contribs/Nsubjettiness/VERSION
r5b5a56b r35cdc46 1 1.1.0-beta4 1 2.1.0 -
external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.cc
r5b5a56b r35cdc46 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: WinnerTakeAllRecombiner.cc 597 2014-04-16 23:07:55Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. … … 33 34 34 35 // recombine pa and pb by creating pab with energy of the sum of particle energies in the direction of the harder particle 35 36 36 // updated recombiner to use more general form of a metric equal to E*(pT/E)^(alpha), which reduces to pT*cosh(rap)^(1-alpha) 37 37 // alpha is specified by the user. The default is alpha = 1, which is the typical behavior. alpha = 2 provides a metric which more -
external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.hh
r5b5a56b r35cdc46 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: WinnerTakeAllRecombiner.hh 670 2014-06-06 01:24:42Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. … … 50 51 51 52 /// recombine pa and pb and put result into pab 52 virtual void recombine(const fastjet::PseudoJet & pa, const fastjet::PseudoJet & pb, fastjet::PseudoJet & pab) const; 53 virtual void recombine(const fastjet::PseudoJet & pa, 54 const fastjet::PseudoJet & pb, 55 fastjet::PseudoJet & pab) const; 53 56 54 57 private: -
external/fastjet/internal/ClosestPair2D.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ClosestPair2D.hh 2577 2011-09-13 15:11:38Z salam $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: ClosestPair2D.hh 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_CLOSESTPAIR2D__HH__ -
external/fastjet/internal/ClosestPair2DBase.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ClosestPair2DBase.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: ClosestPair2DBase.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_CLOSESTPAIR2DBASE__HH__ -
external/fastjet/internal/ClusterSequence_N2.icc
r5b5a56b r35cdc46 4 4 #include "fastjet/ClusterSequence.hh" 5 5 6 // STARTHEADER6 //FJSTARTHEADER 7 7 // $Id: ClusterSequence_N2.cc 1351 2009-01-09 18:03:03Z salam $ 8 8 // 9 // Copyright (c) 2005-20 09, Matteo Cacciari, GavinSalam and Gregory Soyez9 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 10 10 // 11 11 //---------------------------------------------------------------------- … … 18 18 // 19 19 // The algorithms that underlie FastJet have required considerable 20 // development and are described in hep-ph/0512210. If you use 20 // development. They are described in the original FastJet paper, 21 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 21 22 // FastJet as part of work towards a scientific publication, please 22 // include a citation to the FastJet paper. 23 // quote the version you use and include a citation to the manual and 24 // optionally also to hep-ph/0512210. 23 25 // 24 26 // FastJet is distributed in the hope that it will be useful, … … 28 30 // 29 31 // You should have received a copy of the GNU General Public License 30 // along with FastJet; if not, write to the Free Software 31 // Foundation, Inc.: 32 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 32 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 33 33 //---------------------------------------------------------------------- 34 // ENDHEADER34 //FJENDHEADER 35 35 36 36 //---------------------------------------------------------------------- -
external/fastjet/internal/Dnn2piCylinder.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: Dnn2piCylinder.hh 2577 2011-09-13 15:11:38Z salam $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: Dnn2piCylinder.hh 3442 2014-07-24 07:20:49Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 73 75 /// Returns the index of the nearest neighbour of point labelled 74 76 /// by ii (assumes ii is valid) 75 int NearestNeighbourIndex(const int &ii) const ;77 int NearestNeighbourIndex(const int ii) const ; 76 78 77 79 /// Returns the distance to the nearest neighbour of point labelled 78 80 /// by index ii (assumes ii is valid) 79 double NearestNeighbourDistance(const int &ii) const ;81 double NearestNeighbourDistance(const int ii) const ; 80 82 81 83 /// Returns true iff the given index corresponds to a point that 82 84 /// exists in the DNN structure (meaning that it has been added, and 83 85 /// not removed in the meantime) 84 bool Valid(const int &index) const;86 bool Valid(const int index) const; 85 87 86 88 void RemoveAndAddPoints(const std::vector<int> & indices_to_remove, … … 216 218 /// initialised the class with instructions to ignore this problem the 217 219 /// program will detect and ignore it, or crash. 218 inline int Dnn2piCylinder::NearestNeighbourIndex(const int ¤t) const {220 inline int Dnn2piCylinder::NearestNeighbourIndex(const int current) const { 219 221 int main_index = _mirror_info[current].main_index; 220 222 int mirror_index = _mirror_info[current].mirror_index; … … 241 243 } 242 244 243 inline double Dnn2piCylinder::NearestNeighbourDistance(const int ¤t) const {245 inline double Dnn2piCylinder::NearestNeighbourDistance(const int current) const { 244 246 int main_index = _mirror_info[current].main_index; 245 247 int mirror_index = _mirror_info[current].mirror_index; … … 256 258 } 257 259 258 inline bool Dnn2piCylinder::Valid(const int &index) const {260 inline bool Dnn2piCylinder::Valid(const int index) const { 259 261 return (_DNN->Valid(_mirror_info[index].main_index)); 260 262 } -
external/fastjet/internal/Dnn3piCylinder.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: Dnn3piCylinder.hh 2577 2011-09-13 15:11:38Z salam $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: Dnn3piCylinder.hh 3442 2014-07-24 07:20:49Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 70 72 /// Returns the index of the nearest neighbour of point labelled 71 73 /// by ii (assumes ii is valid) 72 int NearestNeighbourIndex(const int &ii) const ;74 int NearestNeighbourIndex(const int ii) const ; 73 75 74 76 /// Returns the distance to the nearest neighbour of point labelled 75 77 /// by index ii (assumes ii is valid) 76 double NearestNeighbourDistance(const int &ii) const ;78 double NearestNeighbourDistance(const int ii) const ; 77 79 78 80 /// Returns true iff the given index corresponds to a point that 79 81 /// exists in the DNN structure (meaning that it has been added, and 80 82 /// not removed in the meantime) 81 bool Valid(const int &index) const;83 bool Valid(const int index) const; 82 84 83 85 void RemoveAndAddPoints(const std::vector<int> & indices_to_remove, … … 204 206 /// initialised the class with instructions to ignore this problem the 205 207 /// program will detect and ignore it, or crash. 206 inline int Dnn3piCylinder::NearestNeighbourIndex(const int ¤t) const {208 inline int Dnn3piCylinder::NearestNeighbourIndex(const int current) const { 207 209 int main_index = _mirror_info[current].main_index; 208 210 int mirror_index = _mirror_info[current].mirror_index; … … 229 231 } 230 232 231 inline double Dnn3piCylinder::NearestNeighbourDistance(const int ¤t) const {233 inline double Dnn3piCylinder::NearestNeighbourDistance(const int current) const { 232 234 int main_index = _mirror_info[current].main_index; 233 235 int mirror_index = _mirror_info[current].mirror_index; … … 244 246 } 245 247 246 inline bool Dnn3piCylinder::Valid(const int &index) const {248 inline bool Dnn3piCylinder::Valid(const int index) const { 247 249 return (_DNN->Valid(_mirror_info[index].main_index)); 248 250 } -
external/fastjet/internal/Dnn4piCylinder.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: Dnn4piCylinder.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: Dnn4piCylinder.hh 3442 2014-07-24 07:20:49Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 57 59 /// Returns the index of the nearest neighbour of point labelled 58 60 /// by ii (assumes ii is valid) 59 int NearestNeighbourIndex(const int &ii) const ;61 int NearestNeighbourIndex(const int ii) const ; 60 62 61 63 /// Returns the distance to the nearest neighbour of point labelled 62 64 /// by index ii (assumes ii is valid) 63 double NearestNeighbourDistance(const int &ii) const ;65 double NearestNeighbourDistance(const int ii) const ; 64 66 65 67 /// Returns true iff the given index corresponds to a point that 66 68 /// exists in the DNN structure (meaning that it has been added, and 67 69 /// not removed in the meantime) 68 bool Valid(const int &index) const;70 bool Valid(const int index) const; 69 71 70 72 void RemoveAndAddPoints(const std::vector<int> & indices_to_remove, … … 98 100 // functions defined above 99 101 100 inline int Dnn4piCylinder::NearestNeighbourIndex(const int ¤t) const {102 inline int Dnn4piCylinder::NearestNeighbourIndex(const int current) const { 101 103 return (_DNN1->NearestNeighbourDistance(current) < 102 104 _DNN2->NearestNeighbourDistance(current)) ? … … 105 107 } 106 108 107 inline double Dnn4piCylinder::NearestNeighbourDistance(const int ¤t) const {109 inline double Dnn4piCylinder::NearestNeighbourDistance(const int current) const { 108 110 return (_DNN1->NearestNeighbourDistance(current) < 109 111 _DNN2->NearestNeighbourDistance(current)) ? … … 112 114 } 113 115 114 inline bool Dnn4piCylinder::Valid(const int &index) const {116 inline bool Dnn4piCylinder::Valid(const int index) const { 115 117 return (_DNN1->Valid(index) && _DNN2->Valid(index)); 116 118 } -
external/fastjet/internal/DnnPlane.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: DnnPlane.hh 2577 2011-09-13 15:11:38Z salam $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: DnnPlane.hh 3442 2014-07-24 07:20:49Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 44 46 /// class derived from DynamicNearestNeighbours that provides an 45 47 /// implementation for the Euclidean plane 48 /// 49 /// This class that uses CGAL Delaunay triangulation for most of the 50 /// work (it allows for easy and efficient removal and addition of 51 /// points and circulation over a point's neighbours). The treatment 52 /// of coincident points is not supported by CGAL and is implemented 53 /// according to the method specified in 54 /// issue-tracker/2012-02-CGAL-coincident/METHOD 46 55 /// \endif 47 56 class DnnPlane : public DynamicNearestNeighbours { … … 57 66 /// Returns the index of the nearest neighbour of point labelled 58 67 /// by ii (assumes ii is valid) 59 int NearestNeighbourIndex(const int &ii) const ;68 int NearestNeighbourIndex(const int ii) const ; 60 69 61 70 /// Returns the distance to the nearest neighbour of point labelled 62 71 /// by index ii (assumes ii is valid) 63 double NearestNeighbourDistance(const int &ii) const ;72 double NearestNeighbourDistance(const int ii) const ; 64 73 65 74 /// Returns true iff the given index corresponds to a point that 66 75 /// exists in the DNN structure (meaning that it has been added, and 67 76 /// not removed in the meantime) 68 bool Valid(const int &index) const;77 bool Valid(const int index) const; 69 78 70 79 void RemoveAndAddPoints(const std::vector<int> & indices_to_remove, … … 80 89 double phi(const int i) const; 81 90 82 91 private: 83 92 84 93 /// Structure containing a vertex_handle and cached information on … … 88 97 double NNdistance; 89 98 int NNindex; 99 int coincidence; // ==vertex->info.val() if no coincidence 100 // points to the coinciding SV in case of coincidence 90 101 // later on for cylinder put a second vertex? 91 102 }; … … 95 106 bool _verbose; 96 107 97 static const bool _crash_on_coincidence = true;98 //static const bool _crash_on_coincidence = false;108 //static const bool _crash_on_coincidence = true; 109 static const bool _crash_on_coincidence = false; 99 110 100 111 Triangulation _TR; /// CGAL object for dealing with triangulations … … 111 122 /// Determines the index and distance of the nearest neighbour to 112 123 /// point j and puts the information into the _supervertex entry for j 113 void _SetNearest(const int &j);124 void _SetNearest(const int j); 114 125 115 126 //---------------------------------------------------------------------- … … 123 134 /// Note that j is NOT pushed onto indices_of_updated_neighbours -- 124 135 /// if you want it there, put it there yourself. 125 void _SetAndUpdateNearest(const int &j,136 void _SetAndUpdateNearest(const int j, 126 137 std::vector<int> & indices_of_updated_neighbours); 127 138 128 139 /// given a vertex_handle returned by CGAL on insertion of a new 129 /// points, crash if it turns out that it corresponds to a vertex 130 /// that we already knew about (usually because two points coincide) 131 void _CrashIfVertexPresent(const Vertex_handle & vertex, 132 const int & its_index); 133 140 /// points, returns the coinciding vertex's value if it turns out 141 /// that it corresponds to a vertex that we already knew about 142 /// (usually because two points coincide) 143 int _CheckIfVertexPresent(const Vertex_handle & vertex, 144 const int its_index); 145 146 //---------------------------------------------------------------------- 147 /// if the distance between 'pref' and 'candidate' is smaller (or 148 /// equal) than the one between 'pref' and 'near', return true and 149 /// set 'mindist' to that distance. Note that it is assumed that 150 /// 'mindist' is the euclidian distance between 'pref' and 'near' 151 /// 152 /// Note that the 'near' point is passed through its vertex rather 153 /// than as a point. This allows us to handle cases where we have no min 154 /// yet (near is the infinite vertex) 155 inline bool _is_closer_to(const Point &pref, 156 const Point &candidate, 157 const Vertex_handle &near, 158 double & dist, 159 double & mindist){ 160 dist = _euclid_distance(pref, candidate); 161 return _is_closer_to_with_hint(pref, candidate, near, dist, mindist); 162 } 163 164 /// same as '_is_closer_to' except that 'dist' already contains the 165 /// distance between 'pref' and 'candidate' 166 inline bool _is_closer_to_with_hint(const Point &pref, 167 const Point &candidate, 168 const Vertex_handle &near, 169 const double & dist, 170 double & mindist){ 171 172 // check if 'dist', the pre-computed distance between 'candidate' 173 // and 'pref' is smaller than the distance between 'pref' and its 174 // currently registered nearest neighbour 'near' (and update 175 // things if it is) 176 // 177 // Interestingly enough, it has to be pointed out that the use of 178 // 'abs' instead of 'std::abs' returns wrong results (apparently 179 // ints without any compiler warning) 180 // 181 // The (near != NULL) test is there for one single reason: when 182 // checking that a newly inserted point is not closer than a 183 // previous NN, if that distance comparison involves a "nearly 184 // degenerate" distance we need to access near->point. But 185 // sometimes, in the course of RemoveAndAddPoints, its previous NN 186 // has been deleted and its vertex (corresponding to 'near') set 187 // to NULL. This is not a problem as all points having a deleted 188 // point as NN will have their NN explicitly recomputed at the end 189 // of RemoveAndAddPoints so here we should just make sure there is 190 // no crash... that's done by checking (near != NULL) 191 if ((std::abs(dist-mindist)<DISTANCE_FOR_CGAL_CHECKS) && 192 (near != NULL) && 193 (_euclid_distance(candidate, near->point())<DISTANCE_FOR_CGAL_CHECKS)){ 194 // we're in a situation where there might be a rounding issue, 195 // use CGAL's distance computation to get it right 196 // 197 // Note that in the test right above, 198 // (abs(dist-mindist)<1e-12) guarantees that the current 199 // nearest point is not the infinite vertex and thus 200 // nearest->point() is not ill-defined 201 if (_verbose) std::cout << "using CGAL's distance ordering" << std::endl; 202 if (CGAL::compare_distance_to_point(pref, candidate, near->point())!=CGAL::LARGER){ 203 mindist = dist; 204 return true; 205 } 206 } else if (dist <= mindist) { 207 // Note that the use of a <= in the above expression (instead of 208 // a strict ordering <) is important in one case: when checking 209 // if a new point is the new NN of one of the points in its 210 // neighbourhood, in case of distances being ==, we are sure 211 // that 'candidate' is in a cell adjacent to 'pref' while it may 212 // no longer be the case for 'near' 213 mindist = dist; 214 return true; 215 } 216 217 return false; 218 } 219 220 /// if a distance between a point and 2 others is smaller than this 221 /// and the distance between the two points is also smaller than this 222 /// then use CGAL to compare the distances. 223 static const double DISTANCE_FOR_CGAL_CHECKS; 224 134 225 }; 135 226 … … 138 229 // functions defined above 139 230 140 inline int DnnPlane::NearestNeighbourIndex(const int &ii) const {231 inline int DnnPlane::NearestNeighbourIndex(const int ii) const { 141 232 return _supervertex[ii].NNindex;} 142 233 143 inline double DnnPlane::NearestNeighbourDistance(const int &ii) const {234 inline double DnnPlane::NearestNeighbourDistance(const int ii) const { 144 235 return _supervertex[ii].NNdistance;} 145 236 146 inline bool DnnPlane::Valid(const int &index) const {237 inline bool DnnPlane::Valid(const int index) const { 147 238 if (index >= 0 && index < static_cast<int>(_supervertex.size())) { 148 239 return (_supervertex[index].vertex != NULL);} else {return false;} } -
external/fastjet/internal/DynamicNearestNeighbours.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: DynamicNearestNeighbours.hh 2687 2011-11-14 11:17:51Z soyez$1 //FJSTARTHEADER 2 // $Id: DynamicNearestNeighbours.hh 3619 2014-08-13 14:17:19Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 37 39 #include<cassert> 38 40 #include "fastjet/internal/numconsts.hh" 41 #include "fastjet/Error.hh" 39 42 40 43 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh … … 68 71 /// Nearest Neighbours code 69 72 /// \endif 70 class DnnError {73 class DnnError : public Error { 71 74 public: 72 75 // constructors 73 DnnError() {;}; 74 DnnError(const std::string & message_in) { 75 _message = message_in; std::cerr << message_in << std::endl;}; 76 77 std::string message() const {return _message;}; 78 79 private: 80 std::string _message; 76 //DnnError() {} 77 DnnError(const std::string & message_in) : Error(message_in) {} 81 78 }; 82 79 … … 112 109 /// Returns the index of the nearest neighbour of point labelled 113 110 /// by ii (assumes ii is valid) 114 virtual int NearestNeighbourIndex(const int &ii) const = 0;111 virtual int NearestNeighbourIndex(const int ii) const = 0; 115 112 116 113 /// Returns the distance to the nearest neighbour of point labelled 117 114 /// by index ii (assumes ii is valid) 118 virtual double NearestNeighbourDistance(const int &ii) const = 0;115 virtual double NearestNeighbourDistance(const int ii) const = 0; 119 116 120 117 /// Returns true iff the given index corresponds to a point that 121 118 /// exists in the DNN structure (meaning that it has been added, and 122 119 /// not removed in the meantime) 123 virtual bool Valid(const int &index) const = 0;120 virtual bool Valid(const int index) const = 0; 124 121 125 122 /// remove the points labelled by the std::vector indices_to_remove, and … … 141 138 /// Remove the point labelled by index and return the list of 142 139 /// points whose nearest neighbours have changed in the process 143 inline void RemovePoint (const int &index,140 inline void RemovePoint (const int index, 144 141 std::vector<int> & indices_of_updated_neighbours) { 145 142 std::vector<int> indices_added; … … 158 155 /// point). 159 156 inline void RemoveCombinedAddCombination( 160 const int & index1, const int &index2,157 const int index1, const int index2, 161 158 const EtaPhi & newpoint, 162 159 int & index3, -
external/fastjet/internal/IsBase.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: IsBase.hh 3 071 2013-04-01 12:52:46Z cacciari$1 //FJSTARTHEADER 2 // $Id: IsBase.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_INTERNAL_IS_BASE_HH__ -
external/fastjet/internal/LimitedWarning.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_INTERNALLIMITEDWARNING_HH__ 3 3 4 // STARTHEADER5 // $Id: LimitedWarning.hh 2577 2011-09-13 15:11:38Z salam $4 //FJSTARTHEADER 5 // $Id: LimitedWarning.hh 3433 2014-07-23 08:17:03Z salam $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 -
external/fastjet/internal/MinHeap.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: MinHeap.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: MinHeap.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_MINHEAP__HH__ … … 50 52 /// expansion to a maximum size max_size; 51 53 MinHeap (const std::vector<double> & values, unsigned int max_size) : 52 _heap(max_size) {_initialise(values);}; 54 _heap(max_size) {initialise(values);} 55 56 /// do the minimal setup for a MinHeap that can reach max_size; 57 /// initialisation must be performed later with the actual values. 58 MinHeap (unsigned int max_size) : _heap(max_size) {} 53 59 54 60 /// constructor in which the the maximum size is the size of the values array 55 61 MinHeap (const std::vector<double> & values) : 56 _heap(values.size()) {_initialise(values);}; 57 62 _heap(values.size()) {initialise(values);} 63 64 /// initialise the heap with the supplied values. Should only be called if 65 /// the constructor did not supply values. 66 void initialise(const std::vector<double> & values); 67 58 68 /// return the location of the minimal value on the heap 59 69 inline unsigned int minloc() const { 60 return (_heap[0].minloc) - &(_heap[0]);} ;70 return (_heap[0].minloc) - &(_heap[0]);} 61 71 62 72 /// return the minimal value on the heap 63 inline double minval() const {return _heap[0].minloc->value;} ;73 inline double minval() const {return _heap[0].minloc->value;} 64 74 65 inline double operator[](int i) const {return _heap[i].value;} ;75 inline double operator[](int i) const {return _heap[i].value;} 66 76 67 77 /// remove the value at the specified location (i.e. replace it with … … 82 92 std::vector<ValueLoc> _heap; 83 93 84 void _initialise(const std::vector<double> & values);85 94 86 95 -
external/fastjet/internal/SearchTree.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: SearchTree.hh 3 107 2013-05-03 15:47:47Z salam $1 //FJSTARTHEADER 2 // $Id: SearchTree.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 188 190 public: 189 191 190 // so that it can access ou t_node object;192 // so that it can access our _node object; 191 193 // note: "class U" needed for clang (v1.1 branches/release_27) compilation 192 template<class U> friend class SearchTree<U>::const_circulator; 194 // 2014-07-22: as reported by Torbjorn Sjostrand, 195 // the next line was giving a warning with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) 196 // (dependent nested name specifier 'SearchTree<U>::' for friend class declaration is not supported) 197 // Just commenting it out, things still seem to work; same with a template of type T 198 //template<class U> friend class SearchTree<U>::const_circulator; 199 friend class SearchTree<T>::const_circulator; 193 200 friend class SearchTree<T>; 194 201 -
external/fastjet/internal/Triangulation.hh
r5b5a56b r35cdc46 3 3 #define __FASTJET_TRIANGULATION__ 4 4 5 // STARTHEADER6 // $Id: Triangulation.hh 2595 2011-09-23 09:05:04Z salam $5 //FJSTARTHEADER 6 // $Id: Triangulation.hh 3433 2014-07-23 08:17:03Z salam $ 7 7 // 8 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez8 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 9 9 // 10 10 //---------------------------------------------------------------------- … … 17 17 // 18 18 // The algorithms that underlie FastJet have required considerable 19 // development and are described in hep-ph/0512210. If you use 19 // development. They are described in the original FastJet paper, 20 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 20 21 // FastJet as part of work towards a scientific publication, please 21 // include a citation to the FastJet paper. 22 // quote the version you use and include a citation to the manual and 23 // optionally also to hep-ph/0512210. 22 24 // 23 25 // FastJet is distributed in the hope that it will be useful, … … 29 31 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 30 32 //---------------------------------------------------------------------- 31 // ENDHEADER33 //FJENDHEADER 32 34 33 35 -
external/fastjet/internal/Voronoi.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET__VORONOI_H__ 3 3 4 //STARTHEADER 5 // $Id: Voronoi.hh 2686 2011-11-14 09:28:22Z soyez $ 6 // 7 // Copyright (c) 1994 by AT&T Bell Laboratories (see below) 8 // 4 //FJSTARTHEADER 5 // $Id: Voronoi.hh 3433 2014-07-23 08:17:03Z salam $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 9 8 // 10 9 //---------------------------------------------------------------------- 11 // This file is included as part of FastJet but was mostly written by 12 // S. Fortune in C, put into C++ with memory management by S 13 // O'Sullivan, and with further interface and memeory management 14 // modifications by Gregory Soyez. 15 // 16 // Permission to use, copy, modify, and distribute this software for 17 // any purpose without fee is hereby granted, provided that this 18 // entire notice is included in all copies of any software which is or 19 // includes a copy or modification of this software and in all copies 20 // of the supporting documentation for such software. THIS SOFTWARE IS 21 // BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTY. 22 // IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY REPRESENTATION 23 // OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS 24 // SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. 25 // 10 // This file is part of FastJet. 11 // 12 // FastJet is free software; you can redistribute it and/or modify 13 // it under the terms of the GNU General Public License as published by 14 // the Free Software Foundation; either version 2 of the License, or 15 // (at your option) any later version. 16 // 17 // The algorithms that underlie FastJet have required considerable 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 20 // FastJet as part of work towards a scientific publication, please 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 23 // 24 // FastJet is distributed in the hope that it will be useful, 25 // but WITHOUT ANY WARRANTY; without even the implied warranty of 26 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 // GNU General Public License for more details. 28 // 29 // You should have received a copy of the GNU General Public License 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 31 //---------------------------------------------------------------------- 27 // ENDHEADER32 //FJENDHEADER 28 33 29 34 -
external/fastjet/internal/base.hh
r5b5a56b r35cdc46 1 1 2 // STARTHEADER3 // $Id: base.hh 2717 2011-11-17 14:15:46Z salam $2 //FJSTARTHEADER 3 // $Id: base.hh 3433 2014-07-23 08:17:03Z salam $ 4 4 // 5 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez5 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 6 6 // 7 7 //---------------------------------------------------------------------- … … 14 14 // 15 15 // The algorithms that underlie FastJet have required considerable 16 // development and are described in hep-ph/0512210. If you use 16 // development. They are described in the original FastJet paper, 17 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 17 18 // FastJet as part of work towards a scientific publication, please 18 // include a citation to the FastJet paper. 19 // quote the version you use and include a citation to the manual and 20 // optionally also to hep-ph/0512210. 19 21 // 20 22 // FastJet is distributed in the hope that it will be useful, … … 26 28 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 27 29 //---------------------------------------------------------------------- 28 // ENDHEADER30 //FJENDHEADER 29 31 30 32 #ifndef __FASTJET_FASTJET_BASE_HH__ -
external/fastjet/internal/numconsts.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: numconsts.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: numconsts.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/plugins/ATLASCone/ATLASConePlugin.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: ATLASConePlugin.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2007-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 // fastjet stuff -
external/fastjet/plugins/ATLASCone/fastjet/ATLASConePlugin.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: ATLASConePlugin.hh 2758 2011-11-24 08:31:58Z soyez$1 //FJSTARTHEADER 2 // $Id: ATLASConePlugin.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2007-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 // Note on the implementation: -
external/fastjet/plugins/CDFCones/CDFJetCluPlugin.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: CDFJetCluPlugin.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/CDFJetCluPlugin.hh" -
external/fastjet/plugins/CDFCones/CDFMidPointPlugin.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: CDFMidPointPlugin.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/CDFMidPointPlugin.hh" -
external/fastjet/plugins/CDFCones/JetCluAlgorithm.cc
r5b5a56b r35cdc46 11 11 // History of changes compared to the original JetCluAlgorithm.cc file 12 12 // 13 // 2014-08-13 Matteo Cacciari and Gavin Salam 14 // * commented out towers variable in JetCluAlgorithm::buildPreClusters 15 // interface to avoid compiler warning 16 // 13 17 // 2011-11-14 Gregory Soyez <soyez@fastjet.fr> 14 18 // … … 55 59 } 56 60 57 void JetCluAlgorithm::buildPreClusters(std::vector<Cluster>& seedTowers, std::vector<PhysicsTower>& towers, 61 // MC+GPS 2014-08-13, commented out the towers variable to avoid an 62 // unused variable warning 63 void JetCluAlgorithm::buildPreClusters(std::vector<Cluster>& seedTowers, std::vector<PhysicsTower>& /*towers*/, 58 64 std::vector<Cluster>& preClusters) 59 65 { -
external/fastjet/plugins/CDFCones/MidPointAlgorithm.cc
r5b5a56b r35cdc46 11 11 // History of changes compared to the original MidPointAlgorithm.cc file 12 12 // 13 // 2014-08-13 Matteo Cacciari and Gavin Salam 14 // * changed a number of int -> unsigned (and in one case 15 // added explicit conversion to int) to eliminate 16 // long-standing compiler warnings 17 // 13 18 // 2009-01-17 Gregory Soyez <soyez@fastjet.fr> 14 19 // … … 68 73 std::vector< std::vector<bool> > distanceOK; 69 74 distanceOK.resize(stableCones.size() - 1); 70 for(int nCluster1 = 1; nCluster1 < stableCones.size(); nCluster1++){ 75 // MC+GPS 2014-08-13, replaced int with unsigned 76 for(unsigned nCluster1 = 1; nCluster1 < stableCones.size(); nCluster1++){ 71 77 distanceOK[nCluster1 - 1].resize(nCluster1); 72 78 double cluster1Rapidity = stableCones[nCluster1].fourVector.y(); 73 79 double cluster1Phi = stableCones[nCluster1].fourVector.phi(); 74 for(int nCluster2 = 0; nCluster2 < nCluster1; nCluster2++){ 80 // MC+GPS 2014-08-13, replaced int with unsigned 81 for(unsigned nCluster2 = 0; nCluster2 < nCluster1; nCluster2++){ 75 82 double cluster2Rapidity = stableCones[nCluster2].fourVector.y(); 76 83 double cluster2Phi = stableCones[nCluster2].fourVector.phi(); … … 94 101 // Loop over all combinations. Calculate MidPoint. Make midPointClusters. 95 102 bool reduceConeSize = false; 96 for(int iPair = 0; iPair < pairs.size(); iPair++){ 103 // MC+GPS 2014-08-13, replaced int with unsigned 104 for(unsigned iPair = 0; iPair < pairs.size(); iPair++){ 97 105 // Calculate rapidity, phi and pT of MidPoint. 98 106 LorentzVector midPoint(0,0,0,0); 99 for(int iPairMember = 0; iPairMember < pairs[iPair].size(); iPairMember++) 107 // MC+GPS 2014-08-13, replaced int with unsigned 108 for(unsigned iPairMember = 0; iPairMember < pairs[iPair].size(); iPairMember++) 100 109 midPoint.add(stableCones[pairs[iPair][iPairMember]].fourVector); 101 110 iterateCone(midPoint.y(),midPoint.phi(),midPoint.pt(),towers,stableCones,reduceConeSize); … … 174 183 if(testPair.size()) 175 184 nextClusterStart = testPair.back() + 1; 176 for(int nextCluster = nextClusterStart; nextCluster <= distanceOK.size(); nextCluster++){ 185 // MC+GPS 2014-08-13, replaced int nextCluster with unsigned 186 for(unsigned nextCluster = nextClusterStart; nextCluster <= distanceOK.size(); nextCluster++){ 177 187 // Is new SeedCone less than 2*_coneRadius apart from all clusters in testPair? 178 188 bool addCluster = true; 179 for(int iCluster = 0; iCluster < testPair.size() && addCluster; iCluster++) 189 // MC+GPS 2014-08-13, replaced int iCluster with unsigned 190 for(unsigned iCluster = 0; iCluster < testPair.size() && addCluster; iCluster++) 180 191 if(!distanceOK[nextCluster - 1][testPair[iCluster]]) 181 192 addCluster = false; … … 187 198 pairs.push_back(testPair); 188 199 // If not bigger than allowed, find more clusters within 2*_coneRadius. 189 if(testPair.size() < maxClustersInPair) 200 // GPS+MC 2014-08-13, replaced testPair.size() with int(testPair.size()) 201 if(int(testPair.size()) < maxClustersInPair) 190 202 addClustersToPairs(testPair,pairs,distanceOK,maxClustersInPair); 191 203 // All combinations containing testPair found. Remove last element. -
external/fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: CDFJetCluPlugin.hh 2758 2011-11-24 08:31:58Z soyez$1 //FJSTARTHEADER 2 // $Id: CDFJetCluPlugin.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __CDFJETCLUPLUGIN_HH__ -
external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: CDFMidPointPlugin.hh 2758 2011-11-24 08:31:58Z soyez$1 //FJSTARTHEADER 2 // $Id: CDFMidPointPlugin.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __CDFMIDPOINTPLUGIN_HH__ -
external/fastjet/plugins/CMSIterativeCone/CMSIterativeConePlugin.cc
r5b5a56b r35cdc46 1 //STARTHEADER 2 // $Id$ 3 // 4 // Copyright (c) 2007-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 // Copyright (c) ????-????, CMS [for the iterative-cone code itself] 1 //FJSTARTHEADER 2 // $Id: CMSIterativeConePlugin.cc 1504 2009-04-10 13:39:48Z salam $ 3 // 4 // Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 6 5 // 7 6 //---------------------------------------------------------------------- 8 // This file is part of FastJet. It contains code that has been 9 // obtained from the CMS collaboration, revision 1.14 of the 10 // CMSIterativeConeAlgorithm.cc file in CMSSW, see 11 // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/RecoJets/JetAlgorithms/src/CMSIterativeConeAlgorithm.cc?hideattic=0&revision=1.14&view=markup 12 // 13 // Permission has been granted by the CMS collaboration to release it 14 // in FastJet under the terms of the GNU Public License(v2) (see the 15 // COPYING file in the main FastJet directory for details). 16 // Changes from the original file are listed below. 17 // 18 // FastJet is free software; you can redistribute it and/or modify 19 // it under the terms of the GNU General Public License as published by 20 // the Free Software Foundation; either version 2 of the License, or 21 // (at your option) any later version. 22 // 23 // The algorithms that underlie FastJet have required considerable 24 // development and are described in hep-ph/0512210. If you use 25 // FastJet as part of work towards a scientific publication, please 26 // include a citation to the FastJet paper. 27 // 28 // FastJet is distributed in the hope that it will be useful, 29 // but WITHOUT ANY WARRANTY; without even the implied warranty of 30 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 // GNU General Public License for more details. 32 // 33 // You should have received a copy of the GNU General Public License 34 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 7 // This file is part of FastJet. 8 // 9 // FastJet is free software; you can redistribute it and/or modify 10 // it under the terms of the GNU General Public License as published by 11 // the Free Software Foundation; either version 2 of the License, or 12 // (at your option) any later version. 13 // 14 // The algorithms that underlie FastJet have required considerable 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 17 // FastJet as part of work towards a scientific publication, please 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 20 // 21 // FastJet is distributed in the hope that it will be useful, 22 // but WITHOUT ANY WARRANTY; without even the implied warranty of 23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 // GNU General Public License for more details. 25 // 26 // You should have received a copy of the GNU General Public License 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 35 28 //---------------------------------------------------------------------- 36 // ENDHEADER29 //FJENDHEADER 37 30 38 31 // List of changes compared to the original CMS code (revision 1.14 of -
external/fastjet/plugins/CMSIterativeCone/fastjet/CMSIterativeConePlugin.hh
r5b5a56b r35cdc46 1 // STARTHEADER1 //FJSTARTHEADER 2 2 // $Id: CMSIterativeConePlugin.hh 1508 2009-04-10 22:46:49Z soyez $ 3 3 // 4 // Copyright (c) 2007-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __CMSITERATIVECONEPLUGIN_HH__ -
external/fastjet/plugins/D0RunICone/D0RunIBaseConePlugin.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2009-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: D0RunIBaseConePlugin.cc 1779 2010-10-25 10:32:59Z soyez $ 3 // 4 // Copyright (c) 2009-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 // D0 stuff -
external/fastjet/plugins/D0RunICone/fastjet/D0RunIBaseConePlugin.hh
r5b5a56b r35cdc46 2 2 #define __D0RUNIBASECONEPLUGIN_HH__ 3 3 4 // STARTHEADER4 //FJSTARTHEADER 5 5 // $Id: D0RunIBaseConePlugin.hh 1778 2010-10-25 10:02:58Z soyez $ 6 6 // 7 // Copyright (c) 2009-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2009-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include "fastjet/JetDefinition.hh" -
external/fastjet/plugins/D0RunICone/fastjet/D0RunIConePlugin.hh
r5b5a56b r35cdc46 2 2 #define __D0RUNICONEPLUGIN_HH__ 3 3 4 // STARTHEADER4 //FJSTARTHEADER 5 5 // $Id: D0RunIConePlugin.hh 1778 2010-10-25 10:02:58Z soyez $ 6 6 // 7 // Copyright (c) 2009-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2009-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include "D0RunIBaseConePlugin.hh" -
external/fastjet/plugins/D0RunICone/fastjet/D0RunIpre96ConePlugin.hh
r5b5a56b r35cdc46 2 2 #define __D0RUNIPRE96CONEPLUGIN_HH__ 3 3 4 // STARTHEADER4 //FJSTARTHEADER 5 5 // $Id: D0RunIpre96ConePlugin.hh 1778 2010-10-25 10:02:58Z soyez $ 6 6 // 7 // Copyright (c) 2009-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2009-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include "D0RunIBaseConePlugin.hh" -
external/fastjet/plugins/D0RunIICone/D0RunIIConePlugin.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: D0RunIIConePlugin.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/D0RunIIConePlugin.hh" -
external/fastjet/plugins/D0RunIICone/ILConeAlgorithm.hpp
r5b5a56b r35cdc46 49 49 // 50 50 // 2012-06-12 Gregory Soyez <soyez@fastjet.fr> 51 //52 51 // * Replaced addItem(...) by this->addItem(...) to allow 53 52 // compilation with gcc 4.7 which no longer performs -
external/fastjet/plugins/D0RunIICone/fastjet/D0RunIIConePlugin.hh
r5b5a56b r35cdc46 2 2 #define __D0RUNIICONEPLUGIN_HH__ 3 3 4 // STARTHEADER5 // $Id: D0RunIIConePlugin.hh 2761 2011-11-24 13:54:05Z soyez$4 //FJSTARTHEADER 5 // $Id: D0RunIIConePlugin.hh 3433 2014-07-23 08:17:03Z salam $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include "fastjet/JetDefinition.hh" -
external/fastjet/plugins/EECambridge/EECambridgePlugin.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: EECambridgePlugin.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2007-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 // fastjet stuff -
external/fastjet/plugins/EECambridge/fastjet/EECambridgePlugin.hh
r5b5a56b r35cdc46 2 2 #define __EECAMBRIDGEPLUGIN_HH__ 3 3 4 // STARTHEADER5 // $Id: EECambridgePlugin.hh 2692 2011-11-14 16:27:44Z soyez$4 //FJSTARTHEADER 5 // $Id: EECambridgePlugin.hh 3433 2014-07-23 08:17:03Z salam $ 6 6 // 7 // Copyright (c) 200 9, Matteo Cacciari, GavinSalam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 … … 82 84 virtual bool exclusive_sequence_meaningful() const {return true;} 83 85 86 /// returns true because this plugin is intended for spherical 87 /// geometries (i.e. it's an e+e- algorithm). 88 virtual bool is_spherical() const {return true;} 89 84 90 private: 85 91 double _ycut; -
external/fastjet/plugins/GridJet/GridJetPlugin.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 20 11, Matteo Cacciari, GavinSalam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: GridJetPlugin.cc 2268 2011-06-20 15:12:26Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 // fastjet stuff … … 43 45 double requested_grid_spacing, 44 46 const JetDefinition & post_jet_def) : 47 #ifdef FASTJET_GRIDJET_USEFJGRID 48 RectangularGrid(ymax, requested_grid_spacing), _post_jet_def(post_jet_def) { 49 } 50 #else 45 51 _ymin(-ymax), _ymax(ymax), 46 52 _requested_grid_spacing(requested_grid_spacing) , … … 49 55 setup_grid(); 50 56 } 51 57 #endif 58 59 #ifdef FASTJET_GRIDJET_USEFJGRID 60 GridJetPlugin::GridJetPlugin (const RectangularGrid & grid, 61 const JetDefinition & post_jet_def) : 62 RectangularGrid(grid), _post_jet_def(post_jet_def) { 63 if (!RectangularGrid::is_initialised()) 64 throw Error("attempt to construct GridJetPlugin with uninitialised RectangularGrid"); 65 } 66 #endif // FASTJET_GRIDJET_USEFJGRID 67 68 #ifndef FASTJET_GRIDJET_USEFJGRID 52 69 void GridJetPlugin::setup_grid() { 53 70 // since we've exchanged the arguments of the constructor, … … 69 86 } 70 87 71 72 //---------------------------------------------------------------------- 73 string GridJetPlugin::description () const { 74 ostringstream desc; 75 desc << "GridJetPlugin plugin with ymax = " << _ymax << ", dy = " << _dy << ", dphi = " << _dphi << " (requested grid spacing was " << _requested_grid_spacing << ")"; 76 if (_post_jet_def.jet_algorithm() != undefined_jet_algorithm) { 77 desc << ", followed by " << _post_jet_def.description(); 78 } 79 return desc.str(); 80 } 81 82 83 //---------------------------------------------------------------------- 84 double GridJetPlugin::R() const {return sqrt(_dy*_dphi/pi);} 85 86 87 //---------------------------------------------------------------------- 88 int GridJetPlugin::igrid(const PseudoJet & p) const { 88 //---------------------------------------------------------------------- 89 int GridJetPlugin::tile_index(const PseudoJet & p) const { 89 90 // directly taking int does not work for values between -1 and 0 90 91 // so use floor instead … … 108 109 return igrid_res; 109 110 } 111 #endif // not FASTJET_GRIDJET_USEFJGRID 112 113 114 //---------------------------------------------------------------------- 115 string GridJetPlugin::description () const { 116 ostringstream desc; 117 desc << "GridJetPlugin plugin with "; 118 #ifndef FASTJET_GRIDJET_USEFJGRID 119 desc << "ymax = " << _ymax << ", dy = " << _dy << ", dphi = " << _dphi << " (requested grid spacing was " << _requested_grid_spacing << ")"; 120 #else 121 desc << RectangularGrid::description(); 122 #endif 123 if (_post_jet_def.jet_algorithm() != undefined_jet_algorithm) { 124 desc << ", followed by " << _post_jet_def.description(); 125 } 126 return desc.str(); 127 } 128 129 130 //---------------------------------------------------------------------- 131 double GridJetPlugin::R() const {return sqrt(drap()*dphi()/pi);} 110 132 111 133 … … 117 139 // * a number >= 0 will mean that particle indicated by the index 118 140 // is currently the jet on the grid 119 vector<int> grid( _ntotal, -1);141 vector<int> grid(n_tiles(), -1); 120 142 121 143 int nparticles = cs.jets().size(); … … 126 148 // combine particles with whatever is in the grid 127 149 for (int i = 0; i < nparticles; i++) { 128 int igrd = igrid(cs.jets()[i]);150 int igrd = tile_index(cs.jets()[i]); 129 151 //cout << i << " " << cs.jets()[i].rap() << " " << cs.jets()[i].phi() 130 152 // << " " << igrd << " " << grid.size() << " " << _ntotal << endl; 131 153 if (igrd < 0) continue; 132 assert(igrd <= _ntotal);154 assert(igrd <= n_tiles()); 133 155 if (grid[igrd] == -1) { 134 156 grid[igrd] = i; // jet index of initial particle i is i … … 145 167 // make the final jets via iB recombinations 146 168 for (unsigned igrd = 0; igrd < grid.size(); igrd++) { 147 if (grid[igrd] != -1 ) cs.plugin_record_iB_recombination(grid[igrd],148 169 if (grid[igrd] != -1 && tile_is_good(igrd)) 170 cs.plugin_record_iB_recombination(grid[igrd], dij_or_diB); 149 171 } 150 172 } else { -
external/fastjet/plugins/GridJet/fastjet/GridJetPlugin.hh
r5b5a56b r35cdc46 1 #ifndef __ GRIDJETPLUGIN_HH__2 #define __ GRIDJETPLUGIN_HH__1 #ifndef __FASTJET_GRIDJETPLUGIN_HH__ 2 #define __FASTJET_GRIDJETPLUGIN_HH__ 3 3 4 // STARTHEADER4 //FJSTARTHEADER 5 5 // $Id: GridJetPlugin.hh 2267 2011-06-20 15:10:23Z salam $ 6 6 // 7 // Copyright (c) 20 11, Matteo Cacciari, GavinSalam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 33 35 #include "fastjet/JetDefinition.hh" 36 37 // makes it easy to switch back and forth between use of 38 // RectangularGrid or not; this got enabled in FJ3.1 39 #define FASTJET_GRIDJET_USEFJGRID 40 41 #ifdef FASTJET_GRIDJET_USEFJGRID 42 #include "fastjet/RectangularGrid.hh" 43 #endif 34 44 35 45 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh … … 49 59 /// but is rather provided for comparison purposes with the 50 60 /// GridMedianBackgroundEstimator (which is even faster). 51 class GridJetPlugin : public JetDefinition::Plugin { 61 class GridJetPlugin : public JetDefinition::Plugin 62 #ifdef FASTJET_GRIDJET_USEFJGRID 63 , RectangularGrid 64 #endif 65 { 52 66 public: 53 /// Mainconstructor for the GridJetPlugin Plugin class.67 /// Basic constructor for the GridJetPlugin Plugin class. 54 68 /// 55 69 /// \param ymax The maximal rapidity extent of the grid … … 62 76 const JetDefinition & post_jet_def = JetDefinition()); 63 77 64 /// copy constructor 65 GridJetPlugin (const GridJetPlugin & plugin) { 66 *this = plugin; 67 } 78 #ifdef FASTJET_GRIDJET_USEFJGRID 79 /// Constructor for the GridJetPlugin Plugin class that allows 80 /// full control over the underlying grid. New in FastJet 3.1. 81 /// 82 /// \param grid The maximal rapidity extent of the grid 83 /// \param post_jet_def if present, and not == JetDefinition() 84 /// (which has undefined_jet_algorithm), then 85 /// run the post_jet_def on the result of the grid 86 /// clustering. 87 GridJetPlugin (const RectangularGrid & grid, 88 const JetDefinition & post_jet_def = JetDefinition()); 89 #endif // FASTJET_GRIDJET_USEFJGRID 90 91 92 93 // /// copy constructor 94 // GridJetPlugin (const GridJetPlugin & plugin) { 95 // *this = plugin; 96 // } 68 97 69 98 // the things that are required by base class … … 75 104 virtual double R() const; 76 105 106 // As of FastJet 3.1 the following functions become available through 107 // the underlying RectangularGrid class. 108 #ifndef FASTJET_GRIDJET_USEFJGRID 77 109 /// returns the actual rapidity spacing of the grid 78 110 double drap() const {return _dy;} … … 83 115 /// returns the maximum rapidity of the grid 84 116 double rapmax() const {return _ymax;} 117 #endif 85 118 86 119 private: 87 120 121 #ifndef FASTJET_GRIDJET_USEFJGRID 88 122 void setup_grid(); 89 123 90 int igrid(const PseudoJet & p) const; 124 int n_tiles() const {return _ntotal;} 125 int n_good_tiles() const {return _ntotal;} 126 127 int tile_index(const PseudoJet & p) const; 128 bool tile_is_good(int /* itile */) const {return true;} 91 129 92 130 double _ymin, _ymax, _dy, _dphi, _requested_grid_spacing; 93 131 int _ny, _nphi, _ntotal; 132 #endif 94 133 95 134 JetDefinition _post_jet_def; … … 99 138 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh 100 139 101 #endif // __ GRIDJETPLUGIN_HH__140 #endif // __FASTJET_GRIDJETPLUGIN_HH__ 102 141 -
external/fastjet/plugins/Jade/JadePlugin.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: JadePlugin.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2007-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 // fastjet stuff -
external/fastjet/plugins/Jade/fastjet/JadePlugin.hh
r5b5a56b r35cdc46 2 2 #define __JADEPLUGIN_HH__ 3 3 4 // STARTHEADER5 // $Id: JadePlugin.hh 2577 2011-09-13 15:11:38Z salam $4 //FJSTARTHEADER 5 // $Id: JadePlugin.hh 3433 2014-07-23 08:17:03Z salam $ 6 6 // 7 // Copyright (c) 200 9, Matteo Cacciari, GavinSalam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include "fastjet/JetDefinition.hh" -
external/fastjet/plugins/NestedDefs/NestedDefsPlugin.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: NestedDefsPlugin.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2007-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 // TODO -
external/fastjet/plugins/NestedDefs/fastjet/NestedDefsPlugin.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: NestedDefsPlugin.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: NestedDefsPlugin.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2007-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __NESTEDALGSPLUGIN_HH__ -
external/fastjet/plugins/SISCone/SISConePlugin.cc
r5b5a56b r35cdc46 207 207 208 208 // give the extras object to the cluster sequence. 209 clust_seq.plugin_associate_extras(std::auto_ptr<ClusterSequence::Extras>(extras)); 209 // 210 // As of v3.1 of FastJet, extras are automatically owned (as 211 // SharedPtr) by the ClusterSequence and auto_ptr is deprecated. So 212 // we can use a simple pointer here 213 //clust_seq.plugin_associate_extras(std::auto_ptr<ClusterSequence::Extras>(extras)); 214 clust_seq.plugin_associate_extras(extras); 210 215 } 211 216 -
external/fastjet/plugins/SISCone/area.cc
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 149 $// 25 // $Date:: 2007-03-15 00:13:58 +0100 (Thu, 15 Mar 2007) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/area.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 149 $// 25 // $Date:: 2007-03-15 00:13:58 +0100 (Thu, 15 Mar 2007) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/circulator.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 103 $// 25 // $Date:: 2007-02-18 17:07:34 +0100 (Sun, 18 Feb 2007) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/config.h
r5b5a56b r35cdc46 54 54 #define PACKAGE_TARNAME "siscone" 55 55 56 /* Define to the home page for this package. */57 /* #undef PACKAGE_URL */58 59 56 /* Define to the version of this package. */ 60 57 #define PACKAGE_VERSION "2.0.6" -
external/fastjet/plugins/SISCone/defines.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 225 $// 25 // $Date:: 2008-05-20 16:59:47 +0200 (Tue, 20 May 2008) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/fastjet/SISConeSphericalPlugin.hh
r5b5a56b r35cdc46 152 152 virtual void run_clustering(ClusterSequence &) const ; 153 153 154 /// returns true because this plugin is intended for spherical 155 /// geometries (i.e. it's an e+e- algorithm). 156 virtual bool is_spherical() const {return true;} 157 154 158 protected: 155 159 virtual void reset_stored_plugin() const; -
external/fastjet/plugins/SISCone/geom_2d.cc
r5b5a56b r35cdc46 21 21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 22 22 // // 23 // $Revision:: 24 // $Date:: 23 // $Revision:: 171 $// 24 // $Date:: 2007-06-19 16:26:05 +0200 (Tue, 19 Jun 2007) $// 25 25 /////////////////////////////////////////////////////////////////////////////// 26 26 -
external/fastjet/plugins/SISCone/geom_2d.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 268 $// 25 // $Date:: 2009-03-12 21:24:16 +0100 (Thu, 12 Mar 2009) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/hash.cc
r5b5a56b r35cdc46 21 21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 22 22 // // 23 // $Revision:: 24 // $Date:: 23 // $Revision:: 225 $// 24 // $Date:: 2008-05-20 16:59:47 +0200 (Tue, 20 May 2008) $// 25 25 /////////////////////////////////////////////////////////////////////////////// 26 26 -
external/fastjet/plugins/SISCone/hash.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 224 $// 25 // $Date:: 2008-05-16 19:58:30 +0200 (Fri, 16 May 2008) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/momentum.cc
r5b5a56b r35cdc46 21 21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 22 22 // // 23 // $Revision:: 24 // $Date:: 23 // $Revision:: 123 $// 24 // $Date:: 2007-03-01 02:52:16 +0100 (Thu, 01 Mar 2007) $// 25 25 /////////////////////////////////////////////////////////////////////////////// 26 26 -
external/fastjet/plugins/SISCone/momentum.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 163 $// 25 // $Date:: 2007-04-26 22:31:02 +0200 (Thu, 26 Apr 2007) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/protocones.cc
r5b5a56b r35cdc46 21 21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 22 22 // // 23 // $Revision:: 24 // $Date:: 23 // $Revision:: 322 $// 24 // $Date:: 2011-11-15 10:12:36 +0100 (Tue, 15 Nov 2011) $// 25 25 /////////////////////////////////////////////////////////////////////////////// 26 26 -
external/fastjet/plugins/SISCone/protocones.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 224 $// 25 // $Date:: 2008-05-16 19:58:30 +0200 (Fri, 16 May 2008) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/quadtree.cc
r5b5a56b r35cdc46 21 21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 22 22 // // 23 // $Revision:: 24 // $Date:: 23 // $Revision:: 320 $// 24 // $Date:: 2011-11-15 09:54:50 +0100 (Tue, 15 Nov 2011) $// 25 25 /////////////////////////////////////////////////////////////////////////////// 26 26 -
external/fastjet/plugins/SISCone/quadtree.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 123 $// 25 // $Date:: 2007-03-01 02:52:16 +0100 (Thu, 01 Mar 2007) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/reference.cc
r5b5a56b r35cdc46 21 21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 22 22 // // 23 // $Revision:: 24 // $Date:: 23 // $Revision:: 311 $// 24 // $Date:: 2011-10-05 23:27:09 +0200 (Wed, 05 Oct 2011) $// 25 25 /////////////////////////////////////////////////////////////////////////////// 26 26 -
external/fastjet/plugins/SISCone/reference.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 123 $// 25 // $Date:: 2007-03-01 02:52:16 +0100 (Thu, 01 Mar 2007) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/siscone.cc
r5b5a56b r35cdc46 21 21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 22 22 // // 23 // $Revision:: 24 // $Date:: 23 // $Revision:: 341 $// 24 // $Date:: 2013-04-08 12:21:06 +0200 (Mon, 08 Apr 2013) $// 25 25 /////////////////////////////////////////////////////////////////////////////// 26 26 -
external/fastjet/plugins/SISCone/siscone.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 325 $// 25 // $Date:: 2011-11-25 12:41:17 +0100 (Fri, 25 Nov 2011) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/siscone_error.cc
r5b5a56b r35cdc46 21 21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 22 22 // // 23 // $Revision:: 24 // $Date:: 23 // $Revision:: 123 $// 24 // $Date:: 2007-03-01 02:52:16 +0100 (Thu, 01 Mar 2007) $// 25 25 /////////////////////////////////////////////////////////////////////////////// 26 26 -
external/fastjet/plugins/SISCone/siscone_error.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 327 $// 25 // $Date:: 2011-11-25 15:19:39 +0100 (Fri, 25 Nov 2011) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/split_merge.cc
r5b5a56b r35cdc46 21 21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 22 22 // // 23 // $Revision:: 24 // $Date:: 23 // $Revision:: 322 $// 24 // $Date:: 2011-11-15 10:12:36 +0100 (Tue, 15 Nov 2011) $// 25 25 /////////////////////////////////////////////////////////////////////////////// 26 26 -
external/fastjet/plugins/SISCone/split_merge.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 268 $// 25 // $Date:: 2009-03-12 21:24:16 +0100 (Thu, 12 Mar 2009) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/SISCone/vicinity.cc
r5b5a56b r35cdc46 21 21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 22 22 // // 23 // $Revision:: 24 // $Date:: 23 // $Revision:: 123 $// 24 // $Date:: 2007-03-01 02:52:16 +0100 (Thu, 01 Mar 2007) $// 25 25 /////////////////////////////////////////////////////////////////////////////// 26 26 -
external/fastjet/plugins/SISCone/vicinity.h
r5b5a56b r35cdc46 22 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 23 23 // // 24 // $Revision:: 25 // $Date:: 24 // $Revision:: 123 $// 25 // $Date:: 2007-03-01 02:52:16 +0100 (Thu, 01 Mar 2007) $// 26 26 /////////////////////////////////////////////////////////////////////////////// 27 27 -
external/fastjet/plugins/TrackJet/TrackJetPlugin.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2007-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: TrackJetPlugin.cc 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- 7 // This file is part of FastJet. It contains code that has been 8 // obtained from the Rivet project by Leif Lonnblad, Andy Buckley and 9 // Jon Butterworth. See http://www.hepforge.org/downloads/rivet. 10 // Rivet is free software released under the terms of the GNU Public 11 // License(v2). 12 // Changes from the original file are listed below. 7 // This file is part of FastJet. 13 8 // 14 9 // FastJet is free software; you can redistribute it and/or modify … … 18 13 // 19 14 // The algorithms that underlie FastJet have required considerable 20 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 21 17 // FastJet as part of work towards a scientific publication, please 22 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 23 20 // 24 21 // FastJet is distributed in the hope that it will be useful, … … 30 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 31 28 //---------------------------------------------------------------------- 32 // ENDHEADER29 //FJENDHEADER 33 30 34 31 // History of changes from the original TrackJet.cc file in Rivet <=1.1.2 -
external/fastjet/plugins/TrackJet/fastjet/TrackJetPlugin.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: TrackJetPlugin.hh 2758 2011-11-24 08:31:58Z soyez$1 //FJSTARTHEADER 2 // $Id: TrackJetPlugin.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2007-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __TRACKJETPLUGIN_HH__ -
external/fastjet/tools/BackgroundEstimatorBase.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: BackgroundEstimatorBase.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/tools/BackgroundEstimatorBase.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_BACKGROUND_ESTIMATOR_BASE_HH__ 3 3 4 // STARTHEADER5 // $Id: BackgroundEstimatorBase.hh 2689 2011-11-14 14:51:06Z soyez$6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: BackgroundEstimatorBase.hh 3516 2014-08-01 14:07:58Z salam $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/ClusterSequenceAreaBase.hh> … … 43 45 /// 44 46 /// Abstract base class that provides the basic interface for classes 45 /// that estimate levels of background radiation in hadr ion and47 /// that estimate levels of background radiation in hadron and 46 48 /// heavy-ion collider events. 47 ///48 49 /// 49 50 class BackgroundEstimatorBase { … … 99 100 /// determination of sigma 100 101 virtual bool has_sigma() {return false;} 101 //\} 102 102 103 //---------------------------------------------------------------- 104 // now do the same thing for rho_m and sigma_m 105 106 /// returns rho_m, the purely longitudinal, particle-mass-induced 107 /// component of the background density per unit area 108 virtual double rho_m() const{ 109 throw Error("rho_m() not supported for this Background Estimator"); 110 } 111 112 /// returns sigma_m, a measure of the fluctuations in the purely 113 /// longitudinal, particle-mass-induced component of the background 114 /// density per unit area; must be multipled by sqrt(area) to get 115 /// fluctuations for a region of a given area. 116 virtual double sigma_m() const { 117 throw Error("sigma_m() not supported for this Background Estimator"); 118 } 119 120 /// Returns rho_m locally at the jet position. As for rho(jet), it is non-const. 121 virtual double rho_m(const PseudoJet & /*jet*/){ 122 throw Error("rho_m(jet) not supported for this Background Estimator"); 123 } 124 125 /// Returns sigma_m locally at the jet position. As for rho(jet), it is non-const. 126 virtual double sigma_m(const PseudoJet & /*jet*/) { 127 throw Error("sigma_m(jet) not supported for this Background Estimator"); 128 } 129 130 /// Returns true if this background estimator has support for 131 /// determination of rho_m. 132 /// 133 /// Note that support for sigma_m is automatic is one has sigma and 134 /// rho_m support. 135 virtual bool has_rho_m() const {return false;} 136 //\} 137 103 138 104 139 /// @name configuring the behaviour … … 114 149 /// The BackgroundRescalingYPolynomial class can be used to get a 115 150 /// rescaling that depends just on rapidity. 151 /// 152 /// There is currently no support for different rescaling classes 153 /// for rho and rho_m determinations. 116 154 virtual void set_rescaling_class(const FunctionOfPseudoJet<double> * rescaling_class_in) { _rescaling_class = rescaling_class_in; } 117 155 -
external/fastjet/tools/Boost.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: Boost.hh 2689 2011-11-14 14:51:06Z soyez$1 //FJSTARTHEADER 2 // $Id: Boost.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_TOOL_BOOST_HH__ -
external/fastjet/tools/CASubJetTagger.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: CASubJetTagger.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/tools/CASubJetTagger.hh> -
external/fastjet/tools/CASubJetTagger.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: CASubJetTagger.hh 2616 2011-09-30 18:03:40Z salam $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: CASubJetTagger.hh 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __CASUBJET_TAGGER_HH__ -
external/fastjet/tools/Filter.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: Filter.cc 3633 2014-08-15 13:23:52Z soyez $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/tools/Filter.hh" 32 #include "fastjet/tools/Recluster.hh" 30 33 #include <fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh> 31 34 #include <cassert> … … 45 48 // class description 46 49 string Filter::description() const { 50 if (!_initialised){ 51 return "uninitialised Filter"; 52 } 53 47 54 ostringstream ostr; 48 55 ostr << "Filter with subjet_def = "; … … 73 80 // by the filtering 74 81 PseudoJet Filter::result(const PseudoJet &jet) const { 82 if (!_initialised){ 83 //Q: do we throw or do we return an empty PJ? 84 throw Error("uninitialised Filter"); 85 } 86 75 87 // start by getting the list of subjets (including a list of sanity 76 88 // checks) … … 78 90 // _set_filtered_elements_cafilt) 79 91 vector<PseudoJet> subjets; 80 JetDefinition subjet_def; 81 bool discard_area; 82 // NB: on return, subjet_def is set to the jet definition actually 83 // used (so that we can make use of its recombination scheme 84 // when joining the jets to be kept). 85 _set_filtered_elements(jet, subjets, subjet_def, discard_area); 92 //JetDefinition subjet_def; 93 bool ca_optimised = _set_filtered_elements(jet, subjets); 94 95 // apply subtraction if needed: 96 if (_subtractor){ 97 subjets = (*_subtractor)(subjets); 98 } else if (_rho!=0){ 99 if (subjets.size()>0){ 100 const ClusterSequenceAreaBase *csab = subjets[0].validated_csab(); 101 for (unsigned int i=0;i<subjets.size();i++){ 102 subjets[i]=csab->subtracted_jet(subjets[i], _rho); 103 } 104 } 105 } 86 106 87 107 // now build the vector of kept and rejected subjets … … 94 114 95 115 // gather the info under the form of a PseudoJet 96 return _finalise(jet, kept, rejected, subjet_def, discard_area);116 return _finalise(jet, kept, rejected, ca_optimised); 97 117 } 98 118 99 119 100 120 // sets filtered_elements to be all the subjets on which filtering will work 101 void Filter::_set_filtered_elements(const PseudoJet & jet, 102 vector<PseudoJet> & filtered_elements, 103 JetDefinition & subjet_def, 104 bool & discard_area) const { 105 // sanity checks 106 //------------------------------------------------------------------- 107 // make sure that the jet has constituents 108 if (! jet.has_constituents()) 109 throw Error("Filter can only be applied on jets having constituents"); 121 // 122 // return true when the subjets have been optained using teh optimised 123 // method for C/A 124 bool Filter::_set_filtered_elements(const PseudoJet & jet, 125 vector<PseudoJet> & filtered_elements) const { 126 // create the recluster instance 127 Recluster recluster; 128 if ((_Rfilt>=0) || (_Rfiltfunc)) 129 recluster = Recluster(cambridge_algorithm, (_Rfiltfunc) ? (*_Rfiltfunc)(jet) : _Rfilt, Recluster::keep_all); 130 else 131 recluster = Recluster(_subjet_def, false, Recluster::keep_all); 110 132 111 // for a whole variety of checks, we shall need the "recursive" 112 // pieces of the jet (the jet itself or recursing down to its most 113 // fundamental pieces). 114 // So we do compute these once and for all 115 vector<PseudoJet> all_pieces; //.clear(); 116 if ((!_get_all_pieces(jet, all_pieces)) || (all_pieces.size()==0)) 117 throw Error("Attempt to filter a jet that has no associated ClusterSequence or is not a superposition of jets associated with a ClusterSequence"); 118 119 // if the filter uses subtraction, make sure we have a CS that supports area and has 120 // explicit ghosts 121 if (_uses_subtraction()) { 122 if (!jet.has_area()) 123 throw Error("Attempt to filter and subtract (non-zero rho or subtractor) without area info for the original jet"); 124 125 if (!_check_explicit_ghosts(all_pieces)) 126 throw Error("Attempt to filter and subtract (non-zero rho or subtractor) without explicit ghosts"); 127 } 128 129 // if we're dealing with a dynamic determination of the filtering 130 // radius, do it now 131 if ((_Rfilt>=0) || (_Rfiltfunc)){ 132 double Rfilt = (_Rfiltfunc) ? (*_Rfiltfunc)(jet) : _Rfilt; 133 const JetDefinition::Recombiner * common_recombiner = _get_common_recombiner(all_pieces); 134 if (common_recombiner) { 135 if (typeid(*common_recombiner) == typeid(JetDefinition::DefaultRecombiner)) { 136 RecombinationScheme scheme = 137 static_cast<const JetDefinition::DefaultRecombiner *>(common_recombiner)->scheme(); 138 subjet_def = JetDefinition(cambridge_algorithm, Rfilt, scheme); 139 } else { 140 subjet_def = JetDefinition(cambridge_algorithm, Rfilt, common_recombiner); 141 } 142 } else { 143 subjet_def = JetDefinition(cambridge_algorithm, Rfilt); 144 } 145 } else { 146 subjet_def = _subjet_def; 147 } 148 149 // get the jet definition to be use and whether we can apply our 150 // simplified C/A+C/A filter 151 // 152 // we apply C/A clustering iff 153 // - the request subjet_def is C/A 154 // - the jet is either directly coming from C/A or if it is a 155 // superposition of C/A jets 156 // - the pieces agree with the recombination scheme of subjet_def 157 //------------------------------------------------------------------ 158 bool simple_cafilt = _check_ca(all_pieces); 159 160 // extract the subjets 161 //------------------------------------------------------------------- 162 discard_area = false; 163 if (simple_cafilt){ 164 // first make sure that 'filtered_elements' is empty 165 filtered_elements.clear(); 166 _set_filtered_elements_cafilt(jet, filtered_elements, subjet_def.R()); 167 // in the following case, areas can be erroneous and will be discarded 168 discard_area = (!_uses_subtraction()) && (jet.has_area()) && (!_check_explicit_ghosts(all_pieces)); 169 } else { 170 // here we'll simply recluster the jets. 171 // 172 // To include an area support we need 173 // - the jet to have an area 174 // - subtraction requested or explicit ghosts 175 bool do_areas = (jet.has_area()) && ((_uses_subtraction()) || (_check_explicit_ghosts(all_pieces))); 176 _set_filtered_elements_generic(jet, filtered_elements, subjet_def, do_areas); 177 } 178 179 // order the filtered elements in pt 180 filtered_elements = sorted_by_pt(filtered_elements); 133 // get the subjets 134 //JetDefinition subjet_def; 135 return recluster.get_new_jets_and_def(jet, filtered_elements); 181 136 } 182 183 // set the filtered elements in the simple case of C/A+C/A184 //185 // WATCH OUT: this could be recursively called, so filtered elements186 // of 'jet' are APPENDED to 'filtered_elements'187 void Filter::_set_filtered_elements_cafilt(const PseudoJet & jet,188 vector<PseudoJet> & filtered_elements,189 double Rfilt) const{190 // we know that the jet is either a C/A jet or a superposition of191 // such pieces192 if (jet.has_associated_cluster_sequence()){193 // just extract the exclusive subjets of 'jet'194 const ClusterSequence *cs = jet.associated_cluster_sequence();195 vector<PseudoJet> local_fe;196 197 double dcut = Rfilt / cs->jet_def().R();198 if (dcut>=1.0){199 local_fe.push_back(jet);200 } else {201 dcut *= dcut;202 local_fe = jet.exclusive_subjets(dcut);203 }204 205 // subtract the jets if needed206 // Note that this one would work on pieces!!207 //-----------------------------------------------------------------208 if (_uses_subtraction()){209 const ClusterSequenceAreaBase * csab = jet.validated_csab();210 for (unsigned int i=0;i<local_fe.size();i++) {211 if (_subtractor) {212 local_fe[i] = (*_subtractor)(local_fe[i]);213 } else {214 local_fe[i] = csab->subtracted_jet(local_fe[i], _rho);215 }216 }217 }218 219 copy(local_fe.begin(), local_fe.end(), back_inserter(filtered_elements));220 return;221 }222 223 // just recurse into the pieces224 const vector<PseudoJet> & pieces = jet.pieces();225 for (vector<PseudoJet>::const_iterator it = pieces.begin();226 it!=pieces.end(); it++)227 _set_filtered_elements_cafilt(*it, filtered_elements, Rfilt);228 }229 230 231 // set the filtered elements in the generic re-clustering case (wo232 // subtraction)233 void Filter::_set_filtered_elements_generic(const PseudoJet & jet,234 vector<PseudoJet> & filtered_elements,235 const JetDefinition & subjet_def,236 bool do_areas) const{237 // create a new, internal, ClusterSequence from the jet constituents238 // get the subjets directly from there239 //240 // If the jet has area support then we separate the ghosts from the241 // "regular" particles so the subjets will also have area242 // support. Note that we do this regardless of whether rho is zero243 // or not.244 //245 // Note that to be able to separate the ghosts, one needs explicit246 // ghosts!!247 // ---------------------------------------------------------------248 if (do_areas){249 vector<PseudoJet> all_constituents = jet.constituents();250 vector<PseudoJet> regular_constituents, ghosts;251 252 for (vector<PseudoJet>::iterator it = all_constituents.begin();253 it != all_constituents.end(); it++){254 if (it->is_pure_ghost())255 ghosts.push_back(*it);256 else257 regular_constituents.push_back(*it);258 }259 260 // figure out the ghost area from the 1st ghost (if none, any value261 // would probably do as the area will be 0 and subtraction will have262 // no effect!)263 double ghost_area = (ghosts.size()) ? ghosts[0].area() : 0.01;264 ClusterSequenceActiveAreaExplicitGhosts * csa265 = new ClusterSequenceActiveAreaExplicitGhosts(regular_constituents,266 subjet_def,267 ghosts, ghost_area);268 269 // get the subjets: we use the subtracted or unsubtracted ones270 // depending on rho or _subtractor being non-zero271 if (_uses_subtraction()) {272 if (_subtractor) {273 filtered_elements = (*_subtractor)(csa->inclusive_jets());274 } else {275 filtered_elements = csa->subtracted_jets(_rho);276 }277 } else {278 filtered_elements = csa->inclusive_jets();279 }280 281 // allow the cs to be deleted when it's no longer used282 csa->delete_self_when_unused();283 } else {284 ClusterSequence * cs = new ClusterSequence(jet.constituents(), subjet_def);285 filtered_elements = cs->inclusive_jets();286 // allow the cs to be deleted when it's no longer used287 cs->delete_self_when_unused();288 }289 }290 291 137 292 138 // gather the information about what is kept and rejected under the … … 295 141 vector<PseudoJet> & kept, 296 142 vector<PseudoJet> & rejected, 297 const JetDefinition & subjet_def, 298 const bool discard_area) const { 299 // figure out which recombiner to use 300 const JetDefinition::Recombiner &rec = *(subjet_def.recombiner()); 143 bool ca_optimisation_used) const { 144 PseudoJet filtered_jet; 301 145 302 // create an appropriate structure and transfer the info to it 303 PseudoJet filtered_jet = join<StructureType>(kept, rec); 146 if (kept.size()+rejected.size()>0){ 147 // figure out which recombiner to use 148 const JetDefinition::Recombiner &rec = (kept.size()>0) 149 ? *(kept[0].associated_cs()->jet_def().recombiner()) 150 : *(rejected[0].associated_cs()->jet_def().recombiner()); 151 152 // create an appropriate structure and transfer the info to it 153 filtered_jet = join<StructureType>(kept, rec); 154 } else { 155 filtered_jet = join<StructureType>(kept); 156 } 304 157 StructureType *fs = (StructureType*) filtered_jet.structure_non_const_ptr(); 305 // fs->_original_jet = jet;306 158 fs->_rejected = rejected; 159 160 // if we've used C/A optimisation, we need to get rid of the area 161 // information if it comes from a non-explicit-ghost clustering. 162 // (because in that case it can be erroneous due the lack of 163 // information about empty areas) 164 if ((ca_optimisation_used) && (kept.size()+rejected.size()>0)){ 165 bool has_non_explicit_ghost_area = (kept.size()>0) 166 ? (kept[0].has_area() && kept[0].validated_csab()->has_explicit_ghosts()) 167 : (rejected[0].has_area() && rejected[0].validated_csab()->has_explicit_ghosts()); 168 if (has_non_explicit_ghost_area) 169 fs->discard_area(); 170 } 307 171 308 if (discard_area){309 // safety check: make sure there is an area to discard!!!310 assert(fs->_area_4vector_ptr);311 delete fs->_area_4vector_ptr;312 fs->_area_4vector_ptr=0;313 }314 315 172 return filtered_jet; 316 173 } 317 174 318 // various checks319 //----------------------------------------------------------------------320 321 // get the pieces down to the fundamental pieces322 //323 // Note that this just checks that there is an associated CS to the324 // fundamental pieces, not that it is still valid325 bool Filter::_get_all_pieces(const PseudoJet &jet, vector<PseudoJet> &all_pieces) const{326 if (jet.has_associated_cluster_sequence()){327 all_pieces.push_back(jet);328 return true;329 }330 331 if (jet.has_pieces()){332 const vector<PseudoJet> pieces = jet.pieces();333 for (vector<PseudoJet>::const_iterator it=pieces.begin(); it!=pieces.end(); it++)334 if (!_get_all_pieces(*it, all_pieces)) return false;335 return true;336 }337 338 return false;339 }340 341 // get the common recombiner to all pieces (NULL if none)342 //343 // Note that if the jet has an associated cluster sequence that is no344 // longer valid, an error will be thrown (needed since it could be the345 // 1st check called after the enumeration of the pieces)346 const JetDefinition::Recombiner* Filter::_get_common_recombiner(const vector<PseudoJet> &all_pieces) const{347 const JetDefinition & jd_ref = all_pieces[0].validated_cs()->jet_def();348 for (unsigned int i=1; i<all_pieces.size(); i++)349 if (!all_pieces[i].validated_cs()->jet_def().has_same_recombiner(jd_ref)) return NULL;350 351 return jd_ref.recombiner();352 }353 354 // check if the jet (or all its pieces) have explicit ghosts355 // (assuming the jet has area support356 //357 // Note that if the jet has an associated cluster sequence that is no358 // longer valid, an error will be thrown (needed since it could be the359 // 1st check called after the enumeration of the pieces)360 bool Filter::_check_explicit_ghosts(const vector<PseudoJet> &all_pieces) const{361 for (vector<PseudoJet>::const_iterator it=all_pieces.begin(); it!=all_pieces.end(); it++)362 if (! it->validated_csab()->has_explicit_ghosts()) return false;363 return true;364 }365 366 // check if one can apply the simplification for C/A subjets367 //368 // This includes:369 // - the subjet definition asks for C/A subjets370 // - all the pieces share the same CS371 // - that CS is C/A with the same recombiner as the subjet def372 // - the filtering radius is not larger than any of the pairwise373 // distance between the pieces374 //375 // Note that if the jet has an associated cluster sequence that is no376 // longer valid, an error will be thrown (needed since it could be the377 // 1st check called after the enumeration of the pieces)378 bool Filter::_check_ca(const vector<PseudoJet> &all_pieces) const{379 if (_subjet_def.jet_algorithm() != cambridge_algorithm) return false;380 381 // check that the 1st of all the pieces (we're sure there is at382 // least one) is coming from a C/A clustering. Then check that all383 // the following pieces share the same ClusterSequence384 const ClusterSequence * cs_ref = all_pieces[0].validated_cs();385 if (cs_ref->jet_def().jet_algorithm() != cambridge_algorithm) return false;386 for (unsigned int i=1; i<all_pieces.size(); i++)387 if (all_pieces[i].validated_cs() != cs_ref) return false;388 389 // check that the 1st peice has the same recombiner as the one used390 // for the subjet clustering391 // Note that since they share the same CS, checking the 2st one is enough392 if (!cs_ref->jet_def().has_same_recombiner(_subjet_def)) return false;393 394 // we also have to make sure that the filtering radius is not larger395 // than any of the inter-pieces distance396 double Rfilt2 = _subjet_def.R();397 Rfilt2 *= Rfilt2;398 for (unsigned int i=0; i<all_pieces.size()-1; i++){399 for (unsigned int j=i+1; j<all_pieces.size(); j++){400 if (all_pieces[i].squared_distance(all_pieces[j]) < Rfilt2) return false;401 }402 }403 404 return true;405 }406 407 //----------------------------------------------------------------------408 // FilterInterface implementation409 //----------------------------------------------------------------------410 411 175 412 176 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh -
external/fastjet/tools/Filter.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_TOOLS_FILTER_HH__ 3 3 4 // STARTHEADER5 // $Id: Filter.hh 2694 2011-11-14 22:27:51Z salam$6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: Filter.hh 3494 2014-07-30 20:38:48Z soyez $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/ClusterSequence.hh> … … 98 100 /// Note: this is just for derived classes 99 101 /// a Filter initialised through this constructor will not work! 100 Filter() : _Rfiltfunc(0) {};102 Filter() : _Rfiltfunc(0), _initialised(false){}; 101 103 102 104 /// define a filter that decomposes a jet into subjets using a … … 113 115 /// ghosts 114 116 Filter(JetDefinition subjet_def, Selector selector, double rho = 0.0) : 115 _subjet_def(subjet_def), _Rfiltfunc(0), _Rfilt(-1), _selector(selector), _rho(rho), _subtractor(0) {}117 _subjet_def(subjet_def), _Rfiltfunc(0), _Rfilt(-1), _selector(selector), _rho(rho), _subtractor(0), _initialised(true) {} 116 118 117 119 /// Same as the full constructor (see above) but just specifying the radius … … 121 123 /// \param Rfilt the filtering radius 122 124 Filter(double Rfilt, Selector selector, double rho = 0.0) : 123 _Rfiltfunc(0), _Rfilt(Rfilt), _selector(selector), _rho(rho), _subtractor(0) {125 _Rfiltfunc(0), _Rfilt(Rfilt), _selector(selector), _rho(rho), _subtractor(0), _initialised(true) { 124 126 if (_Rfilt<0) 125 127 throw Error("Attempt to create a Filter with a negative filtering radius"); … … 133 135 /// \param Rfilt_func the filtering radius function of a PseudoJet 134 136 Filter(FunctionOfPseudoJet<double> *Rfilt_func, Selector selector, double rho = 0.0) : 135 _Rfiltfunc(Rfilt_func), _Rfilt(-1), _selector(selector), _rho(rho), _subtractor(0) {}137 _Rfiltfunc(Rfilt_func), _Rfilt(-1), _selector(selector), _rho(rho), _subtractor(0), _initialised(true) {} 136 138 137 139 /// default dtor … … 140 142 /// Set a subtractor that is applied to all individual subjets before 141 143 /// deciding which ones to keep. It takes precedence over a non-zero rho. 142 void set_subtractor(const Transformer* subtractor) {_subtractor = subtractor;}144 void set_subtractor(const FunctionOfPseudoJet<PseudoJet> * subtractor) {_subtractor = subtractor;} 143 145 144 146 /// runs the filtering and sets kept and rejected to be the jets of interest … … 159 161 /// It also sets the subjet_def to be used in joining things (the bit of 160 162 /// subjet def that is of interest for later is the recombiner). 161 void _set_filtered_elements(const PseudoJet & jet,162 std::vector<PseudoJet> & filtered_elements,163 JetDefinition & subjet_def,164 bool & discard_area) const;163 /// 164 /// this returns true if teh optimisation trick for C/A reclustering has been used 165 bool _set_filtered_elements(const PseudoJet & jet, 166 std::vector<PseudoJet> & filtered_elements) const; 165 167 166 /// set the filtered elements in the simple case of C/A+C/A167 void _set_filtered_elements_cafilt(const PseudoJet & jet,168 std::vector<PseudoJet> & filtered_elements,169 double Rfilt) const;170 171 /// set the filtered elements in the generic re-clustering case172 void _set_filtered_elements_generic(const PseudoJet & jet,173 std::vector<PseudoJet> & filtered_elements,174 const JetDefinition & subjet_def,175 bool do_areas) const;176 177 168 /// gather the information about what is kept and rejected under the 178 169 /// form of a PseudoJet with a special ClusterSequenceInfo 170 /// 171 /// The last argument (ca_optimisation_used) should be true if the 172 /// optimisation trick for C/A reclustering has been used (in which 173 /// case some extra tests have to be run for non-explicit-ghost 174 /// areas) 179 175 PseudoJet _finalise(const PseudoJet & jet, 180 176 std::vector<PseudoJet> & kept, 181 177 std::vector<PseudoJet> & rejected, 182 const JetDefinition & subjet_def, 183 const bool discard_area) const; 184 185 // a series of checks 186 //-------------------------------------------------------------------- 187 /// get the pieces down to the fundamental pieces 188 bool _get_all_pieces(const PseudoJet &jet, std::vector<PseudoJet> &all_pieces) const; 189 190 /// get the common recombiner to all pieces (NULL if none) 191 const JetDefinition::Recombiner* _get_common_recombiner(const std::vector<PseudoJet> &all_pieces) const; 192 193 /// check if one can apply the simplified trick for C/A subjets 194 bool _check_ca(const std::vector<PseudoJet> &all_pieces) const; 195 196 /// check if the jet (or all its pieces) have explicit ghosts 197 /// (assuming the jet has area support 198 /// 199 /// Note that if the jet has an associated cluster sequence that is no 200 /// longer valid, an error will be thrown 201 bool _check_explicit_ghosts(const std::vector<PseudoJet> &all_pieces) const; 178 bool ca_optimisation_used) const; 202 179 203 180 bool _uses_subtraction() const {return (_subtractor || _rho != 0);} … … 209 186 Selector _selector; ///< the subjet selection criterium 210 187 double _rho; ///< the background density (used for subtraction when possible) 211 const Transformer * _subtractor; ///< for subtracting bkgd density from subjets 188 const FunctionOfPseudoJet<PseudoJet> * _subtractor; ///< for subtracting bkgd density from subjets 189 190 bool _initialised; ///< true when the Filter has been properly intialised 212 191 }; 213 192 -
external/fastjet/tools/GridMedianBackgroundEstimator.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: GridMedianBackgroundEstimator.cc 3555 2014-08-11 09:56:35Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 32 34 33 35 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 36 34 37 35 38 //---------------------------------------------------------------------- … … 39 42 // of the specified particles. 40 43 void GridMedianBackgroundEstimator::set_particles(const vector<PseudoJet> & particles) { 41 fill(_scalar_pt.begin(), _scalar_pt.end(), 0.0); 42 for (unsigned i = 0; i < particles.size(); i++) { 43 int j = igrid(particles[i]); 44 if (j >= 0){ 45 if (_rescaling_class == 0) 46 _scalar_pt[j] += particles[i].perp(); 47 else 48 _scalar_pt[j] += particles[i].perp()/(*_rescaling_class)(particles[i]); 44 vector<double> scalar_pt(n_tiles(), 0.0); 45 46 #ifdef FASTJET_GMBGE_USEFJGRID 47 assert(all_tiles_equal_area()); 48 //assert(n_good_tiles() == n_tiles()); // not needed now that we have an implementation 49 #endif 50 51 // check if we need to compute only rho or both rho and rho_m 52 if (_enable_rho_m){ 53 // both rho and rho_m 54 // 55 // this requires a few other variables 56 vector<double> scalar_dt(n_tiles(), 0.0); 57 double pt, dt; 58 for (unsigned i = 0; i < particles.size(); i++) { 59 int j = tile_index(particles[i]); 60 if (j >= 0){ 61 pt = particles[i].pt(); 62 dt = particles[i].mt() - pt; 63 if (_rescaling_class == 0){ 64 scalar_pt[j] += pt; 65 scalar_dt[j] += dt; 66 } else { 67 double r = (*_rescaling_class)(particles[i]); 68 scalar_pt[j] += pt/r; 69 scalar_dt[j] += dt/r; 70 } 71 } 72 } 73 // sort things for _percentile 74 sort(scalar_dt.begin(), scalar_dt.end()); 75 76 // compute rho_m and sigma_m (see comment below for the 77 // normaliosation of sigma) 78 double p50 = _percentile(scalar_dt, 0.5); 79 _rho_m = p50 / mean_tile_area(); 80 _sigma_m = (p50-_percentile(scalar_dt, (1.0-0.6827)/2.0))/sqrt(mean_tile_area()); 81 } else { 82 // only rho 83 //fill(_scalar_pt.begin(), _scalar_pt.end(), 0.0); 84 for (unsigned i = 0; i < particles.size(); i++) { 85 int j = tile_index(particles[i]); 86 if (j >= 0){ 87 if (_rescaling_class == 0){ 88 scalar_pt[j] += particles[i].pt(); 89 } else { 90 scalar_pt[j] += particles[i].pt()/(*_rescaling_class)(particles[i]); 91 } 92 } 49 93 } 50 94 } 51 sort(_scalar_pt.begin(), _scalar_pt.end()); 95 96 // if there are some "bad" tiles, then we need to exclude them from 97 // the calculation of the median. We'll do this by condensing the 98 // scalar_pt vector down to just the values for the tiles that are 99 // good. 100 // 101 // tested answers look right in "issue" 2014-08-08-testing-rect-grid 102 if (n_good_tiles() != n_tiles()) { 103 int newn = 0; 104 for (unsigned i = 0; i < scalar_pt.size(); i++) { 105 if (tile_is_good(i)) { 106 // clang gets confused with the SharedPtr swap if we don't 107 // have std:: here 108 std::swap(scalar_pt[i],scalar_pt[newn]); 109 newn++; 110 } 111 } 112 scalar_pt.resize(newn); 113 } 114 115 // in all cases, carry on with the computation of rho 116 // 117 // first sort 118 sort(scalar_pt.begin(), scalar_pt.end()); 119 120 // then compute rho 121 // 122 // watch out: by definition, our sigma is the standard deviation of 123 // the pt density multiplied by the square root of the cell area 124 double p50 = _percentile(scalar_pt, 0.5); 125 _rho = p50 / mean_tile_area(); 126 _sigma = (p50-_percentile(scalar_pt, (1.0-0.6827)/2.0))/sqrt(mean_tile_area()); 52 127 53 128 _has_particles = true; … … 61 136 double GridMedianBackgroundEstimator::rho() const { 62 137 verify_particles_set(); 63 return _ percentile(_scalar_pt, 0.5) / _cell_area;138 return _rho; 64 139 } 65 140 … … 71 146 double GridMedianBackgroundEstimator::sigma() const{ 72 147 verify_particles_set(); 73 // watch out: by definition, our sigma is the standard deviation of 74 // the pt density multiplied by the square root of the cell area 75 return (_percentile(_scalar_pt, 0.5) - 76 _percentile(_scalar_pt, (1.0-0.6827)/2.0) 77 )/sqrt(_cell_area); 148 return _sigma; 78 149 } 79 150 … … 85 156 // determination. 86 157 double GridMedianBackgroundEstimator::rho(const PseudoJet & jet) { 87 verify_particles_set();158 //verify_particles_set(); 88 159 double rescaling = (_rescaling_class == 0) ? 1.0 : (*_rescaling_class)(jet); 89 160 return rescaling*rho(); … … 95 166 // the position of a given jet. As for rho(jet), it is non-const. 96 167 double GridMedianBackgroundEstimator::sigma(const PseudoJet & jet){ 97 verify_particles_set();168 //verify_particles_set(); 98 169 double rescaling = (_rescaling_class == 0) ? 1.0 : (*_rescaling_class)(jet); 99 170 return rescaling*sigma(); 171 } 172 173 //---------------------------------------------------------------------- 174 // returns rho_m (particle-masses contribution to the 4-vector density) 175 double GridMedianBackgroundEstimator::rho_m() const { 176 if (! _enable_rho_m){ 177 throw Error("GridMediamBackgroundEstimator: rho_m requested but rho_m calculation has been disabled."); 178 } 179 verify_particles_set(); 180 return _rho_m; 181 } 182 183 184 //---------------------------------------------------------------------- 185 // returns sigma_m (particle-masses contribution to the 4-vector 186 // density); must be multipled by sqrt(area) to get fluctuations 187 // for a region of a given area. 188 double GridMedianBackgroundEstimator::sigma_m() const{ 189 if (! _enable_rho_m){ 190 throw Error("GridMediamBackgroundEstimator: sigma_m requested but rho_m/sigma_m calculation has been disabled."); 191 } 192 verify_particles_set(); 193 return _sigma_m; 194 } 195 196 //---------------------------------------------------------------------- 197 // returns rho_m locally at the position of a given jet. As for 198 // rho(jet), it is non-const. 199 double GridMedianBackgroundEstimator::rho_m(const PseudoJet & jet) { 200 //verify_particles_set(); 201 double rescaling = (_rescaling_class == 0) ? 1.0 : (*_rescaling_class)(jet); 202 return rescaling*rho_m(); 203 } 204 205 206 //---------------------------------------------------------------------- 207 // returns sigma_m locally at the position of a given jet. As for 208 // rho(jet), it is non-const. 209 double GridMedianBackgroundEstimator::sigma_m(const PseudoJet & jet){ 210 //verify_particles_set(); 211 double rescaling = (_rescaling_class == 0) ? 1.0 : (*_rescaling_class)(jet); 212 return rescaling*sigma_m(); 100 213 } 101 214 … … 112 225 string GridMedianBackgroundEstimator::description() const { 113 226 ostringstream desc; 227 #ifdef FASTJET_GMBGE_USEFJGRID 228 desc << "GridMedianBackgroundEstimator, with " << RectangularGrid::description(); 229 #else 114 230 desc << "GridMedianBackgroundEstimator, with grid extension |y| < " << _ymax 115 << " and requested grid spacing = " << _requested_grid_spacing; 231 << ", and grid cells of size dy x dphi = " << _dy << " x " << _dphi 232 << " (requested size = " << _requested_grid_spacing << ")"; 233 #endif 116 234 return desc.str(); 117 235 } … … 144 262 145 263 264 #ifndef FASTJET_GMBGE_USEFJGRID 146 265 //---------------------------------------------------------------------- 147 266 // protected material … … 168 287 169 288 _ntotal = _nphi * _ny; 170 _scalar_pt.resize(_ntotal);171 _ cell_area = _dy * _dphi;172 } 173 174 175 //---------------------------------------------------------------------- 176 // retrieve the grid cellindex for a given PseudoJet177 int GridMedianBackgroundEstimator:: igrid(const PseudoJet & p) const {289 //_scalar_pt.resize(_ntotal); 290 _tile_area = _dy * _dphi; 291 } 292 293 294 //---------------------------------------------------------------------- 295 // retrieve the grid tile index for a given PseudoJet 296 int GridMedianBackgroundEstimator::tile_index(const PseudoJet & p) const { 178 297 // directly taking int does not work for values between -1 and 0 179 298 // so use floor instead … … 193 312 if (iphi == _nphi) iphi = 0; // just in case of rounding errors 194 313 195 int igrid_res = iy*_nphi + iphi; 196 assert (igrid_res >= 0 && igrid_res < _ny*_nphi); 197 return igrid_res; 198 } 314 int index_res = iy*_nphi + iphi; 315 assert (index_res >= 0 && index_res < _ny*_nphi); 316 return index_res; 317 } 318 #endif // FASTJET_GMBGE_USEFJGRID 319 199 320 200 321 -
external/fastjet/tools/GridMedianBackgroundEstimator.hh
r5b5a56b r35cdc46 2 2 #define __GRID_MEDIAN_BACKGROUND_ESTIMATOR_HH__ 3 3 4 // STARTHEADER5 // $Id: GridMedianBackgroundEstimator.hh 2580 2011-09-13 17:25:43Z salam $6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: GridMedianBackgroundEstimator.hh 3610 2014-08-13 09:49:28Z salam $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 33 35 #include "fastjet/tools/BackgroundEstimatorBase.hh" 36 37 // if defined then we'll use the RectangularGrid class 38 // 39 // (For FastJet 3.2, maybe remove the symbol and simply clean up the 40 // code below to use exclusively the RectangularGrid) 41 #define FASTJET_GMBGE_USEFJGRID 42 43 #ifdef FASTJET_GMBGE_USEFJGRID 44 #include "fastjet/RectangularGrid.hh" 45 #endif 46 47 34 48 35 49 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh … … 61 75 /// rho() [Without rescaling, they are identical] 62 76 /// 63 class GridMedianBackgroundEstimator : public BackgroundEstimatorBase { 77 class GridMedianBackgroundEstimator : public BackgroundEstimatorBase 78 #ifdef FASTJET_GMBGE_USEFJGRID 79 , RectangularGrid 80 #endif 81 { 82 64 83 public: 65 84 /// @name constructors and destructors 66 85 //\{ 86 #ifdef FASTJET_GMBGE_USEFJGRID 67 87 //---------------------------------------------------------------- 68 88 /// \param ymax maximal absolute rapidity extent of the grid … … 71 91 /// periodicity in azimuthal angle (size, not area) 72 92 GridMedianBackgroundEstimator(double ymax, double requested_grid_spacing) : 93 RectangularGrid(ymax, requested_grid_spacing), 94 _has_particles(false), _enable_rho_m(true) {} 95 96 //---------------------------------------------------------------- 97 /// Constructor based on a user's fully specified RectangularGrid 98 GridMedianBackgroundEstimator(const RectangularGrid & grid) : 99 RectangularGrid(grid), 100 _has_particles(false), _enable_rho_m(true) { 101 if (!RectangularGrid::is_initialised()) 102 throw Error("attempt to construct GridMedianBackgroundEstimator with uninitialised RectangularGrid"); 103 } 104 105 #else // alternative in old framework where we didn't have the rectangular grid 106 GridMedianBackgroundEstimator(double ymax, double requested_grid_spacing) : 73 107 _ymin(-ymax), _ymax(ymax), 74 108 _requested_grid_spacing(requested_grid_spacing), 75 _has_particles(false){setup_grid();} 109 _has_particles(false), _enable_rho_m(true) 110 { 111 setup_grid(); 112 } 113 #endif // FASTJET_GMBGE_USEFJGRID 114 76 115 //\} 77 116 … … 84 123 /// of the specified particles. 85 124 void set_particles(const std::vector<PseudoJet> & particles); 125 126 /// determine whether the automatic calculation of rho_m and sigma_m 127 /// is enabled (by default true) 128 void set_compute_rho_m(bool enable){ _enable_rho_m = enable;} 86 129 87 130 //\} … … 114 157 bool has_sigma() {return true;} 115 158 159 //----------------------------------------------------------------- 160 /// Returns rho_m, the purely longitudinal, particle-mass-induced 161 /// component of the background density per unit area 162 double rho_m() const; 163 164 /// returns sigma_m, a measure of the fluctuations in the purely 165 /// longitudinal, particle-mass-induced component of the background 166 /// density per unit area; must be multipled by sqrt(area) to get 167 /// fluctuations for a region of a given area. 168 double sigma_m() const; 169 170 /// Returns rho_m locally at the jet position. As for rho(jet), it is non-const. 171 double rho_m(const PseudoJet & jet); 172 173 /// Returns sigma_m locally at the jet position. As for rho(jet), it is non-const. 174 double sigma_m(const PseudoJet & jet); 175 176 /// Returns true if this background estimator has support for 177 /// determination of rho_m. 178 /// 179 /// Note that support for sigma_m is automatic is one has sigma and 180 /// rho_m support. 181 bool has_rho_m() const {return _enable_rho_m;} 182 183 116 184 /// returns the area of the grid cells (all identical, but 117 185 /// referred to as "mean" area for uniformity with JetMedianBGE). 118 double mean_area() const {return _cell_area;}186 double mean_area() const {return mean_tile_area();} 119 187 //\} 120 188 … … 134 202 /// Note that this has to be called BEFORE any attempt to do an 135 203 /// actual computation 204 /// 205 /// The same profile will be used for both pt and mt (this is 206 /// probabaly a good approximation since the particle density 207 /// changes is what dominates the rapidity profile) 136 208 virtual void set_rescaling_class(const FunctionOfPseudoJet<double> * rescaling_class); 137 209 … … 149 221 150 222 private: 223 224 #ifndef FASTJET_GMBGE_USEFJGRID 225 151 226 /// configure the grid 152 227 void setup_grid(); 153 228 154 229 /// retrieve the grid cell index for a given PseudoJet 155 int igrid(const PseudoJet & p) const; 230 int tile_index(const PseudoJet & p) const; 231 232 // information about the grid 233 double _ymin, _ymax, _dy, _dphi, _requested_grid_spacing, _tile_area; 234 int _ny, _nphi, _ntotal; 235 236 int n_tiles() const {return _ntotal;} 237 int n_good_tiles() const {return n_tiles();} 238 int tile_is_good(int /* itile */) const {return true;} 239 240 double mean_tile_area() const {return _tile_area;} 241 #endif // FASTJET_GMBGE_USEFJGRID 242 156 243 157 244 /// verify that particles have been set and throw an error if not 158 245 void verify_particles_set() const; 159 246 160 // information about the grid161 double _ymin, _ymax, _dy, _dphi, _requested_grid_spacing, _cell_area;162 int _ny, _nphi, _ntotal;163 164 247 // information abotu the event 165 std::vector<double> _scalar_pt; 248 //std::vector<double> _scalar_pt; 249 double _rho, _sigma, _rho_m, _sigma_m; 166 250 bool _has_particles; 167 168 // various warnings to let people aware of potential dangers 251 bool _enable_rho_m; 252 253 // various warnings to inform people of potential dangers 169 254 LimitedWarning _warning_rho_of_jet; 170 255 LimitedWarning _warning_rescaling; -
external/fastjet/tools/JHTopTagger.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: JHTopTagger.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/tools/JHTopTagger.hh> -
external/fastjet/tools/JHTopTagger.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_JH_TOP_TAGGER_HH__ 3 3 4 // STARTHEADER5 // $Id: JHTopTagger.hh 2689 2011-11-14 14:51:06Z soyez$6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: JHTopTagger.hh 3433 2014-07-23 08:17:03Z salam $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 -
external/fastjet/tools/JetMedianBackgroundEstimator.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: JetMedianBackgroundEstimator.cc 3517 2014-08-01 14:23:13Z soyez $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/tools/JetMedianBackgroundEstimator.hh" … … 31 33 #include <fastjet/ClusterSequenceStructure.hh> 32 34 #include <iostream> 35 #include <sstream> 33 36 34 37 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh … … 37 40 38 41 double BackgroundJetScalarPtDensity::result(const PseudoJet & jet) const { 39 std::vector<PseudoJet> constituents = jet.constituents(); 42 // do not include the ghosts in the list of constituents to have a 43 // correct behaviour when _pt_power is <= 0 44 std::vector<PseudoJet> constituents = (!SelectorIsPureGhost())(jet.constituents()); 40 45 double scalar_pt = 0; 41 46 for (unsigned i = 0; i < constituents.size(); i++) { … … 43 48 } 44 49 return scalar_pt / jet.area(); 50 } 51 52 53 std::string BackgroundJetScalarPtDensity::description() const { 54 ostringstream oss; 55 oss << "BackgroundScalarJetPtDensity"; 56 if (_pt_power != 1.0) oss << " with pt_power = " << _pt_power; 57 return oss.str(); 45 58 } 46 59 … … 72 85 const JetDefinition &jet_def, 73 86 const AreaDefinition &area_def) 74 : _rho_range(rho_range), _jet_def(jet_def), _area_def(area_def) 87 : _rho_range(rho_range), _jet_def(jet_def), _area_def(area_def){ 75 88 76 89 // initialise things decently … … 261 274 262 275 //---------------------------------------------------------------------- 276 // returns rho_m (particle-masses contribution to the 4-vector density) 277 double JetMedianBackgroundEstimator::rho_m() const { 278 if (! has_rho_m()){ 279 throw Error("JetMediamBackgroundEstimator: rho_m requested but rho_m calculation is disabled (either eplicitly or due to the presence of a jet density class)."); 280 } 281 if (_rho_range.takes_reference()) 282 throw Error("The background estimation is obtained from a selector that takes a reference jet. rho(PseudoJet) should be used in that case"); 283 _recompute_if_needed(); 284 return _rho_m; 285 } 286 287 288 //---------------------------------------------------------------------- 289 // returns sigma_m (particle-masses contribution to the 4-vector 290 // density); must be multipled by sqrt(area) to get fluctuations 291 // for a region of a given area. 292 double JetMedianBackgroundEstimator::sigma_m() const{ 293 if (! has_rho_m()){ 294 throw Error("JetMediamBackgroundEstimator: sigma_m requested but rho_m/sigma_m calculation is disabled (either explicitly or due to the presence of a jet density class)."); 295 } 296 if (_rho_range.takes_reference()) 297 throw Error("The background estimation is obtained from a selector that takes a reference jet. rho(PseudoJet) should be used in that case"); 298 _recompute_if_needed(); 299 return _sigma_m; 300 } 301 302 //---------------------------------------------------------------------- 303 // returns rho_m locally at the position of a given jet. As for 304 // rho(jet), it is non-const. 305 double JetMedianBackgroundEstimator::rho_m(const PseudoJet & jet) { 306 _recompute_if_needed(jet); 307 double our_rho = _rho_m; 308 if (_rescaling_class != 0) { 309 our_rho *= (*_rescaling_class)(jet); 310 } 311 return our_rho; 312 } 313 314 315 //---------------------------------------------------------------------- 316 // returns sigma_m locally at the position of a given jet. As for 317 // rho(jet), it is non-const. 318 double JetMedianBackgroundEstimator::sigma_m(const PseudoJet & jet){ 319 _recompute_if_needed(jet); 320 double our_sigma = _sigma_m; 321 if (_rescaling_class != 0) { 322 our_sigma *= (*_rescaling_class)(jet); 323 } 324 return our_sigma; 325 } 326 327 //---------------------------------------------------------------------- 263 328 // configuring behaviour 264 329 //---------------------------------------------------------------------- … … 271 336 set_provide_fj2_sigma(false); 272 337 338 _enable_rho_m = true; 339 273 340 // reset the computed values 274 341 _rho = _sigma = 0.0; 342 _rho_m = _sigma_m = 0.0; 275 343 _n_jets_used = _n_empty_jets = 0; 276 344 _empty_area = _mean_area = 0.0; … … 289 357 // is used (as occurs also if this function is not called). 290 358 void JetMedianBackgroundEstimator::set_jet_density_class(const FunctionOfPseudoJet<double> * jet_density_class_in) { 291 _warnings_preliminary.warn("JetMedianBackgroundEstimator::set_jet_density_class: density classes are still preliminary in FastJet 3. 0. Their interface may differ in future releases (without guaranteeing backward compatibility).");359 _warnings_preliminary.warn("JetMedianBackgroundEstimator::set_jet_density_class: density classes are still preliminary in FastJet 3.1. Their interface may differ in future releases (without guaranteeing backward compatibility). Note that since FastJet 3.1, rho_m and sigma_m are accessible direclty in JetMedianBackgroundEstimator and GridMedianBackgroundEstimator(with no need for a density class)."); 292 360 _jet_density_class = jet_density_class_in; 293 361 _uptodate = false; … … 338 406 // fill the vector of pt/area (or the quantity from the jet density class) 339 407 // - in the range 340 vector<double> vector_for_median; 408 vector<double> vector_for_median_pt; 409 vector<double> vector_for_median_dt; 341 410 double total_area = 0.0; 342 411 _n_jets_used = 0; … … 346 415 347 416 // compute the pt/area for the selected jets 417 double median_input_pt, median_input_dt=0.0; 418 BackgroundJetPtMDensity m_density; 419 bool do_rho_m = has_rho_m(); 348 420 for (unsigned i = 0; i < selected_jets.size(); i++) { 349 421 const PseudoJet & current_jet = selected_jets[i]; 350 422 351 423 double this_area = (_use_area_4vector) ? current_jet.area_4vector().perp() : current_jet.area(); 352 353 424 if (this_area>0){ 354 double median_input; 425 // for the pt component, we either use pt or the user-provided 426 // density class 355 427 if (_jet_density_class == 0) { 356 median_input = current_jet.perp()/this_area;428 median_input_pt = current_jet.perp()/this_area; 357 429 } else { 358 median_input = (*_jet_density_class)(current_jet);430 median_input_pt = (*_jet_density_class)(current_jet); 359 431 } 432 433 // handle the rho_m part if requested 434 // note that we're using the scalar area as a normalisation inside the 435 // density class! 436 if (do_rho_m) 437 median_input_dt = m_density(current_jet); 438 439 // perform rescaling if needed 360 440 if (_rescaling_class != 0) { 361 median_input /= (*_rescaling_class)(current_jet); 441 double resc = (*_rescaling_class)(current_jet);; 442 median_input_pt /= resc; 443 median_input_dt /= resc; 362 444 } 363 vector_for_median.push_back(median_input); 445 446 // store the result for future computation of the median 447 vector_for_median_pt.push_back(median_input_pt); 448 if (do_rho_m) 449 vector_for_median_dt.push_back(median_input_dt); 450 364 451 total_area += this_area; 365 452 _n_jets_used++; … … 367 454 _warnings_zero_area.warn("JetMedianBackgroundEstimator::_compute(...): discarded jet with zero area. Zero-area jets may be due to (i) too large a ghost area (ii) a jet being outside the ghost range (iii) the computation not being done using an appropriate algorithm (kt;C/A)."); 368 455 } 369 370 456 } 371 457 372 458 // there is nothing inside our region, so answer will always be zero 373 if (vector_for_median .size() == 0) {459 if (vector_for_median_pt.size() == 0) { 374 460 _rho = 0.0; 375 461 _sigma = 0.0; 462 _rho_m = 0.0; 463 _sigma_m = 0.0; 376 464 _mean_area = 0.0; 377 465 return; … … 392 480 393 481 double stand_dev; 394 _median_and_stddev(vector_for_median , _n_empty_jets, _rho, stand_dev,482 _median_and_stddev(vector_for_median_pt, _n_empty_jets, _rho, stand_dev, 395 483 _provide_fj2_sigma); 396 484 … … 398 486 _mean_area = total_area / total_njets; 399 487 _sigma = stand_dev * sqrt(_mean_area); 488 489 // compute the rho_m part now 490 if (do_rho_m){ 491 _median_and_stddev(vector_for_median_dt, _n_empty_jets, _rho_m, stand_dev, 492 _provide_fj2_sigma); 493 _sigma_m = stand_dev * sqrt(_mean_area); 494 } 400 495 401 496 // record that the computation has been performed … … 439 534 440 535 441 442 536 FASTJET_END_NAMESPACE 443 537 -
external/fastjet/tools/JetMedianBackgroundEstimator.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_BACKGROUND_ESTIMATOR_HH__ 3 3 4 // STARTHEADER5 // $Id: JetMedianBackgroundEstimator.hh 2689 2011-11-14 14:51:06Z soyez $4 //FJSTARTHEADER 5 // $Id: JetMedianBackgroundEstimator.hh 3517 2014-08-01 14:23:13Z soyez $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/ClusterSequenceAreaBase.hh> … … 121 123 /// 122 124 JetMedianBackgroundEstimator(const Selector &rho_range = SelectorIdentity()) 123 : _rho_range(rho_range), _jet_def(JetDefinition()) { reset(); } 125 : _rho_range(rho_range), _jet_def(JetDefinition()), 126 _enable_rho_m(true){ reset(); } 124 127 125 128 … … 168 171 } 169 172 173 /// determine whether the automatic calculation of rho_m and sigma_m 174 /// is enabled (by default true) 175 void set_compute_rho_m(bool enable){ _enable_rho_m = enable;} 176 170 177 //\} 171 178 … … 201 208 virtual bool has_sigma() {return true;} 202 209 210 //---------------------------------------------------------------- 211 // now do the same thing for rho_m and sigma_m 212 213 /// returns rho_m, the purely longitudinal, particle-mass-induced 214 /// component of the background density per unit area 215 virtual double rho_m() const; 216 217 /// returns sigma_m, a measure of the fluctuations in the purely 218 /// longitudinal, particle-mass-induced component of the background 219 /// density per unit area; must be multipled by sqrt(area) to get 220 /// fluctuations for a region of a given area. 221 virtual double sigma_m() const; 222 223 /// Returns rho_m locally at the jet position. As for rho(jet), it is non-const. 224 virtual double rho_m(const PseudoJet & /*jet*/); 225 226 /// Returns sigma_m locally at the jet position. As for rho(jet), it is non-const. 227 virtual double sigma_m(const PseudoJet & /*jet*/); 228 229 /// Returns true if this background estimator has support for 230 /// determination of rho_m. 231 /// 232 /// In te presence of a density class, support for rho_m is 233 /// automatically disabled 234 /// 235 /// Note that support for sigma_m is automatic is one has sigma and 236 /// rho_m support. 237 virtual bool has_rho_m() const {return _enable_rho_m && (_jet_density_class == 0);} 203 238 //\} 204 239 … … 208 243 /// Returns the mean area of the jets used to actually compute the 209 244 /// background properties in the last call of rho() or sigma() 245 /// If the configuration has changed in the meantime, throw an error. 210 246 double mean_area() const{ 211 _recompute_if_needed(); 247 if (!_uptodate) 248 throw Error("JetMedianBackgroundEstimator::mean_area(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 249 //_recompute_if_needed(); 212 250 return _mean_area; 213 251 } … … 215 253 /// returns the number of jets used to actually compute the 216 254 /// background properties in the last call of rho() or sigma() 255 /// If the configuration has changed in the meantime, throw an error. 217 256 unsigned int n_jets_used() const{ 218 _recompute_if_needed(); 257 if (!_uptodate) 258 throw Error("JetMedianBackgroundEstimator::n_jets_used(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 259 //_recompute_if_needed(); 219 260 return _n_jets_used; 261 } 262 263 /// returns the jets used to actually compute the background 264 /// properties 265 std::vector<PseudoJet> jets_used() const{ 266 if (!_uptodate) throw Error("JetMedianBackgroundEstimator::n_jets_used(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 267 _check_csa_alive(); 268 std::vector<PseudoJet> tmp_jets = _rho_range(_included_jets); 269 std::vector<PseudoJet> used_jets; 270 for (unsigned int i=0; i<tmp_jets.size(); i++){ 271 if (tmp_jets[i].area()>0) used_jets.push_back(tmp_jets[i]); 272 } 273 return used_jets; 220 274 } 221 275 … … 223 277 /// the selector) that is not occupied by jets. The value is that 224 278 /// for the last call of rho() or sigma() 279 /// If the configuration has changed in the meantime, throw an error. 225 280 /// 226 281 /// The answer is defined to be zero if the area calculation … … 234 289 /// call to the ClusterSequenceAreaBase function. 235 290 double empty_area() const{ 236 _recompute_if_needed(); 291 if (!_uptodate) 292 throw Error("JetMedianBackgroundEstimator::empty_area(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 293 //_recompute_if_needed(); 237 294 return _empty_area; 238 295 } … … 241 298 /// background properties. The value is that for the last call of 242 299 /// rho() or sigma(). 300 /// If the configuration has changed in the meantime, throw an error. 243 301 /// 244 302 /// If the area has explicit ghosts the result is zero; for active … … 250 308 /// call to the ClusterSequenceAreaBase function. 251 309 double n_empty_jets() const{ 252 _recompute_if_needed(); 310 if (!_uptodate) 311 throw Error("JetMedianBackgroundEstimator::n_empty_jets(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 312 //_recompute_if_needed(); 253 313 return _n_empty_jets; 254 314 } … … 361 421 /// Issue a warning otherwise 362 422 void _check_jet_alg_good_for_median() const; 363 423 364 424 // the basic parameters of this class (passed through the variou ctors) 365 425 Selector _rho_range; ///< range to compute the background in … … 368 428 std::vector<PseudoJet> _included_jets; ///< jets to be used 369 429 370 // the tunable aprameters of the class430 // the tunable parameters of the class 371 431 bool _use_area_4vector; 372 432 bool _provide_fj2_sigma; 373 433 const FunctionOfPseudoJet<double> * _jet_density_class; 374 434 //SharedPtr<BackgroundRescalingBase> _rescaling_class_sharedptr; 435 bool _enable_rho_m; 375 436 376 437 // the actual results of the computation 377 438 mutable double _rho; ///< background estimated density per unit area 378 439 mutable double _sigma; ///< background estimated fluctuations 440 mutable double _rho_m; ///< "mass" background estimated density per unit area 441 mutable double _sigma_m; ///< "mass" background estimated fluctuations 379 442 mutable double _mean_area; ///< mean area of the jets used to estimate the background 380 443 mutable unsigned int _n_jets_used; ///< number of jets used to estimate the background … … 429 492 virtual double result(const PseudoJet & jet) const; 430 493 431 virtual std::string description() const {return "BackgroundScalarJetPtDensity";}494 virtual std::string description() const; 432 495 433 496 private: -
external/fastjet/tools/MassDropTagger.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: MassDropTagger.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/tools/MassDropTagger.hh> -
external/fastjet/tools/MassDropTagger.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: MassDropTagger.hh 2731 2011-11-21 12:15:21Z soyez$1 //FJSTARTHEADER 2 // $Id: MassDropTagger.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_MASS_DROP_TAGGER_HH__ -
external/fastjet/tools/Pruner.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: Pruner.cc 3481 2014-07-29 17:24:12Z soyez $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/tools/Pruner.hh" … … 47 49 //---------------------------------------------------------------------- 48 50 // alternative (dynamic) ctor 49 // \param jet_def the jet definition for the internal clustering51 // \param jet_def the jet definition for the internal clustering 50 52 // \param zcut_dyn dynamic pt-fraction cut in the pruning 51 53 // \param Rcut_dyn dynamic angular distance cut in the pruning 52 54 Pruner::Pruner(const JetDefinition &jet_def, 53 FunctionOfPseudoJet<double> *zcut_dyn,54 FunctionOfPseudoJet<double> *Rcut_dyn)55 const FunctionOfPseudoJet<double> *zcut_dyn, 56 const FunctionOfPseudoJet<double> *Rcut_dyn) 55 57 : _jet_def(jet_def), _zcut(0), _Rcut_factor(0), 56 58 _zcut_dyn(zcut_dyn), _Rcut_dyn(Rcut_dyn), _get_recombiner_from_jet(false) { … … 74 76 double zcut = (_zcut_dyn) ? (*_zcut_dyn)(jet) : _zcut; 75 77 PruningPlugin * pruning_plugin; 78 76 79 // for some constructors, we get the recombiner from the 77 // input jet -- some acrobatics are needed (see plans for FJ3.1 78 // for a hopefully better solution). 80 // input jet -- some acrobatics are needed 79 81 if (_get_recombiner_from_jet) { 80 const JetDefinition::Recombiner * common_recombiner = 81 _get_common_recombiner(jet); 82 if (common_recombiner) { 83 JetDefinition jet_def = _jet_def; 84 if (typeid(*common_recombiner) == typeid(JetDefinition::DefaultRecombiner)) { 85 RecombinationScheme scheme = 86 static_cast<const JetDefinition::DefaultRecombiner *>(common_recombiner)->scheme(); 87 jet_def.set_recombination_scheme(scheme); 88 } else { 89 jet_def.set_recombiner(common_recombiner); 90 } 91 pruning_plugin = new PruningPlugin(jet_def, zcut, Rcut); 92 } else { 93 // if there wasn't a common recombiner, we just use the default 94 // recombiner that was in _jet_def 95 pruning_plugin = new PruningPlugin(_jet_def, zcut, Rcut); 96 } 82 JetDefinition jet_def = _jet_def; 83 84 // if all the pieces have a shared recombiner, we'll use that 85 // one. Otherwise, use the one from _jet_def as a fallback. 86 JetDefinition jet_def_for_recombiner; 87 if (_check_common_recombiner(jet, jet_def_for_recombiner)){ 88 jet_def.set_recombiner(jet_def_for_recombiner); 89 } 90 pruning_plugin = new PruningPlugin(jet_def, zcut, Rcut); 97 91 } else { 98 92 pruning_plugin = new PruningPlugin(_jet_def, zcut, Rcut); … … 122 116 PseudoJet result_local = SelectorNHardest(1)(cs->inclusive_jets())[0]; 123 117 PrunerStructure * s = new PrunerStructure(result_local); 118 s->_Rcut = Rcut; 119 s->_zcut = zcut; 124 120 result_local.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(s)); 125 121 … … 155 151 } 156 152 157 // see if there is a common recombiner among the pieces; if there 158 // is return a pointer to it; otherwise, return NULL. 159 // 160 // NB: this way of doing things is not ideal, because quite some work 161 // is needed to get a correct handling of the final recombiner 162 // (e.g. default v. non-default). In future add 163 // set_recombiner(jet_def) to JetDefinition, maybe also add 164 // an invalid_scheme to the default recombiner and then 165 // do all the work below directly with a JetDefinition directly 166 // together with JD::has_same_recombiner(...) 167 const JetDefinition::Recombiner * Pruner::_get_common_recombiner(const PseudoJet &jet) const{ 168 if (jet.has_associated_cluster_sequence()) 169 return jet.validated_cs()->jet_def().recombiner(); 153 // see if there is a common recombiner among the pieces; if there is 154 // return true and set jet_def_for_recombiner so that the recombiner 155 // can be taken from that JetDefinition. Otherwise, return 156 // false. 'assigned' is initially false; when true, each time we meet 157 // a new jet definition, we'll check it shares the same recombiner as 158 // jet_def_for_recombiner. 159 bool Pruner::_check_common_recombiner(const PseudoJet &jet, 160 JetDefinition &jet_def_for_recombiner, 161 bool assigned) const{ 162 if (jet.has_associated_cluster_sequence()){ 163 // if the jet def for recombination has already been assigned, check if we have the same 164 if (assigned) 165 return jet.validated_cs()->jet_def().has_same_recombiner(jet_def_for_recombiner); 166 167 // otherwise, assign it. 168 jet_def_for_recombiner = jet.validated_cs()->jet_def(); 169 assigned = true; 170 return true; 171 } 170 172 171 173 // if the jet has pieces, recurse in the pieces 172 174 if (jet.has_pieces()){ 173 175 vector<PseudoJet> pieces = jet.pieces(); 174 if (pieces.size() == 0) return 0; 175 const JetDefinition::Recombiner * reco = _get_common_recombiner(pieces[0]); 176 for (unsigned int i=1;i<pieces.size(); i++) 177 if (_get_common_recombiner(pieces[i]) != reco) return 0; 176 if (pieces.size() == 0) return false; 177 for (unsigned int i=0;i<pieces.size(); i++) 178 if (!_check_common_recombiner(pieces[i], jet_def_for_recombiner, assigned)) return false; 178 179 // never returned false, so we're OK. 179 return reco;180 return true; 180 181 } 181 182 182 183 // return false for any other (unknown) structure 183 return 0;184 return false; 184 185 } 185 186 -
external/fastjet/tools/Pruner.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_TOOLS_PRUNER_HH__ 3 3 4 // STARTHEADER5 // $Id: Pruner.hh 2616 2011-09-30 18:03:40Z salam$6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: Pruner.hh 3481 2014-07-29 17:24:12Z soyez $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include "fastjet/ClusterSequence.hh" … … 43 45 class PruningRecombiner; 44 46 class PruningPlugin; 47 48 // This tells third-party code that the pruner structure 49 // stores Rcut info; the alternative is for the user to 50 // get the information from the version number 51 #define FASTJET_PRUNER_STRUCTURE_STORES_RCUT 45 52 46 53 //---------------------------------------------------------------------- … … 135 142 /// \param Rcut_dyn dynamic angular distance cut in the pruning 136 143 Pruner(const JetDefinition &jet_def, 137 FunctionOfPseudoJet<double> *zcut_dyn,138 FunctionOfPseudoJet<double> *Rcut_dyn);144 const FunctionOfPseudoJet<double> *zcut_dyn, 145 const FunctionOfPseudoJet<double> *Rcut_dyn); 139 146 140 147 /// action on a single jet … … 152 159 bool _check_explicit_ghosts(const PseudoJet &jet) const; 153 160 154 /// return a pointer to a "common" recombiner if there is one, 155 /// alternatively a null pointer. 156 const JetDefinition::Recombiner * _get_common_recombiner(const PseudoJet &jet) const; 161 /// see if there is a common recombiner among the pieces; if there 162 /// is return true and set jet_def_for_recombiner so that the 163 /// recombiner can be taken from that JetDefinition. Otherwise, 164 /// return false. 'assigned' is initially false; when true, each 165 /// time we meet a new jet definition, we'll check it shares the 166 /// same recombiner as jet_def_for_recombiner. 167 bool _check_common_recombiner(const PseudoJet &jet, 168 JetDefinition &jet_def_for_recombiner, 169 bool assigned=false) const; 157 170 158 171 JetDefinition _jet_def; ///< the internal jet definition 159 172 double _zcut; ///< the pt-fraction cut 160 173 double _Rcut_factor; ///< the angular separation cut factor 161 FunctionOfPseudoJet<double> *_zcut_dyn; ///< dynamic zcut162 FunctionOfPseudoJet<double> *_Rcut_dyn; ///< dynamic Rcut174 const FunctionOfPseudoJet<double> *_zcut_dyn; ///< dynamic zcut 175 const FunctionOfPseudoJet<double> *_Rcut_dyn; ///< dynamic Rcut 163 176 bool _get_recombiner_from_jet; ///< true for minimal constructor, 164 177 ///< causes recombiner to be set equal … … 194 207 std::vector<PseudoJet> extra_jets() const; 195 208 209 /// return the value of Rcut that was used for this specific pruning. 210 double Rcut() const {return _Rcut;} 211 212 /// return the value of Rcut that was used for this specific pruning. 213 double zcut() const {return _zcut;} 214 196 215 protected: 197 216 friend class Pruner; ///< to allow setting the internal information 217 218 private: 219 double _Rcut, _zcut; 198 220 }; 199 221 -
external/fastjet/tools/RestFrameNSubjettinessTagger.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: RestFrameNSubjettinessTagger.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/tools/RestFrameNSubjettinessTagger.hh> -
external/fastjet/tools/RestFrameNSubjettinessTagger.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_RESTFRAMENSUBJETTINESS_TAGGER_HH__ 3 3 4 // STARTHEADER5 // $Id: RestFrameNSubjettinessTagger.hh 2689 2011-11-14 14:51:06Z soyez$4 //FJSTARTHEADER 5 // $Id: RestFrameNSubjettinessTagger.hh 3433 2014-07-23 08:17:03Z salam $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/PseudoJet.hh> -
external/fastjet/tools/Subtractor.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: Subtractor.cc 3594 2014-08-12 15:25:11Z soyez $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/tools/Subtractor.hh" … … 38 40 39 41 42 //---------------------------------------------------------------------- 43 // ctor 40 44 Subtractor::Subtractor(double rho) : _bge(0), _rho(rho) { 41 45 assert(_rho>0.0); 46 set_defaults(); 42 47 } 43 48 49 //---------------------------------------------------------------------- 50 void Subtractor::set_defaults(){ 51 _use_rho_m = false; // likely to change in future releases!! 52 _safe_mass = false; // likely to change in future releases!! 53 54 _sel_known_vertex = Selector(); 55 _sel_leading_vertex = Selector(); 56 } 57 58 //---------------------------------------------------------------------- 59 // perform the subtraction of a given jet 44 60 PseudoJet Subtractor::result(const PseudoJet & jet) const { 45 61 if (!jet.has_area()){ 46 62 throw Error("Trying to subtract a jet without area support"); 47 63 } 48 64 65 PseudoJet known_lv, known_pu; 66 PseudoJet unknown = jet; 67 if (_sel_known_vertex.worker()){ 68 // separate the jet constituents in 3 groups: 69 // unknown vertex 70 // known vertex, leading vertex 71 // known vertex, non-leading vertex (PU) 72 vector<PseudoJet> constits_unknown, constits_known; 73 _sel_known_vertex.sift(jet.constituents(), 74 constits_known, 75 constits_unknown); 76 vector<PseudoJet> constits_known_lv, constits_known_pu; 77 _sel_leading_vertex.sift(constits_known, 78 constits_known_lv, 79 constits_known_pu); 80 81 // For the parts related to the known vertices (LV or PU), we just 82 // sum the 4-momenta. For the unknown part, we assign it the full 83 // jet area. 84 known_lv = (constits_known_lv.size()!=0) 85 ? SelectorIdentity().sum(constits_known_lv) : 0.0*jet; 86 known_pu = (constits_known_pu.size()!=0) 87 ? SelectorIdentity().sum(constits_known_pu) : 0.0*jet; 88 if (constits_unknown.size()==0){ 89 // no need for any form of subtraction! 90 PseudoJet subtracted_jet = jet; 91 subtracted_jet.reset_momentum(known_lv); 92 return subtracted_jet; 93 } 94 unknown = jet; // that keeps all info including area 95 unknown.reset_momentum(SelectorIdentity().sum(constits_unknown)); 96 } else { 97 known_lv = jet; // ensures correct rap-phi! 98 known_lv *= 0.0; 99 known_pu = known_lv; 100 } 101 102 // prepare for the subtraction and compute the 4-vector to be 103 // subtracted 104 PseudoJet subtracted_jet = jet; 105 PseudoJet to_subtract = known_pu + _amount_to_subtract(unknown); 106 107 // sanity check for the transverse momentum 108 if (to_subtract.pt2() < jet.pt2() ) { 109 // this subtraction should retain the jet's structural 110 // information 111 subtracted_jet -= to_subtract; 112 } else { 113 // this sets the jet's momentum while maintaining all of the jet's 114 // structural information 115 subtracted_jet.reset_momentum(known_lv); 116 return subtracted_jet; 117 } 118 119 // make sure that in the end the pt is at least the one known to 120 // come from the leading vertex 121 if (subtracted_jet.pt2() < known_lv.pt2()){ 122 subtracted_jet.reset_momentum(known_lv); 123 return subtracted_jet; 124 } 125 126 // sanity check for the mass (if needed) 127 if ((_safe_mass) && (subtracted_jet.m2() < known_lv.m2())){ 128 // in this case, we keep pt and phi as obtained from the 129 // subtraction above and take rap and m from the part that comes 130 // from the leading vertex (or the original jet if nothing comes 131 // from the leading vertex) 132 subtracted_jet.reset_momentum(PtYPhiM(subtracted_jet.pt(), 133 known_lv.rap(), 134 subtracted_jet.phi(), 135 known_lv.m())); 136 } 137 138 return subtracted_jet; 139 } 140 141 //---------------------------------------------------------------------- 142 std::string Subtractor::description() const{ 143 if (_bge != 0) { 144 string desc = "Subtractor that uses the following background estimator to determine rho: "+_bge->description(); 145 if (use_rho_m()) desc += "; including the rho_m correction"; 146 if (safe_mass()) desc += "; including mass safety tests"; 147 if (_sel_known_vertex.worker()){ 148 desc += "; using known vertex selection: "+_sel_known_vertex.description()+" and leading vertex selection: "+_sel_leading_vertex.description(); 149 } 150 return desc; 151 } else if (_rho != _invalid_rho) { 152 ostringstream ostr; 153 ostr << "Subtractor that uses a fixed value of rho = " << _rho; 154 return ostr.str(); 155 } else { 156 return "Uninitialised subtractor"; 157 } 158 } 159 160 //---------------------------------------------------------------------- 161 // compute the 4-vector that should be subtracted from the given 162 // jet 163 PseudoJet Subtractor::_amount_to_subtract(const PseudoJet &jet) const{ 164 // the "transverse momentum" part 49 165 double rho; 50 166 if (_bge != 0) { … … 56 172 } 57 173 58 PseudoJet subtracted_jet = jet; 59 PseudoJet area4vect = jet.area_4vector(); 60 // sanity check 61 if (rho*area4vect.perp() < jet.perp() ) { 62 // this subtraction should retain the jet's structural 63 // information 64 subtracted_jet -= rho*area4vect; 65 } else { 66 // this sets the jet's momentum to zero while 67 // maintaining all of the jet's structural information 68 subtracted_jet *= 0; 174 PseudoJet area = jet.area_4vector(); 175 PseudoJet to_subtract = rho*area; 176 177 double const rho_m_warning_threshold = 1e-5; 178 179 // add an optional contribution from the unknown particles masses 180 if (_use_rho_m){ 181 assert(_bge != 0); // test done in "set_use_rho_m()" 182 to_subtract += _bge->rho_m(jet) * PseudoJet(0.0, 0.0, area.pz(), area.E()); 183 } else if (_bge && 184 _bge->has_rho_m() && 185 _bge->rho_m(jet) > rho_m_warning_threshold * rho) { 186 _unused_rho_m_warning.warn("Background estimator indicates non-zero rho_m, but use_rho_m()==false in subtractor; consider calling set_use_rho_m(true) to include the rho_m information"); 69 187 } 70 return subtracted_jet; 188 189 return to_subtract; 71 190 } 72 191 73 //----------------------------------------------------------------------74 std::string Subtractor::description() const{75 if (_bge != 0) {76 return "Subtractor that uses the following background estimator to determine rho: "+_bge->description();77 } else if (_rho != _invalid_rho) {78 ostringstream ostr;79 ostr << "Subtractor that uses a fixed value of rho = " << _rho;80 return ostr.str();81 } else {82 return "Uninitialised subtractor";83 }84 }85 192 86 193 FASTJET_END_NAMESPACE -
external/fastjet/tools/Subtractor.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: Subtractor.hh 2577 2011-09-13 15:11:38Z salam$3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: Subtractor.hh 3584 2014-08-12 12:40:10Z soyez $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_TOOLS_SUBTRACTOR_HH__ … … 61 63 /// define a subtractor based on a BackgroundEstimator 62 64 Subtractor(BackgroundEstimatorBase * bge) : 63 _bge(bge), _rho(-1.0) { }65 _bge(bge), _rho(-1.0) { set_defaults(); } 64 66 65 67 /// define a subtractor that uses a fixed value of rho, the background … … 68 70 69 71 /// default constructor 70 Subtractor() : _bge(0), _rho(_invalid_rho) { }72 Subtractor() : _bge(0), _rho(_invalid_rho) { set_defaults(); } 71 73 72 74 /// default dtor 73 75 virtual ~Subtractor(){}; 76 77 /// @name configuring the behaviour 78 //\{ 79 //---------------------------------------------------------------- 80 81 /// reset all parameters to default values 82 /// 83 /// Note: by default, the rho_m term is not included and the safety 84 /// test for the mass is not done. This is mostly for backwards 85 /// compatibility with FastJet 3.0 and is highly likely to change in 86 /// a future release of FastJet 87 void set_defaults(); 88 89 /// when 'use_rho_m' is true, include in the subtraction the 90 /// correction from rho_m, the purely longitudinal, 91 /// particle-mass-induced component of the background density per 92 /// unit area 93 /// 94 /// Note: this will be switched off by default (for backwards 95 /// compatibility with FastJet 3.0) but is highly likely to change 96 /// in a future release of FastJet 97 void set_use_rho_m(bool use_rho_m_in = true){ 98 if (_bge == 0) { 99 throw Error("Subtractor: rho_m support works only for Subtractors constructed with background estimator"); 100 } 101 _use_rho_m=use_rho_m_in; 102 } 103 104 /// returns whether or not the rho_m component is used 105 bool use_rho_m() const{ return _use_rho_m;} 106 107 /// when 'safe_mass' is true, ensure that the mass of the subtracted 108 /// 4-vector remain positive 109 /// 110 /// when true, if the subtracted mass is negative, we return a 111 /// 4-vector with 0 mass, pt and phi from the subtracted 4-vector 112 /// and the rapidity of the original, unsubtracted jet. 113 /// 114 /// Note: this will be switched off by default (for backwards 115 /// compatibility with FastJet 3.0) but is highly likely to change 116 /// in a future release of FastJet 117 void set_safe_mass(bool safe_mass_in=true){ _safe_mass=safe_mass_in;} 118 119 /// returns whether or not safety tests on the mass are included 120 bool safe_mass() const{ return _safe_mass;} 121 122 /// This is mostly intended for cherge-hadron-subtracted type of 123 /// events where we wich to use vertex information to improve the 124 /// subtraction. 125 /// 126 /// Given the following parameters: 127 /// \param sel_known_vertex selects the particles with a 128 /// known vertex origin 129 /// \param sel_leading_vertex amongst the particles with a 130 /// known vertex origin, select those 131 /// coming from the leading vertex 132 /// Momentum identified as coming from the leading vertex will be 133 /// kept, momentum identified as coming from a non-leading vertex 134 /// will be eliminated and a regular area-median subtraction will be 135 /// applied on the 4-vector sum of the particles with unknown vertex 136 /// origin. 137 /// 138 /// When this is set, we shall ensure that the pt of the subtracted 139 /// 4-vector is at least the pt of the particles that are known to 140 /// come from the leading vertex (if it fails, subtraction returns 141 /// the component that is known to come from the leading vertex --- 142 /// or, the original unsubtracted jet if it contains no particles 143 /// from the leading vertex). Furthermore, when safe_mass() is on, we 144 /// also impose a similar constraint on the mass of the subtracted 145 /// 4-vector (if the test fails, the longitudinal part of the 146 /// subtracted 4-vector is taken from the component that is known to 147 /// come from the leading vertex). 148 void set_known_selectors(const Selector &sel_known_vertex, 149 const Selector &sel_leading_vertex){ 150 _sel_known_vertex = sel_known_vertex; 151 _sel_leading_vertex = sel_leading_vertex; 152 } 153 154 //\} 155 156 /// @name description and action 157 //\{ 158 //---------------------------------------------------------------- 74 159 75 160 /// returns a jet that's subtracted … … 82 167 virtual std::string description() const; 83 168 169 //\} 84 170 protected: 171 /// compute the 4-vector that should be subtracted from the given 172 /// jet 173 PseudoJet _amount_to_subtract(const PseudoJet &jet) const; 85 174 86 175 /// the tool used to estimate the background … … 89 178 /// the fixed value of rho to use if the user has selected that option 90 179 double _rho; 180 181 // configuration parameters/flags 182 bool _use_rho_m; ///< include the rho_m correction 183 bool _safe_mass; ///< ensures that the subtracted mass is +ve 184 185 Selector _sel_known_vertex; ///< selects the particles with a 186 ///< known vertex origin 187 Selector _sel_leading_vertex; ///< amongst the particles with a 188 ///< known vertex origin, select those 189 ///< coming from the leading vertex 91 190 92 191 /// a value of rho that is used as a default to label that the stored … … 98 197 // that's not allowed in an include file. 99 198 static const double _invalid_rho; 199 200 mutable LimitedWarning _unused_rho_m_warning; 100 201 }; 101 202 -
external/fastjet/tools/TopTaggerBase.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: TopTaggerBase.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/tools/TopTaggerBase.hh> -
external/fastjet/tools/TopTaggerBase.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_TOP_TAGGER_BASE_HH__ 3 3 4 // STARTHEADER5 // $Id: TopTaggerBase.hh 2689 2011-11-14 14:51:06Z soyez$4 //FJSTARTHEADER 5 // $Id: TopTaggerBase.hh 3433 2014-07-23 08:17:03Z salam $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/internal/base.hh> -
external/fastjet/tools/Transformer.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: Transformer.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: Transformer.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_TRANSFORMER_HH__ -
external/fastjet/version.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: version.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: version.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_VERSION_HH__
Note:
See TracChangeset
for help on using the changeset viewer.