39                          __begin + delimiter[1],
 
   40                          __begin + delimiter[2]);
 
   46       const size_t n = (N - 1) >> 1;
 
   52                          __begin + delimiter[ n ],
 
   53                          __begin + delimiter[N-1]);
 
   92       return std::numeric_limits<T>::max();
 
  108       for (
T q = __begin, p = q++; q != __end; ++p, ++q) {
 
  126 int main(
int argc, 
char **argv)
 
  136     JParser<> zap(
"Example program to test performance of merge sort.");
 
  144   catch(
const exception &error) {
 
  145     FATAL(error.what() << endl);
 
  151   if (rate_Hz <= 0.0) {
 
  152     FATAL(
"Rate " << rate_Hz << 
" < 0 Hz." << endl);
 
  155   const double period = 1.0e9 / rate_Hz;      
 
  157   const double Tmin   = 0.0;                  
 
  158   const double Tmax   = 1.0e8;                
 
  161   const int NUMBER_OF_MODULES = 115 * 18;
 
  165   typedef double                     hit_type; 
 
  166   typedef JGetElement<hit_type>      JGetElement_t;
 
  167   const   JGetElement_t              getElement;
 
  178     for (
double t1 = Tmin + gRandom->Exp(period); t1 < Tmax; t1 += gRandom->Exp(period)) {
 
  179       input[i].push_back(getElement(t1));
 
  182     NOTICE(
"PMT[" << setw(2) << i << 
"]  " << input[i].size() << endl);
 
  184     input[i].push_back(JGetElement_t::getEndMarker());
 
  190     JTimer timer(
"std::sort");
 
  196     for (
int i = 0; i != NUMBER_OF_MODULES; ++i) {
 
  201         copy(input[i].begin(), input[i].end() - 1, back_inserter(buffer));
 
  204       std::sort(buffer.begin(), buffer.end());
 
  207         FATAL(
"std::sort failed." << endl);
 
  212     timer.print(cout, 
false);
 
  217     JTimer timer(
"std::inplace_merge");
 
  225     for (
int i = 0; i != NUMBER_OF_MODULES; ++i) {
 
  230         n += input[i].size() - 1;
 
  235       JBuffer1D::iterator out = buffer.begin();      
 
  241         out = 
copy(input[i].begin(), input[i].end() - 1, out);
 
  243         delimiter[i+1] = 
distance(buffer.begin(), out);
 
  246       inplace_merge(buffer.begin(), delimiter.size(), delimiter.data());
 
  249         FATAL(
"std::inplace_merge failed." << endl);
 
  254     timer.print(cout, 
false);
 
  259     JTimer timer(
"JMergeSort");
 
  262     JMergeSort<hit_type> merge;
 
  266     for (
int i = 0; i != NUMBER_OF_MODULES; ++i) {
 
  270       merge(input, buffer);
 
  273         FATAL(
"JMergeSort failed." << endl);
 
  278     timer.print(cout, 
false);
 
Utility class to parse command line options. 
 
int main(int argc, char *argv[])
 
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
do set_variable OUTPUT_DIRECTORY $WORKDIR T
 
General purpose messaging. 
 
Utility class to parse command line options. 
 
alias put_queue eval echo n
 
void copy(const Head &from, JHead &to)
Copy header from from to to. 
 
static const int NUMBER_OF_PMTS
Total number of PMTs in module. 
 
then usage $script[input file[working directory[option]]] nWhere option can be N