CMS 3D CMS Logo

JetAlgoHelper.h File Reference

#include <limits>
#include <iostream>
#include <cmath>
#include "PhysicsTools/Utilities/interface/PtComparator.h"
#include "PhysicsTools/Utilities/interface/EtComparator.h"

Go to the source code of this file.

Classes

class  GreaterByEtRef< T >
class  GreaterByPtPtr< T >
class  GreaterByPtRef< T >

Functions

bool so_gt (const SortObject &a, const SortObject &b)
bool so_lt (const SortObject &a, const SortObject &b)
template<class T>
void sortByEt (std::vector< T > *container)
template<class T>
void sortByEtRef (std::vector< T > *container)
template<class T>
void sortByPt (std::vector< T > *container)
template<class T>
void sortByPtRef (std::vector< T > *container)
template<class T, class GetValue>
void sortGreater (std::vector< T > *container)


Function Documentation

bool @13050::so_gt ( const SortObject &  a,
const SortObject &  b 
) [inline, static]

Definition at line 23 of file JetAlgoHelper.h.

Referenced by sortGreater().

00023 {return a.value > b.value;}

bool @13050::so_lt ( const SortObject &  a,
const SortObject &  b 
) [inline, static]

Definition at line 22 of file JetAlgoHelper.h.

00022 {return a.value < b.value;}

template<class T>
void @13050::sortByEt ( std::vector< T > *  container  )  [inline, static]

Definition at line 57 of file JetAlgoHelper.h.

00057                                                     {
00058     sortGreater <T, GetEt<T> > (container);
00059   }

template<class T>
void @13050::sortByEtRef ( std::vector< T > *  container  )  [inline, static]

Definition at line 68 of file JetAlgoHelper.h.

Referenced by ProtoJet::getTowerList(), and ProtoJet::reorderTowers().

00068                                                        {
00069     sortGreater <T, GetEtRef<T> > (container);
00070   }

template<class T>
void @13050::sortByPt ( std::vector< T > *  container  )  [inline, static]

Definition at line 52 of file JetAlgoHelper.h.

Referenced by cms::BasePilupSubtractionJetProducer::produce(), and cms::BaseJetProducer::produce().

00052                                                     {
00053     sortGreater <T, GetPt<T> > (container);
00054   }

template<class T>
void @13050::sortByPtRef ( std::vector< T > *  container  )  [inline, static]

Definition at line 63 of file JetAlgoHelper.h.

00063                                                        {
00064     sortGreater <T, GetPtRef<T> > (container);
00065   }

template<class T, class GetValue>
void @13050::sortGreater ( std::vector< T > *  container  )  [inline, static]

Definition at line 31 of file JetAlgoHelper.h.

References i, index, HLT_VtxMuL3::result, so_gt(), and python::multivaluedict::sort().

00031                                                        {
00032     std::vector <SortObject> sortable (container->size());
00033     bool sorted = true;
00034     GetValue getter;
00035     for (unsigned i = 0; i < container->size(); i++) {
00036       sortable[i].value = getter.getValue ((*container)[i]);
00037       sortable[i].index = i;
00038       if (sorted && i && so_gt (sortable[i-1], sortable[i])) sorted = false;
00039     }
00040     if (!sorted) { // needs sorting
00041       std::sort (sortable.begin(), sortable.end(), so_gt);
00042       std::vector <T> result;
00043       result.reserve(container->size());
00044       for (unsigned i = 0; i < container->size(); i++) {
00045         result.push_back ((*container)[sortable[i].index]);
00046       }
00047       container->swap (result);
00048     }
00049   }


Variable Documentation

unsigned index

Definition at line 19 of file JetAlgoHelper.h.

double value

Definition at line 18 of file JetAlgoHelper.h.


Generated on Tue Jun 9 17:55:17 2009 for CMSSW by  doxygen 1.5.4