Fork me on GitHub

Ignore:
Timestamp:
Oct 9, 2015, 2:47:38 PM (9 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
8713dee
Parents:
f118021
Message:

update FastJet library to 3.1.3 and Nsubjettiness library to 2.2.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/contribs/Nsubjettiness/Njettiness.cc

    rf118021 r973b92a  
    55//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
    66//
    7 //  $Id: Njettiness.cc 677 2014-06-12 18:56:46Z jthaler $
     7//  $Id: Njettiness.cc 821 2015-06-15 18:50:53Z jthaler $
    88//----------------------------------------------------------------------
    99// This file is part of FastJet contrib.
     
    3636///////
    3737
     38LimitedWarning Njettiness::_old_measure_warning;
     39LimitedWarning Njettiness::_old_axes_warning;
     40
     41   
     42// Constructor
    3843Njettiness::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 
     44: _axes_def(axes_def.create()), _measure_def(measure_def.create()) {}
     45   
     46// setAxes for Manual mode
     47void Njettiness::setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
     48   if (_axes_def()->needsManualAxes()) {
     49      _currentAxes = myAxes;
     50   } else {
     51      throw Error("You can only use setAxes for manual AxesDefinitions");
     52   }
     53}
     54   
     55// Calculates and returns all TauComponents that user would want.
     56// This information is stored in _current_tau_components for later access as well.
     57TauComponents Njettiness::getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const {
     58   if (inputJets.size() <= n_jets) {  //if not enough particles, return zero
     59      _currentAxes = inputJets;
     60      _currentAxes.resize(n_jets,fastjet::PseudoJet(0.0,0.0,0.0,0.0));
     61      _current_tau_components = TauComponents();
     62      _seedAxes = _currentAxes;
     63      _currentPartition = TauPartition(n_jets); // empty partition
     64   } else {
     65      assert(_axes_def()); // this should never fail.
     66     
     67      if (_axes_def()->needsManualAxes()) { // if manual mode
     68         // take current axes as seeds
     69         _seedAxes = _currentAxes;
     70         
     71         // refine axes if requested
     72         _currentAxes = _axes_def->get_refined_axes(n_jets,inputJets,_seedAxes, _measure_def());
     73      } else { // non-manual axes
     74         
     75          //set starting point for minimization
     76         _seedAxes = _axes_def->get_starting_axes(n_jets,inputJets,_measure_def());
     77         
     78         // refine axes as needed
     79         _currentAxes = _axes_def->get_refined_axes(n_jets,inputJets,_seedAxes, _measure_def());
     80         
     81         // NOTE:  The above two function calls are combined in "AxesDefinition::get_axes"
     82         // but are separated here to allow seed axes to be stored.
     83      }
     84     
     85      // Find and store partition
     86      _currentPartition = _measure_def->get_partition(inputJets,_currentAxes);
     87     
     88      // Find and store tau value
     89      _current_tau_components = _measure_def->component_result_from_partition(_currentPartition, _currentAxes);  // sets current Tau Values
     90   }
     91   return _current_tau_components;
     92}
     93   
     94
     95///////
     96//
     97// Below is code for backward compatibility to use the old interface.
     98// May be deleted in a future version
     99//
     100///////
     101   
    43102Njettiness::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    
     103: _axes_def(createAxesDef(axes_mode)), _measure_def(measure_def.create()) {}
     104
    48105// Convert from MeasureMode enum to MeasureDefinition
    49106// This returns a pointer that will be claimed by a SharedPtr
    50107MeasureDefinition* Njettiness::createMeasureDef(MeasureMode measure_mode, int num_para, double para1, double para2, double para3) const {
    51 
     108   
     109   _old_measure_warning.warn("Njettiness::createMeasureDef:  You are using the old MeasureMode way of specifying N-subjettiness measures.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use MeasureDefinition instead.");
     110   
    52111   // definition of maximum Rcutoff for non-cutoff measures, changed later by other measures
    53112   double Rcutoff = std::numeric_limits<double>::max();  //large number
     
    77136         break;
    78137      case geometric_measure:
    79          beta = para1;
    80          if (num_para == 1) {
    81             return new GeometricMeasure(beta);
    82          } else {
    83             throw Error("geometric_measure needs 1 parameter (beta)");
    84          }
     138         throw Error("This class has been removed. Please use OriginalGeometricMeasure, ModifiedGeometricMeasure, or ConicalGeometricMeasure with the new Njettiness constructor.");
    85139         break;
    86140      case normalized_cutoff_measure:
     
    104158         break;
    105159      case geometric_cutoff_measure:
    106          beta = para1;
    107          Rcutoff = para2; //Rcutoff parameter is 2nd parameter in geometric_cutoff_measure
    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          }
    113          break;
     160         throw Error("This class has been removed. Please use OriginalGeometricMeasure, ModifiedGeometricMeasure, or ConicalGeometricMeasure with the new Njettiness constructor.");
    114161      default:
    115162         assert(false);
     
    122169// This returns a pointer that will be claimed by a SharedPtr
    123170AxesDefinition* Njettiness::createAxesDef(Njettiness::AxesMode axes_mode) const {
     171   
     172   _old_axes_warning.warn("Njettiness::createAxesDef:  You are using the old AxesMode way of specifying N-subjettiness axes.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use AxesDefinition instead.");
     173   
    124174   
    125175   switch (axes_mode) {
     
    156206}
    157207
    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));
    166 }
    167 
    168 // setAxes for Manual mode
    169 void Njettiness::setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
    170    if (_axes_def->supportsManualAxes()) {
    171       _currentAxes = myAxes;
    172    } else {
    173       throw Error("You can only use setAxes for manual AxesDefinitions");
    174    }
    175 }
    176    
    177 // Calculates and returns all TauComponents that user would want.
    178 // This information is stored in _current_tau_components for later access as well.
    179 TauComponents Njettiness::getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const {
    180    if (inputJets.size() <= n_jets) {  //if not enough particles, return zero
    181       _currentAxes = inputJets;
    182       _currentAxes.resize(n_jets,fastjet::PseudoJet(0.0,0.0,0.0,0.0));
    183       _current_tau_components = TauComponents();
    184       _seedAxes = _currentAxes;
    185       _currentJets = _currentAxes;
    186       _currentBeam = PseudoJet(0.0,0.0,0.0,0.0);
    187    } else {
    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
    202    }
    203    return _current_tau_components;
    204 }
    205    
    206    
    207 // Partition a list of particles according to which N-jettiness axis they are closest to.
    208 // Return a vector of length _currentAxes.size() (which should be N).
    209 // Each vector element is a list of ints corresponding to the indices in
    210 // particles of the particles belonging to that jet.
    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 
     208
     209   
     210   
    216211   
    217212} // namespace contrib
Note: See TracChangeset for help on using the changeset viewer.