This file is indexed.

/usr/include/ThePEG/PDF/LHAPDF.h is in libthepeg-dev 1.8.0-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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
// -*- C++ -*-
//
// LHAPDF.h 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.
//
#ifndef THEPEG_LHAPDF_H
#define THEPEG_LHAPDF_H
//
// This is the declaration of the LHAPDF class.
//

#include "ThePEG/PDF/PDFBase.h"

namespace ThePEG {

/**
 * The LHAPDF class inherits from PDFBase and implements an interface
 * to the LHAPDF library of parton density function
 * parameterizations. This class is available even if LHAPDF was not
 * properly installed when ThePEG was installed, but will then produce
 * an error in the initialization.
 *
 * Note that the valence densities from the xfvx() and xfvl() function
 * will only work properly for nucleons. All other particles will have
 * zero valence densities.
 *
 * @see \ref LHAPDFInterfaces "The interfaces"
 * defined for LHAPDF.
 */
class LHAPDF: public PDFBase {

public:

  /** Enumerate the allowed particle types. */
  enum PType { nucleonType = 1, /**< (Anti-) proton or neutron. */
	       pionType = 2,    /**< Pion */
	       photonType = 3   /** Photon possible with anomalous component. */
  };

public:

  /** @name Standard constructors and destructors. */
  //@{
  /**
   * The default constructor.
   */
  LHAPDF();

  /**
   * The copy constructor.
   */
  LHAPDF(const LHAPDF &);
  //@}

public:

  /** @name Virtual functions to be overridden by sub-classes. */
  //@{
  /**
   * Return true if this PDF can handle the extraction of partons from
   * the given \a particle.
   */
  virtual bool canHandleParticle(tcPDPtr particle) const;

  /**
   * Return the partons which this PDF may extract from the given
   * \a particle.
   */
  virtual cPDVector partons(tcPDPtr particle) const;

  /**
   * The density. Return the pdf for the given \a parton inside the
   * given \a particle for the virtuality \a partonScale and momentum
   * fraction \a x (with x = 1-\a eps). The \a particle is assumed to
   * have a virtuality \a particleScale.
   */
  virtual double xfx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
		     double x, double eps = 0.0,
		     Energy2 particleScale = ZERO) const;

  /**
   * The valence density. Return the pdf for the given cvalence \a
   * parton inside the given \a particle for the virtuality \a
   * partonScale and logarithmic momentum fraction \a l. The \a
   * particle is assumed to have a virtuality \a particleScale. This
   * will only work properly for nucleons. All other particles will
   * have zero valence densities
   */
  virtual double xfvl(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
		      double l, Energy2 particleScale = ZERO) const;

  /**
   * The valence density. Return the pdf for the given cvalence \a
   * parton inside the given \a particle for the virtuality \a
   * partonScale and momentum fraction \a x (with x = 1-\a eps). The
   * \a particle is assumed to have a virtuality \a
   * particleScale. This will only work properly for nucleons. All
   * other particles will have zero valence densities
   */
  virtual double xfvx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
		      double x, double eps = 0.0,
		      Energy2 particleScale = ZERO) const;

  /**
   * The sea density. Return the pdf for the given cvalence \a
   * parton inside the given \a particle for the virtuality \a
   * partonScale and momentum fraction \a x. The \a particle is
   * assumed to have a virtuality \a particleScale. If not overidden
   * by a sub class this implementation will assume that the
   * difference between a quark and anti-quark distribution is due do
   * valense quarks.
   */
  virtual double xfsx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
		      double x, double eps = 0.0,
		      Energy2 particleScale = ZERO) const;
  //@}


  /** @name Simple access function. */
  //@{
  /**
   * The particle type. 1=nucleon, 2=pion, 3=photon. No checking is
   * done to see if the selected PDF set in LHAPDF actually can handle
   * this type
   */
  PType ptype() const { return thePType; }

  /**
   * The name if the PDF set to be used. The full name including the
   * <code>.LHpdf</code> or <code>.LHgrid</code> suffix.
   */
  const string & PDFName() const { return thePDFName; }

  /**
   * The chosen member of the selected PDF set.
   */
  int member() const { return theMember; }

  /**
   * The maximum number of flavours for which non-zero densities are
   * reported. The actual number of flavours may be less depending on
   * the chosen PDF set.
   */
  int maxFlav() const { return theMaxFlav; }
  //@}

protected:

  /** @name Internal helper functions. */
  //@{
  /**
   * Read a line from the index file
   */
  bool indexLine(istream & is, int & set, int & mem, string & file,
		 int & pdftyp, int & pdfgup, int & pdfsup,
		 double & xmin, double & xmax,
		 double & q2min, double & q2max) const;

  /**
   * Call the Fortran InitPDFSetM function.
   */
  void initpdfsetm() const;

  /**
   * Call the Fortran InitPDFSetM function.
   */
  void initpdfm() const;

  /**
   * Reset the saved values from the last call to xfx(), etc.
   */
  void lastReset() const;

  /**
   * Acquire a new nset number.
   */
  void setnset() const;

  /**
   * Retrieve the number of members in the chosen PDF.
   */
  int getMaxMember() const;

  /**
   * Get the maximum number of flavours available in the chosen PDF.
   */
  int getMaxFlav() const;

  /**
   * Initialize the LHAPDF library for the chosen PDF set if it has
   * not been done before.
   */
  void checkInit() const;

  /**
   * Retrieve new PDF values for the given parameters if they were
   * changed since the last call.
   */
  void checkUpdate(double x, Energy2 Q2, Energy2 P2) const;

  /**
   * Set the maximum number of simultaneous pdfs that can be used in
   * LHAPDF. Should be set to the parameter <code>nmxset</code> in the
   * <code>parmsetup.inc</code> in the installed LHAPDF library. (By
   * default this is set to 3.)
   */
  void setMaxNSet(int);

  /**
   * Get the maximum number of simultaneous pdfs that can be used in
   * LHAPDF.
   */
  int getMaxNSet() const;

  /**
   * Deduce the min/max values of \f$x\f$ and \f$Q^2\f$ for the
   * selected set.
   */
  void setMinMax();

  /**
   * Used by the interface to select a set and member according to a number.
   */
  void setPDFNumber(int n);

  /**
   * Used by the interface to select a get the index number of the
   * currently chosen set and member.
   */
  int getPDFNumber() const;

  /**
   * Used by the interface to select a set and member according to the
   * old PDFLIB numbers.
   */
  void setPDFLIBNumbers(int group, int num);

  /**
   * Used by the interface to select a set and member according to the
   * old PDFLIB numbers.
   */
  string setPDFLIBNumbers(string);

  /**
   * Used by the interface to select a get the old PDFLIB numbers of the
   * currently chosen set and member.
   */
  pair<int,int> getPDFLIBNumbers() const;

  /**
   * Used by the interface to select a set according to a file name.
   */
  void setPDFName(string name);

  /**
   * Used by the interface to select a member in the current set.
   */
  void setPDFMember(int n);

  /**
   * Try to determine the path to where the LHAPDF index file is located.
   */
  static std::string getIndexPath();

  /**
   * Try to find a LHAPDF index file, open it in the given file stream.
   */
  static bool openLHAIndex(ifstream & is);

  /**
   * Interface for simple tests.
   */
  string doTest(string input);
  //@}

public:

  /** @name Functions used by the persistent I/O system. */
  //@{
  /**
   * Function used to write out object persistently.
   * @param os the persistent output stream written to.
   */
  void persistentOutput(PersistentOStream & os) const;

  /**
   * Function used to read in object persistently.
   * @param is the persistent input stream read from.
   * @param version the version number of the object when written.
   */
  void persistentInput(PersistentIStream & is, int version);
  //@}

  /**
   * The standard Init function used to initialize the interfaces.
   * Called exactly once for each class by the class description system
   * before the main function starts or
   * when this class is dynamically loaded.
   */
  static void Init();

protected:

  /** @name Clone Methods. */
  //@{
  /**
   * Make a simple clone of this object.
   * @return a pointer to the new object.
   */
  virtual IBPtr clone() const;

  /** Make a clone of this object, possibly modifying the cloned object
   * to make it sane.
   * @return a pointer to the new object.
   */
  virtual IBPtr fullclone() const;
  //@}

public:

  /** @cond EXCEPTIONCLASSES */
  /** Exception class used if the LHAPDF library was not installed. */
  class NotInstalled: public Exception {};

  /** Function to throw a NotInstalled exception. */
  static void throwNotInstalled();

  /** @endcond */

// If needed, insert declarations of virtual function defined in the
// InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).

protected:

  /** @name Standard Interfaced functions. */
  //@{
  /**
   * Initialize this object after the setup phase before saving an
   * EventGenerator to disk.
   * @throws InitException if object could not be initialized properly.
   */
  virtual void doinit();

  /**
   * Initialize this object. Called in the run phase just before
   * a run begins.
   */
  virtual void doinitrun();

  /**
   * Finalize this object. Called in the run phase just after a
   * run has ended. Used eg. to write out statistics.
   */
  virtual void dofinish();
  //@}

private:

  /**
   * The particle type. 1=nucleon, 2=pion, 3=photon. No checking is
   * done to see if the selected PDF set in LHAPDF actually can handle
   * this type
   */
  PType thePType;

  /**
   * The name if the PDF set to be used. Should be the full name
   * including the <code>.LHpdf</code> or <code>.LHgrid</code> suffix.
   */
  string thePDFName;

  /**
   * The chosen member of the selected PDF set.
   */
  int theMember;

  /**
   * If this is a photon PDF, this describes the option for how to
   * treat the anomalous component.
   */
  int thePhotonOption;

  /**
   * If this PDF allows partonic photons inside a hadron, enable this
   */
  bool enablePartonicGamma;

  /**
   * The verbosity of the output from the LHAPDF library.
   */
  int theVerboseLevel;

  /**
   * The maximum number of flavours for which non-zero densities are
   * reported. The actual number of flavours may be less depending on
   * the chosen PDF set.
   */
  int theMaxFlav;

  /**
   * The LHAPDF nset number (minus one) to be used by this object. If
   * below zero, the object has not been initialized.
   */
  mutable int nset;

  /**
   * Save the last \f$Q^2\f$ value used to avoid recalculation.
   */
  mutable Energy2 lastQ2;

  /**
   * Save the last \f$x\f$ value used to avoid recalculation.
   */
  mutable double lastX;

  /**
   * Save the last \f$P^2\f$ value used for off-shell photon to avoid
   * recalculation.
   */
  mutable Energy2 lastP2;

  /**
   * Save the last function values returned from the LHAPDF library.
   */
  mutable vector<double> lastXF;

  /**
   * The maximum number of simultaneous pdfs that can be used in
   * LHAPDF. Should be set to the parameter <code>nmxset</code> in the
   * <code>parmsetup.inc</code> in the installed LHAPDF library. (By
   * default this is set to 3.)
   */
  static int MaxNSet;

  /**
   * The last nset number used by an LHAPDF object.
   */
  static int lastNSet;

  /**
   * The last names used in the initialization of a given nset number.
   */
  static vector<string> lastNames;

  /**
   * The last mem used in the initialization of a given nset number.
   */
  static vector<int> lastMem;

  /**
   * The minimum \f$x\f$-value for the current PDF set.
   */
  double xMin;

  /**
   * The maximum \f$x\f$-value for the current PDF set.
   */
  double xMax;

  /**
   * The minimum \f$Q^2\f$-value for the current PDF set.
   */
  Energy2 Q2Min;

  /**
   * The maximum \f$Q^2\f$-value for the current PDF set.
   */
  Energy2 Q2Max;

private:

  /**
   * The static object used to initialize the description of this class.
   * Indicates that this is a concrete class with persistent data.
   */
  static ClassDescription<LHAPDF> initLHAPDF;

  /**
   * The assignment operator is private and must never be called.
   * In fact, it should not even be implemented.
   */
  LHAPDF & operator=(const LHAPDF &);

};

}

#include "ThePEG/Utilities/ClassTraits.h"

namespace ThePEG {

/** @cond TRAITSPECIALIZATIONS */

/** This template specialization informs ThePEG about the
 *  base classes of LHAPDF. */
template <>
struct BaseClassTrait<LHAPDF,1> {
  /** Typedef of the first base class of LHAPDF. */
  typedef PDFBase NthBase;
};

/** This template specialization informs ThePEG about the name of
 *  the LHAPDF class and the shared object where it is defined. */
template <>
struct ClassTraits<LHAPDF>
  : public ClassTraitsBase<LHAPDF> {
  /** Return a platform-independent class name */
  static string className() { return "ThePEG::LHAPDF"; }
  /** Return the name of the shared library be loaded to get access to
   *  the LeptonLeptonPDF class and every other class it uses (except
   *  the base class). */
  static string library() { return "ThePEGLHAPDF.so"; }
};

/** @endcond */

}

#endif /* THEPEG_LHAPDF_H */