This file is indexed.

/usr/include/ThePEG/Utilities/Selector.tcc is in libthepeg-dev 1.8.0-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// -*- C++ -*-
//
// Selector.tcc is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//

namespace ThePEG {

template <typename T, typename WeightType>
WeightType Selector<T,WeightType>::erase(const T & t) {
  Selector<T,WeightType> newSelector;
  WeightType oldsum = WeightType();
  for ( iterator it = theMap.begin();
	it != theMap.end(); ++it ) {
    WeightType r = it->first - oldsum;
    oldsum = it->first;
    if ( it->second != t ) newSelector.insert(r, it->second);
  }
  theMap.swap(newSelector.theMap);
  return theSum = newSelector.theSum;
}

template <typename T, typename WeightType>
const T & Selector<T,WeightType>::
select(double rnd, double * remainder) const throw(range_error) {
  if ( rnd <= 0 )
    throw range_error("Random number out of range in Selector::select.");
  const_iterator it = theMap.upper_bound(rnd*theSum);
  if ( it == theMap.end() )
    throw range_error("Empty Selector, or random number out of range "
		      "in Selector::select");
  if ( remainder ) {
    if ( it == theMap.begin() )
      *remainder = rnd*theSum/(it->first);
    else {
      const_iterator prit = it;
      --prit;
      *remainder = (rnd*theSum - prit->first)/(it->first - prit->first);
    }
  }
  return it->second;
}

template <typename T, typename WeightType>
T & Selector<T,WeightType>::
select(double rnd, double * remainder) throw(range_error) {
  if ( rnd <= 0 )
    throw range_error("Random number out of range in Selector::select.");
  iterator it = theMap.upper_bound(rnd*theSum);
  if ( it == theMap.end() )
    throw range_error("Empty Selector, or random number out of range "
		      "in Selector::select");
  if ( remainder ) {
    if ( it == theMap.begin() )
      *remainder = rnd*theSum/(it->first);
    else {
      const_iterator prit = it;
      --prit;
      *remainder = (rnd*theSum - prit->first)/(it->first - prit->first);
    }
  }
  return it->second;
}

template <typename T, typename WeightType>
template <typename OStream>
void Selector<T,WeightType>::output(OStream & os) const {
  os << ounit(theSum,TypeTraits<WeightType>::baseunit) << size();
  for ( const_iterator it = theMap.begin(); it != theMap.end(); ++it )
    os << ounit(it->first,TypeTraits<WeightType>::baseunit) << it->second;
}

template <typename T, typename WeightType>
template <typename IStream>
void Selector<T,WeightType>::input(IStream & is) {
  typedef typename MapType::value_type value_type;
  clear();
  T t;
  WeightType weightsum;
  long n;
  is >> iunit(theSum,TypeTraits<WeightType>::baseunit) >> n;
  while ( n-- ) {
    is >> iunit(weightsum,TypeTraits<WeightType>::baseunit) >> t;
    theMap.insert(theMap.end(), value_type(weightsum, t));
  }
}

}