Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/PseudoJet.hh

    r35cdc46 r1d208a2  
    11//FJSTARTHEADER
    2 // $Id: PseudoJet.hh 3566 2014-08-11 15:36:34Z salam $
     2// $Id: PseudoJet.hh 4047 2016-03-03 13:21:49Z soyez $
    33//
    44// Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
     
    437437  /// retrieve a pointer to the (const) user information
    438438  const UserInfoBase * user_info_ptr() const{
    439     if (!_user_info()) return NULL;
     439    // the line below is not needed since the next line would anyway
     440    // return NULL in that case
     441    //if (!_user_info) return NULL;
    440442    return _user_info.get();
    441443  }
     
    841843inline bool operator!=( const double val, const PseudoJet & a) {return !(a==val);}
    842844
     845/// returns the 4-vector dot product of a and b
    843846inline double dot_product(const PseudoJet & a, const PseudoJet & b) {
    844847  return a.E()*b.E() - a.px()*b.px() - a.py()*b.py() - a.pz()*b.pz();
     
    880883/// touch the values vector in the process).
    881884template<class T> std::vector<T> objects_sorted_by_values(const std::vector<T> & objects,
    882                                               const std::vector<double> & values);
     885                                              const std::vector<double> & values) {
     886  //assert(objects.size() == values.size());
     887  if (objects.size() != values.size()){
     888    throw Error("fastjet::objects_sorted_by_values(...): the size of the 'objects' vector must match the size of the 'values' vector");
     889  }
     890 
     891  // get a vector of indices
     892  std::vector<int> indices(values.size());
     893  for (size_t i = 0; i < indices.size(); i++) {indices[i] = i;}
     894 
     895  // sort the indices
     896  sort_indices(indices, values);
     897 
     898  // copy the objects
     899  std::vector<T> objects_sorted(objects.size());
     900 
     901  // place the objects in the correct order
     902  for (size_t i = 0; i < indices.size(); i++) {
     903    objects_sorted[i] = objects[indices[i]];
     904  }
     905
     906  return objects_sorted;
     907}
    883908
    884909/// \if internal_doc
     
    970995template<typename TransformerType>
    971996bool PseudoJet::has_structure_of() const{
    972   if (!_structure()) return false;
     997  if (!_structure) return false;
    973998
    974999  return dynamic_cast<const typename TransformerType::StructureType *>(_structure.get()) != 0;
     
    9801005template<typename TransformerType>
    9811006const typename TransformerType::StructureType & PseudoJet::structure_of() const{
    982   if (!_structure())
     1007  if (!_structure)
    9831008    throw Error("Trying to access the structure of a PseudoJet without an associated structure");
    9841009
Note: See TracChangeset for help on using the changeset viewer.