This file is indexed.

/usr/include/ThePEG/PDF/PartonExtractor.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
// -*- C++ -*-
//
// PartonExtractor.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_PartonExtractor_H
#define ThePEG_PartonExtractor_H
// This is the declaration of the PartonExtractor class.

#include "ThePEG/Handlers/HandlerBase.h"
#include "ThePEG/Handlers/LastXCombInfo.h"
#include "ThePEG/PDF/PartonBin.h"
#include "ThePEG/PDF/PartonBinInstance.h"
#include "ThePEG/PDF/PDFBase.h"
#include "ThePEG/PDT/ParticleData.h"
#include "PartonExtractor.xh"

namespace ThePEG {

/**
 * The PartonExtractor is a base class defining the interface to
 * objects responsible for extracting partons from particles. It is
 * used by a SubProcessHandler which combines one PartonExtractor with
 * a number of MEBase objects which are the used in an XComb in a
 * StandardEventHandler to generate hard sub-processes.
 *
 * PartonExtractor inherits from the general HandlerBase class and
 * from the LastXCombInfo class to have easy acces to information
 * about the currently chosen hard sub-process.
 *
 * @see \ref PartonExtractorInterfaces "The interfaces"
 * defined for PartonExtractor.
 * @see SubProcessHandler
 * @see MEBase
 * @see EventHandler
 * @see StandardEventHandler
 * @see XComb
 * @see HandlerBase
 *
 */
class PartonExtractor: public HandlerBase, public LastXCombInfo<> {

  /** XComb is a friend. */
  friend class XComb;

public:

  /** A map of PartonBinInstance objects indexed by the extracted parton. */
  typedef map<cPPtr,PBIPtr> PartonBinInstanceMap;

public:

  /** @name Standard constructors and destructors. */
  //@{
  /**
   * Default constructor.
   */
  PartonExtractor();

  /**
   * Destructor.
   */
  virtual ~PartonExtractor();
  //@}

public:

  /** @name Virtual functions which may be overridden in sub-classes. */
  //@{
  /**
   * Return true if this parton extractor can handle the given types
   * of incoming particles.
   */
  virtual bool canHandle(const cPDPair &) { return true; }

  /**
   * Return a vector of possible pairs of parton bins which can be
   * produced within a given maximum total particle-particle
   * invariant mass squared, \a maxEnergy sBin.
   */
  virtual PartonPairVec getPartons(Energy maxEnergy, const cPDPair &,
				   const Cuts &) const;

  /**
   * May be overriden by sub-classes which have their own oppinion
   * about what scale to use in a hard subprocess. The default version
   * simply returns the previously selected scale.
   */
  virtual Energy2 newScale();

  /**
   * Connect the remnants with the colour lines of the extracted
   * parton.
   */
  virtual void colourConnect(tPPtr particle, tPPtr parton,
			     const tPVector & remnants) const;

  /**
   * If remnants has already been created for the given parton, remove
   * them from the given step and generate new remnants corresponding
   * to the parton newp and add them to the step. The new parton bins
   * are returned.
   * @throws Veto if remnant generation failed for whatever reason.
   */
  virtual PBIPair newRemnants(tPPair oldp, tPPair newp, tStepPtr step);

  /**
   * Determine the number of random numbers needed to calculate
   * \f$\hat{s}\f$ and the product of all densitiy functions.
   */
  virtual pair<int,int> nDims(const PBPair & pbins);

  /**
   * Prepare the given parton bin instances for generating a new
   * event.
   */
  virtual void prepare(const PBIPair & pbins);

  /**
   * Generate \f$l=\log(1/x)\f$ for all parton extractions.
   */
  virtual bool generateL(const PBIPair & pbins,
			 const double * r1, const double * r2);

  /**
   * Used by generateL() for each of the final parton
   * bins. Direction<0> is set to positive(negative) for the
   * first(second) final bin.
   */
  virtual void generateL(PartonBinInstance & pb, const double * r);

  /**
   * Generate the rest of the degrees of freedom to calculate
   * \f$\hat{s}\f$ and the product of all densitiy functions.
   */
  virtual Energy2 generateSHat(Energy2 s, const PBIPair & pbins,
			       const double * r1, const double * r2,
			       bool mepartons = false);

  /**
   * Return the product of all density functions. If noLastPDF.first
   * (.second) is true, then the PDF value multiplied by the momentum 
   * fraction for the last extracted parton from the first (second) 
   * incoming particle will be excluded.
   */
  virtual double fullFn(const PBIPair & pbins, Energy2 scale,
			pair<bool,bool> noLastPDF = make_pair(false,false));

  /**
   * Construct remnants and add them to the step.
   */
  virtual void construct(const PBIPair & pbins, tStepPtr step) const;

  /**
   * Construct remnants for partons created outside of this
   * extractor. Information about the incoming partons should be set
   * in \a pbins and the hard subprocess should be present in \a
   * sub. Generated remnants will be added to the \a step.
   * @throws Veto if remnant generation failed for whatever reason.
   */
  virtual void constructRemnants(const PBIPair & pbins, tSubProPtr sub,
			 tStepPtr step) const;

  /**
   * Get boost for hard subsystem and boost remnants. To be called
   * after re-constructing remnants and obtaining new momenta of the
   * partons entering the hard subsystem, but ignoring detailed energy
   * and momentum conservation. Perform boosts of the remnants to
   * conserve energy and momentum and return the boost needed for the
   * hard subsystem. \a bins contains the current state of the
   * incoming partons, including the momenta obtained after the
   * remnant generation. \a k1 and \a k2 contains the momenta of the
   * incoming partons before the remnant generation. If either side
   * has no new remnants, \a side1 and/or \a side2 should be false.
   */
  virtual LorentzRotation
  boostRemnants(PBIPair & bins, LorentzMomentum k1, LorentzMomentum k2,
	   bool side1, bool side2) const;
  //@}

  /** @name Access information about the current paron extraction. */
  //@{
  /**
   * Return the corresponding parton bin instance for a given
   * extracted parton.
   */
  tPBIPtr partonBinInstance(tcPPtr) const;

  /**
   * Set the XComb object describing the current hard sub-process.
   */
  void select(tXCombPtr newXComb);

  //@}

  /**
   * The maximum number of attempts allowed when trying to generate
   * remnants.
   */
  int maxTries() const { return theMaxTries; }

  /**
   * Return the PDFBase object to be used for the incoming particle
   * type. If one of theSpecialDensities matches the particle type it
   * is returned, otherwise if particle is a BeamParticleData use the
   * PDFBase object specified there. If also this fails, return a
   * NoPDF object.
   */
  tcPDFPtr getPDF(tcPDPtr particle) const;

protected:

  /** @name Functions used by the main virtual functions. Some of
      these may be overridden in sub-classes. */
  //@{

  /**
   * Used by generateSHat() for each of the final parton
   * bins. Direction<0> is set to positive(negative) for the
   * first(second) final bin, \a pb. Should ask the remnant handler to
   * generate what is needed to construct the extracted parton
   * momentum. \a r is a pointer to an array of random numbers to be
   * used and \a shat is the approximate invariant mass squared of the
   * hard system produced by the extracted parton and the primary
   * parton from the other side. \a first is the momentum of the
   * original incoming particle.
   *
   * @return false if no remnants could be generated.
   */
  virtual bool generate(PartonBinInstance & pb, const double * r,
			Energy2 shat, const Lorentz5Momentum & first,
			bool haveMEPartons = false);

  /**
   * Used by the public fullFn() for each of the final parton bins.
   */
  virtual double fullFn(const PartonBinInstance & pb,
			bool noLastPDF = false);

  /**
   * Used by the public construct() for each of the final parton
   * bins. If boost is false, no boost is necessary to give the
   * remnants proper momenta. 
   */
  virtual void construct(PartonBinInstance & pb,
			 tStepPtr step, bool boost = true) const;

  /**
   * Used by the public newRemnants() for each of the parton bins.
   * @throws Veto if remnant generation failed for whatever reason.
   */
  PBIPtr newRemnants(tPBIPtr oldpb, tPPtr newp, const LorentzMomentum & k);

  /**
   * Used by the public newRemnants() for each of the parton bins.
   */
  void addNewRemnants(tPBIPtr oldpb, tPBIPtr newpb, tStepPtr step);

  /**
   * Transform remnant momentum. Assuming remnants have been generated
   * with momentum \a Pr without considering energy-momentum
   * conservation, shift the momentum, possibly compensating with the
   * momentum of the hard subsystem, \a Ph. For information the
   * momentum of the parton entering the hard subsystem from the other
   * side, \a k, and the momentum of the remnants parent particle , \a
   * P is given. Note that Direction<0> must be set to determine if
   * the parent particle is to be assumed to go in the positive or
   * negative direction.
   */
  virtual void transformRemnants(LorentzMomentum & Ph, LorentzMomentum & Pr,
				 const LorentzMomentum & k,
				 const LorentzMomentum & P) const;

  /**
   * Construct remnants recursively for the parton represented by \a
   * pb. Used by constructRemnants(const PBIPair &, tSubProPtr, tStepPtr).
   * Shift the momentum, \a Ph, of the hard subsystem to conserve
   * energy and momentum if necessary. The momentum, \a k, of the
   * parton coming into the hard subsystem from the other side is
   * given for information. Note that Direction<0> must be set to
   * determine if the parent particle is to be assumed to go in the
   * positive or negative direction.
   * @throws Veto if remnant generation failed for whatever reason.
   */
  virtual void
  constructRemnants(PartonBinInstance & pb, LorentzMomentum & Ph,
		    const LorentzMomentum & k) const;
  //@}

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);
  //@}

  /**
   * Standard Init function used to initialize the interface.
   */
  static void Init();

protected:

  /**
   * Add parton bins to pbins for the given incoming particle and the
   * specified cuts.
   */
  virtual void addPartons(tPBPtr incoming ,const PDFCuts & cuts,
			  tcPDFPtr pdf ,PartonVector & pbins) const;

  /**
   * The NoPDF object.
   */
  tcPDFPtr noPDF() const { return theNoPDF; }

  /**
   * Connect the first (\a anti) coloured particle in the given range
   * (not equal to \a parton) and connect it to the colour \a line.
   */
  template <typename Iterator>
  void findConnect(tColinePtr line, tPPtr parton, bool anti,
		   Iterator first, Iterator last) const {
    for ( ; first != last; ++first ) {
      if ( *first != parton &&  (**first).hasColour(anti) &&
	   !(**first).colourLine(anti) ) {
	line->addColoured(*first, anti);
	return;
      }
    }
    throw RemColException(*this);
  }

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;
  //@}

  /** @name Standard Interfaced functions. */
  //@{

  /**
   * 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 PartonBinInstance's used mapped to the respective partons.
   */
  mutable PartonBinInstanceMap partonBinInstances;

  /**
   * A list of special PDFBase objects to be used.
   */
  vector<PDFPtr> theSpecialDensities;

  /**
   *  PDFBase object to override  first PDF
   */
  PDFPtr theFirstPDF;

  /**
   *  PDFBase object to override second PDF
   */
  PDFPtr theSecondPDF;

  /**
   * The NoPDF object.
   */
  PDFPtr theNoPDF;

  /**
   * The maximum number of tries allowed when trying to produce
   * remnants.
   */
  int theMaxTries;

  /**
   * True if this extractor should override the \f$l\f$-generation in
   * the PDFs and generate a flat distribution in \f$\log(\hat{s})\f$
   * and y.
   */
  bool flatSHatY;

private:

  /**
   * Describe a concrete class with persistent data.
   */
  static ClassDescription<PartonExtractor> initPartonExtractor;

  /**
   *  Private and non-existent assignment operator.
   */
  PartonExtractor & operator=(const PartonExtractor &);

};

/** @cond TRAITSPECIALIZATIONS */

/** This template specialization informs ThePEG about the base classes
 *  of PartonExtractor. */
template <>
struct BaseClassTrait<PartonExtractor,1>: public ClassTraitsType {
  /** Typedef of the first base class of PartonExtractor. */
  typedef HandlerBase NthBase;
};

/** This template specialization informs ThePEG about the name of the
 *  PartonExtractor class. */
template <>
  /** Return a platform-independent class name */
struct ClassTraits<PartonExtractor>: public ClassTraitsBase<PartonExtractor> {
  static string className() { return "ThePEG::PartonExtractor"; }
};

/** @endcond */

}

#endif /* ThePEG_PartonExtractor_H */