Fork me on GitHub

Changeset 35cdc46 in git for external/fastjet/Selector.cc


Ignore:
Timestamp:
Sep 3, 2014, 3:18:54 PM (10 years ago)
Author:
Pavel Demin <demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
be2222c
Parents:
5b5a56b
Message:

upgrade FastJet to version 3.1.0-beta.1, upgrade Nsubjettiness to version 2.1.0, add SoftKiller version 1.0.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/Selector.cc

    r5b5a56b r35cdc46  
    1 //STARTHEADER
    2 // $Id$
     1//FJSTARTHEADER
     2// $Id: Selector.cc 3504 2014-08-01 06:07:54Z soyez $
    33//
    4 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
     4// Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
    55//
    66//----------------------------------------------------------------------
     
    1313//
    1414//  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
    1617//  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.
    1820//
    1921//  FastJet is distributed in the hope that it will be useful,
     
    2527//  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
    2628//----------------------------------------------------------------------
    27 //ENDHEADER
     29//FJENDHEADER
    2830
    2931
     
    9597}
    9698
     99//----------------------------------------------------------------------
     100// sum the momenta of the jets that pass the cuts
     101PseudoJet 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
     126double 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
    97149
    98150//----------------------------------------------------------------------
     
    10551107class SW_Circle : public SW_WithReference {
    10561108public:
    1057   SW_Circle(const double &radius) : _radius2(radius*radius) {}
     1109  SW_Circle(const double radius) : _radius2(radius*radius) {}
    10581110
    10591111  /// return a copy of the current object
     
    11001152
    11011153// select on objets within a distance 'radius' of a variable location
    1102 Selector SelectorCircle(const double & radius) {
     1154Selector SelectorCircle(const double radius) {
    11031155  return Selector(new SW_Circle(radius));
    11041156}
     
    11101162class SW_Doughnut : public SW_WithReference {
    11111163public:
    1112   SW_Doughnut(const double &radius_in, const double &radius_out)
     1164  SW_Doughnut(const double radius_in, const double radius_out)
    11131165    : _radius_in2(radius_in*radius_in), _radius_out2(radius_out*radius_out) {}
    11141166
     
    11591211
    11601212// 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) {
     1213Selector SelectorDoughnut(const double radius_in, const double radius_out) {
    11621214  return Selector(new SW_Doughnut(radius_in, radius_out));
    11631215}
     
    11681220class SW_Strip : public SW_WithReference {
    11691221public:
    1170   SW_Strip(const double &delta) : _delta(delta) {}
     1222  SW_Strip(const double delta) : _delta(delta) {}
    11711223
    11721224  /// return a copy of the current object
     
    12131265
    12141266// select on objets within a distance 'radius' of a variable location
    1215 Selector SelectorStrip(const double & half_width) {
     1267Selector SelectorStrip(const double half_width) {
    12161268  return Selector(new SW_Strip(half_width));
    12171269}
     
    12241276class SW_Rectangle : public SW_WithReference {
    12251277public:
    1226   SW_Rectangle(const double &delta_rap, const double &delta_phi)
     1278  SW_Rectangle(const double delta_rap, const double delta_phi)
    12271279    : _delta_rap(delta_rap),  _delta_phi(delta_phi) {}
    12281280
     
    12701322
    12711323// select on objets within a distance 'radius' of a variable location
    1272 Selector SelectorRectangle(const double & half_rap_width, const double & half_phi_width) {
     1324Selector SelectorRectangle(const double half_rap_width, const double half_phi_width) {
    12731325  return Selector(new SW_Rectangle(half_rap_width, half_phi_width));
    12741326}
Note: See TracChangeset for help on using the changeset viewer.