/usr/include/ThePEG/Interface/Interfaced.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 | // -*- C++ -*-
//
// Interfaced.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_Interfaced_H
#define ThePEG_Interfaced_H
// This is the declaration of the Interfaced class.
#include "ThePEG/Config/ThePEG.h"
#include "InterfacedBase.h"
#include "ThePEG/PDT/PID.h"
namespace ThePEG {
/**
* The Interfaced class is derived from the InterfacedBase class
* adding a couple of things particular to ThePEG, in an attempt to
* keep the InterfacedBase class as generic as possible.
*
* The main addition is that the Interfaced class has a pointer to an
* EventGenerator object. During the run-phase this points to the
* EventGenerator controlling the run in which the Interfaced object
* is used. Through this EventGenerator there is quick access to
* eg. the set of ParticleData objects used, and the default
* RandomGenerator for the run. Note that no EventGenerator object is
* available to the Interfaced object during the setup
* phase.
*
* @see InterfacedBase
* @see EventGenerator
* @see ParticleData
* @see RandomGenerator
*/
class Interfaced: public InterfacedBase {
/** Repository is a friend. */
friend class Repository;
/** EventGenerator is a friend. */
friend class EventGenerator;
public:
/**
* Empty virtual destructor
*/
virtual ~Interfaced();
/**
* Functions which are to be used during the actual event
* generation, after the setup is complete.
*/
public:
/**
* A sub class can implement this function to implement some default
* initialization for this object during the setup phase. A typical
* example is if this object need some references to other objects
* and if these can be easily created. In this case the objects can
* be added to the repository in a sub-directory with the same name
* as this object.
* @return false if the initialization failed.
*/
virtual bool defaultInit();
/** @name Functions used during the actual event generation, after
the setup is complete. */
//@{
/**
* Create a new Particle instance given a id number.
*/
PPtr getParticle(PID) const;
/**
* Return a pointer to the ParticleData object corresponding to the
* given id number.
*/
PDPtr getParticleData(PID) const;
/**
* Returns true if this object has actally been used.
*/
bool used() const { return theUseFlag; }
/**
* Should be called to indicate that this object has actually been
* used.
*/
void useMe() const { if ( !used() ) setUsed(); }
/**
* Return a pointer to the EventGenerator controlling the run.
* During the setup phase this returns a null pointer.
*/
tEGPtr generator() const { return theGenerator; }
//@}
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.
*/
static void Init();
protected:
/**
* Register an Interfaced object with the Repository.
*/
static void registerRepository(IBPtr);
/**
* Register an Interfaced object with the Repository, giving it a
* name.
*/
static void registerRepository(IBPtr, string newName);
/**
* Register the given \a object in the Repository with the given \a
* name in a subdirectory with the same name as this object. If an
* object with that name already exists it will be removed unless
* there are other objects referring to it, in which case it will be
* renamed.
*/
void reporeg(IBPtr object, string name) const;
/**
* If the pointer, \a ptr, to an object is not set, create an object
* of class \a classname and register it with the Repository with
* the given \a objectname in a sib-directory with the same name as
* this object.
*/
template <typename PtrT>
bool setDefaultReference(PtrT & ptr, string classname, string objectname) {
if ( ptr ) return true;
const ClassDescriptionBase * db = DescriptionList::find(classname);
if ( !db ) return false;
ptr = dynamic_ptr_cast<PtrT>(db->create());
if ( !ptr ) return false;
reporeg(ptr, objectname);
if ( !ptr->defaultInit() ) return false;
return true;
}
/**
* Protected default constructor.
*/
Interfaced() : theUseFlag(false) {}
/**
* Protected constructor taking a name as argument.
*/
Interfaced(const string & newName)
: InterfacedBase(newName), theUseFlag(false) {}
/**
* Protected copy-constructor.
*/
Interfaced(const Interfaced & i)
: InterfacedBase(i), theGenerator(i.theGenerator), theUseFlag(false) {}
protected:
/**
* Protected function to reset the generator pointer, required
* for automatic decayer generation in Herwig++ BSM models
*/
void setGenerator(tEGPtr generator) { theGenerator=generator; }
private:
/**
* Used internally by 'useMe'
*/
void setUsed() const;
/**
* A pointer to the EventGenerator controlling the run.
*/
tEGPtr theGenerator;
/**
* Flag to tell whether this object has been used or not.
*/
mutable bool theUseFlag;
/**
* Command interface function which calls defaultInit().
*/
string doDefaultInit(string);
private:
/**
* Standard Initialization object.
*/
static AbstractClassDescription<Interfaced> initInterfaced;
/**
* Private and non-existent assignment operator.
*/
Interfaced & operator=(const Interfaced &);
};
/** @cond TRAITSPECIALIZATIONS */
/**
* This template specialization informs ThePEG about the
* base class of Interfaced.
*/
template <>
struct BaseClassTrait<Interfaced,1>: public ClassTraitsType {
/** Typedef of the base class of Interfaced. */
typedef InterfacedBase NthBase;
};
/**
* This template specialization informs ThePEG about the name of the
* Interfaced class.
*/
template <>
struct ClassTraits<Interfaced>: public ClassTraitsBase<Interfaced> {
/** Return the class name. */
static string className() { return "ThePEG::Interfaced"; }
};
/** @endcond */
}
#endif /* ThePEG_Interfaced_H */
|