Fork me on GitHub

Ignore:
Timestamp:
Oct 15, 2014, 10:55:55 AM (10 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
35b9204, b25d4cf
Parents:
f14bd6a
git-author:
Pavel Demin <pavel.demin@…> (10/10/14 08:56:40)
git-committer:
Pavel Demin <pavel.demin@…> (10/15/14 10:55:55)
Message:

upgrade FastJet to version 3.1.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/plugins/SISCone/SISConePlugin.cc

    rf14bd6a r273e668  
    2121                      four_vector.E);
    2222}
     23
     24//======================================================================
     25// wrap-up around siscone's user-defined scales
     26namespace siscone_plugin_internal{
     27  /// @ingroup internal
     28  /// \class SISConeUserScale
     29  /// class that makes the transition between the internal SISCone
     30  /// user-defined scale choice (using SISCone's Cjet) and
     31  /// user-defined scale choices in the plugn above (using FastJet's
     32  /// PseudoJets)
     33  class SISConeUserScale  : public siscone::Csplit_merge::Cuser_scale_base{
     34  public:
     35    /// ctor takes the "fastjet-style" user-defined scale as well as a
     36    /// reference to the current cluster sequence (to access the
     37    /// particles if needed)
     38    SISConeUserScale(const SISConePlugin::UserScaleBase *user_scale,
     39                     const ClusterSequence &cs)
     40      : _user_scale(user_scale), _cs(cs){}
     41
     42    /// returns the scale associated to a given jet
     43    virtual double operator()(const siscone::Cjet &jet) const{
     44      return _user_scale->result(_build_PJ_from_Cjet(jet));
     45    }
     46
     47    /// returns true id the scasle associated to jet a is larger than
     48    /// the scale associated to jet b
     49    virtual bool is_larger(const siscone::Cjet &a, const siscone::Cjet &b) const{
     50      return _user_scale->is_larger(_build_PJ_from_Cjet(a), _build_PJ_from_Cjet(b));
     51    }
     52
     53  private:
     54    /// constructs a PseudoJet from a siscone::Cjet
     55    ///
     56    /// Note that it is tempting to overload the PseudoJet ctor. This
     57    /// would not work because down the line we need to access the
     58    /// original PseudoJet through the ClusterSequence and therefore
     59    /// the PseudoJet structure needs to be aware of the
     60    /// ClusterSequence.
     61    PseudoJet _build_PJ_from_Cjet(const siscone::Cjet &jet) const{
     62      PseudoJet j(jet.v.px, jet.v.py, jet.v.pz, jet.v.E);
     63      j.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(
     64                                   new SISConePlugin::UserScaleBaseStructureType<siscone::Cjet>(jet,_cs)));     
     65      return j;
     66    }
     67
     68    const SISConePlugin::UserScaleBase *_user_scale;
     69    const ClusterSequence & _cs;
     70  };
     71}
     72
     73// end of the internal material
     74//======================================================================
    2375
    2476
     
    4597  desc << "SISCone jet algorithm with " ;
    4698  desc << "cone_radius = "       << cone_radius        () << ", ";
    47   desc << "overlap_threshold = " << overlap_threshold  () << ", ";
     99  if (_progressive_removal)
     100    desc << "progressive-removal mode, ";
     101  else 
     102    desc << "overlap_threshold = " << overlap_threshold  () << ", ";
    48103  desc << "n_pass_max = "        << n_pass_max         () << ", ";
    49104  desc << "protojet_ptmin = "    << protojet_ptmin()      << ", ";
    50   desc <<  sm_scale_string                                << ", ";
    51   desc << "caching turned "      << (caching() ? on : off);
    52   desc << ", SM stop scale = "     << _split_merge_stopping_scale;
     105  if (_progressive_removal && _user_scale) {
     106    desc << "using a user-defined scale for ordering of stable cones";
     107    string user_scale_desc = _user_scale->description();
     108    if (user_scale_desc != "") desc << " (" << user_scale_desc << ")";
     109  } else {
     110    desc <<  sm_scale_string;
     111  }
     112  if (!_progressive_removal){
     113    desc << ", caching turned "      << (caching() ? on : off);
     114    desc << ", SM stop scale = "     << _split_merge_stopping_scale;
     115  }
    53116
    54117  // add a note to the description if we use the pt-weighted splitting
     
    85148  bool new_siscone = true; // by default we'll be running it
    86149
    87   if (caching()) {
     150  if (caching() && !_progressive_removal) {
    88151
    89152    // Establish if we have a cached run with the same R, npass and
     
    138201    // run the jet finding
    139202    //cout << "plg sms: " << split_merge_scale() << endl;
    140     siscone->compute_jets(siscone_momenta, cone_radius(), overlap_threshold(),
    141                           n_pass_max(), protojet_or_ghost_ptmin(),
    142                           Esplit_merge_scale(split_merge_scale()));
     203    if (_progressive_removal){
     204      // handle the optional user-defined scale choice
     205      SharedPtr<siscone_plugin_internal::SISConeUserScale> internal_scale;
     206      if (_user_scale){
     207        internal_scale.reset(new siscone_plugin_internal::SISConeUserScale(_user_scale, clust_seq));
     208        siscone->set_user_scale(internal_scale.get());
     209      }
     210      siscone->compute_jets_progressive_removal(siscone_momenta, cone_radius(),
     211                                                n_pass_max(), protojet_or_ghost_ptmin(),
     212                                                Esplit_merge_scale(split_merge_scale()));
     213    } else {
     214      siscone->compute_jets(siscone_momenta, cone_radius(), overlap_threshold(),
     215                            n_pass_max(), protojet_or_ghost_ptmin(),
     216                            Esplit_merge_scale(split_merge_scale()));
     217    }
    143218  } else {
    144219    // rerun the jet finding
     
    155230  SISConeExtras * extras = new SISConeExtras(n);
    156231
     232  // the ordering in which the inclusive jets are transfered here is
     233  // deliberate and ensures that when a user asks for
     234  // inclusive_jets(), they are provided in the order in which SISCone
     235  // created them.
    157236  for (int ijet = njet-1; ijet >= 0; ijet--) {
    158237    const Cjet & jet = siscone->jets[ijet]; // shorthand
     
    220299}
    221300
     301// //======================================================================
     302// // material to handle user-defined scales
     303//
     304// //--------------------------------------------------
     305// // SISCone structure type
     306//
     307// // the textual descripotion
     308// std::string SISConePlugin::UserScaleBase::StructureType::description() const{
     309//   return "PseudoJet wrapping a siscone::Cjet stable cone";
     310// }
     311//
     312// // retrieve the constituents
     313// //
     314// // if you simply need to iterate over the constituents, it will be
     315// // faster to access them via constituent(i)
     316// vector<PseudoJet> SISConePlugin::UserScaleBase::StructureType::constituents(const PseudoJet &) const{
     317//   vector<PseudoJet> constits;
     318//   constits.reserve(_jet.n);
     319//   for (unsigned int i=0; i<(unsigned int)_jet.n;i++)
     320//     constits.push_back(constituent(i));
     321//   return constits;
     322// }
     323//
     324// // returns the number of constituents
     325// unsigned int SISConePlugin::UserScaleBase::StructureType::size() const{
     326//   return _jet.n;
     327// }
     328//
     329// // returns the index (in the original particle list) of the ith
     330// // constituent
     331// int SISConePlugin::UserScaleBase::StructureType::constituent_index(unsigned int i) const{
     332//   return _jet.contents[i];
     333// }
     334//
     335// // returns the ith constituent (as a PseusoJet)
     336// const PseudoJet & SISConePlugin::UserScaleBase::StructureType::constituent(unsigned int i) const{
     337//   return _cs.jets()[_jet.contents[i]];
     338// }
     339//
     340// // returns the scalar pt of this stable cone
     341// double SISConePlugin::UserScaleBase::StructureType::pt_tilde() const{
     342//   return _jet.pt_tilde;
     343// }
     344//
     345// // returns the sm_var2 (signed ordering variable squared) for this stable cone
     346// double SISConePlugin::UserScaleBase::StructureType::ordering_var2() const{
     347//   return _jet.sm_var2;
     348// }
     349
     350
    222351FASTJET_END_NAMESPACE      // defined in fastjet/internal/base.hh
Note: See TracChangeset for help on using the changeset viewer.