This file is indexed.

/usr/include/HepMC/WeightContainer.h is in libhepmc-dev 2.06.09-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
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
//--------------------------------------------------------------------------
#ifndef HEPMC_WEIGHT_CONTAINER_H
#define HEPMC_WEIGHT_CONTAINER_H

//////////////////////////////////////////////////////////////////////////
// Matt.Dobbs@Cern.CH, November 2000, refer to:
// M. Dobbs and J.B. Hansen, "The HepMC C++ Monte Carlo Event Record for
// High Energy Physics", Computer Physics Communications (to be published).
//
// Container for the Weights associated with an event or vertex.
//
// This implementation adds a map-like interface in addition to the 
// vector-like interface.
//////////////////////////////////////////////////////////////////////////

#include <iostream>
#include <vector>
#include <string>
#include <map>

namespace HepMC {

    //! Container for the Weights associated with an event or vertex.

    ///
    /// \class  WeightContainer
    /// This class has both map-like and vector-like functionality.
    /// Named weights are now supported.
    class WeightContainer {
	friend class GenEvent;

    public:
        /// defining the size type used by vector and map
	typedef std::size_t size_type;
        /// iterator for the weight container
	typedef std::vector<double>::iterator iterator;
        /// const iterator for the weight container
	typedef std::vector<double>::const_iterator const_iterator;
	
        /// default constructor
	explicit WeightContainer( size_type n = 0, double value = 0. );
        /// construct from a vector of weights
	WeightContainer( const std::vector<double>& weights );
        /// copy
	WeightContainer( const WeightContainer& in );
	~WeightContainer();

        /// swap
        void swap( WeightContainer & other);
        /// copy assignment
	WeightContainer& operator=( const WeightContainer& );
        /// alternate assignment using a vector of doubles
	WeightContainer& operator=( const std::vector<double>& in );

        /// print weights
	void          print( std::ostream& ostr = std::cout ) const;
        /// write weights in a readable table
	void          write( std::ostream& ostr = std::cout ) const;

        /// size of weight container
	size_type     size() const;
	/// return true if weight container is empty
	bool          empty() const;
	/// push onto weight container
	void          push_back( const double& );
	/// pop from weight container
	void          pop_back();
	/// clear the weight container
	void          clear();

	/// check to see if a name exists in the map
	bool          has_key( const std::string& s ) const;

        /// access the weight container
	double&       operator[]( size_type n );  // unchecked access
        /// access the weight container
	const double& operator[]( size_type n ) const;
        /// access the weight container
	double&       operator[]( const std::string& s );  // unchecked access
        /// access the weight container
	const double& operator[]( const std::string& s ) const;

        /// equality
	bool operator==( const WeightContainer & ) const;
        /// inequality
	bool operator!=( const WeightContainer & ) const;
 	
	/// returns the first element
	double&       front();
	/// returns the first element
	const double& front() const;   
	/// returns the last element
	double&       back();
	/// returns the last element
	const double& back() const;

	/// begining of the weight container
	iterator            begin();
	/// end of the weight container
	iterator            end();
	/// begining of the weight container
	const_iterator      begin() const;
	/// end of the weight container
	const_iterator      end() const;

    private:
        // for internal use only

        /// maplike iterator for the weight container
	/// for internal use only
	typedef std::map<std::string,size_type>::iterator       map_iterator;
        /// const iterator for the weight container
	/// for internal use only
	typedef std::map<std::string,size_type>::const_iterator const_map_iterator;
	/// begining of the weight container
	/// for internal use only
	map_iterator            map_begin();
	/// end of the weight container
	/// for internal use only
	map_iterator            map_end();
	/// begining of the weight container
	/// for internal use only
	const_map_iterator      map_begin() const;
	/// end of the weight container
	/// for internal use only
	const_map_iterator      map_end() const;
	
	/// used by the constructors to set initial names
	/// for internal use only
	void set_default_names( size_type n );
	
    private:
	std::vector<double>          m_weights;
	std::map<std::string,size_type> m_names;
    };

    ///////////////////////////
    // INLINES               //
    ///////////////////////////

    inline WeightContainer::WeightContainer( const WeightContainer& in )
	: m_weights(in.m_weights), m_names(in.m_names)
    {}

    inline WeightContainer::~WeightContainer() {}

    inline void WeightContainer::swap( WeightContainer & other)
    { 
        m_weights.swap( other.m_weights ); 
        m_names.swap( other.m_names ); 
    }

    inline WeightContainer& WeightContainer::operator=
    ( const WeightContainer& in ) {
        /// best practices implementation
	WeightContainer tmp( in );
	swap( tmp );
	return *this;
    }

    inline WeightContainer& WeightContainer::operator=
    ( const std::vector<double>& in ) {
        /// best practices implementation
	WeightContainer tmp( in );
	swap( tmp );
	return *this;
    }

    inline WeightContainer::size_type WeightContainer::size() const { return m_weights.size(); }

    inline bool WeightContainer::empty() const { return m_weights.empty(); }

    inline void WeightContainer::clear() 
    { 
	m_weights.clear(); 
	m_names.clear(); 
    }

    inline double& WeightContainer::operator[]( size_type n ) 
    { return m_weights[n]; }

    inline const double& WeightContainer::operator[]( size_type n ) const
    { return m_weights[n]; }

    inline double& WeightContainer::front() { return m_weights.front(); }

    inline const double& WeightContainer::front() const 
    { return m_weights.front(); }

    inline double& WeightContainer::back() { return m_weights.back(); }

    inline const double& WeightContainer::back() const 
    { return m_weights.back(); }

    inline WeightContainer::iterator WeightContainer::begin() 
    { return m_weights.begin(); }

    inline WeightContainer::iterator WeightContainer::end() 
    { return m_weights.end(); }

    inline WeightContainer::const_iterator WeightContainer::begin() const 
    { return m_weights.begin(); }

    inline WeightContainer::const_iterator WeightContainer::end() const 
    { return m_weights.end(); }

    inline WeightContainer::map_iterator WeightContainer::map_begin() 
    { return m_names.begin(); }

    inline WeightContainer::map_iterator WeightContainer::map_end() 
    { return m_names.end(); }

    inline WeightContainer::const_map_iterator WeightContainer::map_begin() const 
    { return m_names.begin(); }

    inline WeightContainer::const_map_iterator WeightContainer::map_end() const 
    { return m_names.end(); }

} // HepMC

#endif  // HEPMC_WEIGHT_CONTAINER_H
//--------------------------------------------------------------------------