Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/PseudoJet.cc

    r273e668 r1d208a2  
    11//FJSTARTHEADER
    2 // $Id: PseudoJet.cc 3652 2014-09-03 13:31:13Z salam $
     2// $Id: PseudoJet.cc 4100 2016-03-15 20:50:22Z salam $
    33//
    44// Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
     
    409409string PseudoJet::description() const{
    410410  // the "default" case of a PJ which does not belong to any cluster sequence
    411   if (!_structure())
     411  if (!_structure)
    412412    return "standard PseudoJet (with no associated clustering information)";
    413413 
    414414  // for all the other cases, the description comes from the structure
    415   return _structure()->description();
     415  return _structure->description();
    416416}
    417417
     
    429429// ClusterSequence
    430430bool PseudoJet::has_associated_cluster_sequence() const{
    431   return (_structure()) && (_structure->has_associated_cluster_sequence());
     431  return (_structure) && (_structure->has_associated_cluster_sequence());
    432432}
    433433
     
    446446// ClusterSequence that is still valid
    447447bool PseudoJet::has_valid_cluster_sequence() const{
    448   return (_structure()) && (_structure->has_valid_cluster_sequence());
     448  return (_structure) && (_structure->has_valid_cluster_sequence());
    449449}
    450450
     
    467467
    468468//----------------------------------------------------------------------
    469 // return true if there is some strusture associated with this PseudoJet
     469// return true if there is some structure associated with this PseudoJet
    470470bool PseudoJet::has_structure() const{
    471   return _structure();
     471  return bool(_structure);
    472472}
    473473
     
    478478// return NULL if there is no associated structure
    479479const PseudoJetStructureBase* PseudoJet::structure_ptr() const {
    480   if (!_structure()) return NULL;
    481   return _structure();
     480  //if (!_structure) return NULL;
     481  return _structure.get();
    482482}
    483483 
     
    493493// underlying structure.
    494494PseudoJetStructureBase* PseudoJet::structure_non_const_ptr(){
    495   if (!_structure()) return NULL;
    496   return _structure();
     495  //if (!_structure) return NULL;
     496  return _structure.get();
    497497}
    498498 
     
    503503// throw an error if there is no associated structure
    504504const PseudoJetStructureBase* PseudoJet::validated_structure_ptr() const {
    505   if (!_structure())
     505  if (!_structure)
    506506    throw Error("Trying to access the structure of a PseudoJet which has no associated structure");
    507   return _structure();
     507  return _structure.get();
    508508}
    509509 
     
    573573// returns true if the PseudoJet has constituents
    574574bool PseudoJet::has_constituents() const{
    575   return (_structure()) && (_structure->has_constituents());
     575  return (_structure) && (_structure->has_constituents());
    576576}
    577577
     
    586586// returns true if the PseudoJet has support for exclusive subjets
    587587bool PseudoJet::has_exclusive_subjets() const{
    588   return (_structure()) && (_structure->has_exclusive_subjets());
     588  return (_structure) && (_structure->has_exclusive_subjets());
    589589}
    590590
     
    670670// ClusterSequence have no pieces and this methos will return false.
    671671bool PseudoJet::has_pieces() const{
    672   return ((_structure()) && (_structure->has_pieces(*this)));
     672  return ((_structure) && (_structure->has_pieces(*this)));
    673673}
    674674
     
    766766
    767767
    768 
    769 //----------------------------------------------------------------------
    770 /// given a vector of values with a one-to-one correspondence with the
    771 /// vector of objects, sort objects into an order such that the
    772 /// associated values would be in increasing order
    773 template<class T> vector<T>  objects_sorted_by_values(
    774                        const vector<T> & objects,
    775                        const vector<double> & values) {
    776 
    777   assert(objects.size() == values.size());
    778 
    779   // get a vector of indices
    780   vector<int> indices(values.size());
    781   for (size_t i = 0; i < indices.size(); i++) {indices[i] = i;}
    782  
    783   // sort the indices
    784   sort_indices(indices, values);
    785  
    786   // copy the objects
    787   vector<T> objects_sorted(objects.size());
    788  
    789   // place the objects in the correct order
    790   for (size_t i = 0; i < indices.size(); i++) {
    791     objects_sorted[i] = objects[indices[i]];
    792   }
    793 
    794   return objects_sorted;
    795 }
    796 
    797768//----------------------------------------------------------------------
    798769/// return a vector of jets sorted into decreasing kt2
Note: See TracChangeset for help on using the changeset viewer.