Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:24:07

0001 // -*- C++ -*-
0002 //
0003 // FxFxReader.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 //
0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef THEPEG_FxFxReader_H
0010 #define THEPEG_FxFxReader_H
0011 // This is the declaration of the FxFxReader class.
0012 
0013 #include "FxFx.h"
0014 #include "ThePEG/Handlers/HandlerBase.h"
0015 #include "ThePEG/Utilities/ObjectIndexer.h"
0016 #include "ThePEG/Utilities/Exception.h"
0017 #include "ThePEG/Utilities/XSecStat.h"
0018 #include "ThePEG/PDF/PartonBinInstance.h"
0019 #include "ThePEG/PDF/PartonBin.fh"
0020 #include "ThePEG/MatrixElement/ReweightBase.h"
0021 #include "FxFxEventHandler.fh"
0022 #include "FxFxReader.fh"
0023 #include "ThePEG/Utilities/CFile.h"
0024 #include <cstdio>
0025 #include <cstring>
0026 
0027 namespace ThePEG {
0028 
0029 /**
0030  * FxFxReader is an abstract base class to be used for objects
0031  * which reads event files or streams from matrix element
0032  * generators. Derived classes must at least implement the open() and
0033  * doReadEvent() methods to read in information about the whole run into
0034  * the HEPRUP variable and next event into the HEPEUP variable
0035  * respectively. Also the close() function to close the file or stream
0036  * read must be implemented. Although these functions are named as if
0037  * we are reading from event files, they could just as well implement
0038  * the actual generation of events.
0039  *
0040  * After filling the HEPRUP and HEPEUP variables, which are protected
0041  * and easily accesible from the sub-class, this base class will then
0042  * be responsible for transforming this data to the ThePEG Event
0043  * record in the getEvent() method. <code>FxFxReader</code>s can
0044  * only be used inside FxFxEventHandler objects.
0045  *
0046  * In the initialization the virtual open() and scan() functions are
0047  * called. Here the derived class must provide the information about
0048  * the processes in the variables corresponding to the HEPRUP common
0049  * block. Note that the IDWTUP is required to be +/- 1, and sub
0050  * classes are required to change the information accordingly to
0051  * ensure the correct corss section sampling. Note also that the
0052  * controlling FxFxEventHandler may choose to generate weighted
0053  * events even if IDWTUP is 1.
0054  *
0055  * Note that the information given per process in e.g. the XSECUP and
0056  * XMAXUP vectors is not used by the FxFxEventHandler and by
0057  * default the FxFxReader is not assumed to be able to actively
0058  * choose between the sub-processes. Instead, the
0059  * FxFxEventHandler can handle several FxFxReader objects
0060  * and choose between them. However, a sub-class of FxFxReader
0061  * may set the flag isActive, in which case it is assumed to be able
0062  * to select between its sub-processes itself.
0063  *
0064  * The FxFxReader may be assigned a number ReweightBase objects
0065  * which either completely reweights the events produced (in the
0066  * reweights vector), or only biases the selection without influencing
0067  * the cross section (in the preweights vector). Note that it is the
0068  * responsibility of a sub-class to call the reweight() function and
0069  * multiply the weight according to its return value (typically done
0070  * in the readEvent() function).
0071  *
0072  * @see \ref FxFxReaderInterfaces "The interfaces"
0073  * defined for FxFxReader.
0074  * @see Event
0075  * @see FxFxEventHandler
0076  */
0077 class FxFxReader: public HandlerBase, public LastXCombInfo<> {
0078 
0079   /**
0080    * FxFxEventHandler should have access to our private parts.
0081    */
0082   friend class FxFxEventHandler;
0083 
0084   /**
0085    * Map for accumulating statistics of cross sections per process
0086    * number.
0087    */
0088   typedef map<int,XSecStat> StatMap;
0089 
0090   /**
0091    * Map of XComb objects describing the incoming partons indexed by
0092    * the corresponding PartonBin pair.
0093    */
0094   typedef map<tcPBPair,XCombPtr> XCombMap;
0095 
0096   /**
0097    * A vector of pointers to ReweightBase objects.
0098    */
0099   typedef vector<ReweightPtr> ReweightVector;
0100 
0101 public:
0102 
0103   /** @name Standard constructors and destructors. */
0104   //@{
0105   /**
0106    * Default constructor. If the optional argument is true, the reader
0107    * is assumed to be able to produce events on demand for a given
0108    * process.
0109    */
0110   FxFxReader(bool active = false);
0111 
0112   /**
0113    * Copy-constructor.
0114    */
0115   FxFxReader(const FxFxReader &);
0116 
0117   /**
0118    * Destructor.
0119    */
0120   virtual ~FxFxReader();
0121   //@}
0122 
0123 public:
0124 
0125   /** @name Main virtual fuctions to be overridden in
0126    *  sub-classes. They are named as if we are reading from event
0127    *  files, but could equally well implement the actual generation of
0128    *  events. */
0129   //@{
0130   /**
0131    * Open a file or stream with events and read in the run information
0132    * into the heprup variable.
0133    */
0134   virtual void open() = 0;
0135 
0136   /**
0137    * Read the next event from the file or stream into the
0138    * corresponding protected variables. Return false if there is no
0139    * more events.
0140    */
0141   virtual bool doReadEvent() = 0;
0142 
0143   /**
0144    * Close the file or stream from which events have been read.
0145    */
0146   virtual void close() = 0;
0147 
0148   /**
0149    * return the weight names 
0150    */
0151   //  virtual vector<string> optWeightsNamesFunc();
0152   virtual vector<string> optWeightsNamesFunc() = 0;
0153   //virtual vector<string*> optWeightNamesFunc() = 0;
0154   vector<string> optionalWeightsNames;
0155   
0156   /** 
0157    * The ID (e.g. 100x, 2001) for the weight
0158    */ 
0159 
0160   // vector<string> optionalWeightsNames;
0161 
0162   
0163   //@}
0164 
0165   /** @name Other important function which may be overridden in
0166    *  sub-classes which wants to bypass the basic HEPRUP or HEPEUP
0167    *  variables or otherwise facilitate the conversion to ThePEG
0168    *  objects. */
0169   //@{
0170   /**
0171    * Initialize. This function is called by the FxFxEventHandler
0172    * to which this object is assigned.
0173    */
0174   virtual void initialize(FxFxEventHandler & eh);
0175 
0176   /**
0177    * Calls readEvent() or uncacheEvent() to read information into the
0178    * FxFx common block variables. This function is called by the
0179    * FxFxEventHandler if this reader has been selectod to
0180    * produce an event.
0181    *
0182    * @return the weight asociated with this event. If negative weights
0183    * are allowed it should be between -1 and 1, otherwise between 0
0184    * and 1. If outside these limits the previously estimated maximum
0185    * is violated. Note that the estimated maximum then should be
0186    * updated from the outside.
0187    */
0188   virtual double getEvent();
0189 
0190   /**
0191    * Calls doReadEvent() and performs pre-defined reweightings. A
0192    * sub-class overrides this function it must make sure that the
0193    * corresponding reweightings are done.
0194    */
0195   virtual bool readEvent();
0196 
0197   /**
0198    * Skip \a n events. Used by FxFxEventHandler to make sure
0199    * that a file is scanned an even number of times in case the events
0200    * are not ramdomly distributed in the file.
0201    */
0202   virtual void skip(long n);
0203 
0204   /**
0205    * Get an XComb object. Converts the information in the Les Houches
0206    * common block variables to an XComb object describing the sub
0207    * process. This is the way information is conveyed from the reader
0208    * to the controlling FxFxEventHandler.
0209    */
0210   tXCombPtr getXComb();
0211 
0212   /**
0213    * Get a SubProcess object corresponding to the information in the
0214    * Les Houches common block variables.
0215    */
0216   tSubProPtr getSubProcess();
0217 
0218   /**
0219    * Scan the file or stream to obtain information about cross section
0220    * weights and particles etc. This function should fill the
0221    * variables corresponding to the /HEPRUP/ common block. The
0222    * function returns the number of events scanned.
0223    */
0224   virtual long scan();
0225 
0226   /**
0227    * Take the information corresponding to the HEPRUP common block and
0228    * initialize the statistics for this reader.
0229    */
0230   virtual void initStat();
0231 
0232   /**
0233    * Reweights the current event using the reweights and preweights
0234    * vectors. It is the responsibility of the sub-class to call this
0235    * function after the HEPEUP information has been retrieved.
0236    */
0237   double reweight();
0238 
0239   /**
0240    * Converts the information in the Les Houches common block
0241    * variables into a Particle objects.
0242    */
0243   virtual void fillEvent();
0244 
0245   /**
0246    * Removes the particles created in the last generated event,
0247    * preparing to produce a new one.
0248    */
0249   void reset();
0250 
0251   /**
0252    * Possibility for subclasses to recover from non-conformant
0253    * settings of XMAXUP when an event file has been scanned with \a
0254    * neve events. Should set weightScale so that the average XMAXUP
0255    * times weightScale gives the cross section for a process. (This is
0256    * needed for MadEvent).
0257    */
0258   virtual void setWeightScale(long neve);
0259 
0260   //@}
0261 
0262   /** @name Access information about the current event. */
0263   //@{
0264 
0265   /**
0266    * Return the size of this event in bytes. To be used for the cache
0267    * file. \a npart is the number of particles. If \a npart is 0, the
0268    * number is taken from NUP.
0269    */
0270   static size_t eventSize(int N) {
0271     return (N + 1)*sizeof(int) +       // IDPRUP, ISTUP
0272       (7*N + 4)*sizeof(double) +       // XWGTUP, SCALUP, AQEDUP, AQCDUP, PUP,
0273                                        // VTIMUP, SPINUP
0274       N*sizeof(long) +                 // IDUP
0275       2*N*sizeof(pair<int,int>) +      // MOTHUP, ICOLUP
0276       sizeof(pair<double,double>) +    // XPDWUP.
0277       2*sizeof(double);                // lastweight and preweight
0278   }
0279 
0280   /**
0281    * The current event weight given by XWGTUP times possible
0282    * reweighting. Note that this is not necessarily the same as what
0283    * is returned by getEvent(), which is scaled with the maximum
0284    * weight.
0285    */
0286   double eventWeight() const { return hepeup.XWGTUP*lastweight; }
0287 
0288   /**
0289    * Return the optional named weights associated to the current event.
0290    */
0291   const map<string,double>& optionalEventWeights() const { return optionalWeights; }
0292 
0293   /** 
0294    * Return the Les Houches event number associated with the current event
0295    */
0296   const long& LHEEventNum() const { return LHEeventnum; }
0297 
0298   /**
0299    * Return the optional npLO and npNLO
0300    */
0301   const int& optionalEventnpLO() const { return optionalnpLO; }
0302   const int& optionalEventnpNLO() const { return optionalnpNLO; }
0303   
0304   /**
0305    * The pair of PartonBinInstance objects describing the current
0306    * incoming partons in the event.
0307    */
0308   const PBIPair & partonBinInstances() const { return thePartonBinInstances; }
0309   /**
0310    * Return the instances of the beam particles for the current event.
0311    */
0312   const PPair & beams() const { return theBeams; }
0313   /**
0314    * Return the instances of the incoming particles to the sub process
0315    * for the current event.
0316    */
0317   const PPair & incoming() const { return theIncoming; }
0318   /**
0319    * Return the instances of the outgoing particles from the sub process
0320    * for the current event.
0321    */
0322   const PVector & outgoing() const { return theOutgoing; }
0323   /**
0324    * Return the instances of the intermediate particles in the sub
0325    * process for the current event.
0326    */
0327   const PVector & intermediates() const { return theIntermediates; }
0328   /**
0329    * If this reader is to be used (possibly together with others) for
0330    * CKKW reweighting and veto, this should give the multiplicity of
0331    * outgoing particles in the highest multiplicity matrix element in
0332    * the group.
0333    */
0334   int maxMultCKKW() const { return theMaxMultCKKW; }
0335   /**
0336    * If this reader is to be used (possibly together with others) for
0337    * CKKW reweighting and veto, this should give the multiplicity of
0338    * outgoing particles in the lowest multiplicity matrix element in
0339    * the group.
0340    */
0341   int minMultCKKW() const { return theMinMultCKKW; }  //@}
0342 
0343   /** @name Other inlined access functions. */
0344   //@{
0345   /**
0346    * The number of events found in this reader. If less than zero the
0347    * number of events are unlimited.
0348    */
0349   long NEvents() const { return theNEvents; }
0350 
0351   /**
0352    * The number of events produced so far. Is reset to zero if an
0353    * event file is reopened.
0354    */
0355   long currentPosition() const { return position; }
0356 
0357   /**
0358    * The maximum number of events to scan to collect information about
0359    * processes and cross sections. If less than 0, all events will be
0360    * scanned.
0361    */
0362   long maxScan() const { return theMaxScan; }
0363 
0364   /**
0365    * Return true if this reader is active.
0366    */
0367   bool active() const { return isActive; }
0368 
0369   /**
0370    * True if negative weights may be produced.
0371    */
0372   bool negativeWeights() const { return heprup.IDWTUP < 0; }
0373 
0374   /**
0375    * The collected cross section statistics for this reader.
0376    */
0377   const XSecStat & xSecStats() const { return stats; }
0378 
0379   /**
0380    * Collected statistics about the individual processes.
0381    */
0382   const StatMap & processStats() const { return statmap; }
0383 
0384   /**
0385    * Select the current event. It will later be rejected with a
0386    * probability given by \a weight.
0387    */
0388   void select(double weight) {
0389     stats.select(weight);
0390     statmap[hepeup.IDPRUP].select(weight);
0391   }
0392 
0393   /**
0394    * Accept the current event assuming it was previously selcted.
0395    */
0396   void accept() {
0397     stats.accept();
0398     statmap[hepeup.IDPRUP].accept();
0399   }
0400 
0401   /**
0402    * Reject the current event assuming it was previously accepted.
0403    */
0404   void reject(double w) {
0405     stats.reject(w);
0406     statmap[hepeup.IDPRUP].reject(w);
0407   }
0408 
0409   /**
0410    * Increase the overestimated cross section for this reader.
0411    */
0412   virtual void increaseMaxXSec(CrossSection maxxsec);
0413 
0414   /**
0415    * The PartonExtractor object used to construct remnants.
0416    */
0417   tPExtrPtr partonExtractor() const { return thePartonExtractor; }
0418 
0419   /**
0420    * Return a possibly null pointer to a CascadeHandler to be used for
0421    * CKKW-reweighting.
0422    */
0423   tCascHdlPtr CKKWHandler() const { return theCKKW; }
0424 
0425   /**
0426    * The pairs of PartonBin objects describing the partons which can
0427    * be extracted by the PartonExtractor object.
0428    */
0429   const PartonPairVec & partonBins() const { return thePartonBins; }
0430 
0431   /**
0432    * The map of XComb objects indexed by the corresponding PartonBin
0433    * pair.
0434    */
0435   const XCombMap & xCombs() const { return theXCombs; }
0436 
0437   /**
0438    * The Cuts object to be used for this reader.
0439    */
0440   const Cuts & cuts() const { return *theCuts; }
0441 
0442   //@}
0443 
0444 protected:
0445 
0446   /** @name Functions for manipulating cache files. */
0447   //@{
0448 
0449   /**
0450    * Name of file used to cache the events form the reader in a
0451    * fast-readable form. If empty, no cache file will be generated.
0452    */
0453   string cacheFileName() const { return theCacheFileName; }
0454 
0455   /**
0456    * Determines whether to apply cuts to events converting them to
0457    * ThePEG format.
0458    */
0459   bool cutEarly() const { return doCutEarly; }
0460 
0461   /**
0462    * File stream for the cache.
0463    */
0464   CFile cacheFile() const { return theCacheFile;}
0465 
0466   /**
0467    * Open the cache file for reading.
0468    */
0469   void openReadCacheFile();
0470 
0471   /**
0472    * Open the cache file for writing.
0473    */
0474   void openWriteCacheFile();
0475 
0476   /**
0477    * Close the cache file;
0478    */
0479   void closeCacheFile();
0480 
0481   /**
0482    * Write the current event to the cache file.
0483    */
0484   void cacheEvent() const;
0485 
0486   /**
0487    * Read an event from the cache file. Return false if something went wrong.
0488    */
0489   bool uncacheEvent();
0490 
0491   /**
0492    * Reopen a reader. If we have reached the end of an event file,
0493    * reopen it and issue a warning if we have used up a large fraction
0494    * of it.
0495    */
0496   void reopen();
0497 
0498   /**
0499    * Helper function to write a variable to a memory location
0500    */
0501   template <typename T>
0502   static char * mwrite(char * pos, const T & t, size_t n = 1) {
0503     std::memcpy(pos, &t, n*sizeof(T));
0504     return pos + n*sizeof(T);
0505   }
0506 
0507   /**
0508    * Helper function to read a variable from a memory location
0509    */
0510   template <typename T>
0511   static const char * mread(const char * pos, T & t, size_t n = 1) {
0512     std::memcpy(&t, pos, n*sizeof(T));
0513     return pos + n*sizeof(T);
0514   }
0515 
0516   //@}
0517 
0518   /** @name Auxilliary virtual methods which may be verridden by sub-classes. */
0519   //@{
0520   /**
0521    * Check the existence of a pair of PartonBin objects corresponding
0522    * to the current event.
0523    *
0524    * @return false if no pair of suitable PartonBin objects was found.
0525    */
0526   virtual bool checkPartonBin();
0527 
0528   /**
0529    * Create instances of all particles in the event and store them
0530    * in particleIndex.
0531    */
0532   virtual void createParticles();
0533 
0534   /**
0535    * Using the already created particles create a pair of
0536    * PartonBinInstance objects corresponding to the incoming
0537    * partons. Return the corresponding PartonBin objects.
0538    */
0539   virtual tcPBPair createPartonBinInstances();
0540 
0541   /**
0542    * Create instances of the incoming beams in the event and store
0543    * them in particleIndex. If no beam particles are included in the
0544    * event they are created from the run info.
0545    */
0546   virtual void createBeams();
0547 
0548   /**
0549    * Go through the mother indices and connect up the Particles.
0550    */
0551   virtual void connectMothers();
0552   //@}
0553 
0554 public:
0555 
0556   /** @name Functions used by the persistent I/O system. */
0557   //@{
0558   /**
0559    * Function used to write out object persistently.
0560    * @param os the persistent output stream written to.
0561    */
0562   void persistentOutput(PersistentOStream & os) const;
0563 
0564   /**
0565    * Function used to read in object persistently.
0566    * @param is the persistent input stream read from.
0567    * @param version the version number of the object when written.
0568    */
0569   void persistentInput(PersistentIStream & is, int version);
0570   //@}
0571 
0572   /**
0573    * Standard Init function used to initialize the interfaces.
0574    */
0575   static void Init();
0576 
0577 protected:
0578 
0579   /** @name Set functions for some variables not in the Les Houches accord. */
0580   //@{
0581   /**
0582    * The number of events in this reader. If less than zero the number
0583    * of events is unlimited.
0584    */
0585   void NEvents(long x) { theNEvents = x; }
0586 
0587   /**
0588    * The map of XComb objects indexed by the corresponding PartonBin
0589    * pair.
0590    */
0591   XCombMap & xCombs() { return theXCombs; }  
0592   //@}
0593 
0594   /** @name Standard (and non-standard) Interfaced functions. */
0595   //@{
0596   /**
0597    * Initialize this object after the setup phase before saving an
0598    * EventGenerator to disk.
0599    * @throws InitException if object could not be initialized properly.
0600    */
0601   virtual void doinit();
0602 
0603   /**
0604    * Initialize this object. Called in the run phase just before
0605    * a run begins.
0606    */
0607   virtual void doinitrun();
0608 
0609   /**
0610    * Finalize this object. Called in the run phase just after a
0611    * run has ended. Used eg. to write out statistics.
0612    */
0613   virtual void dofinish() {
0614     close();
0615     HandlerBase::dofinish();
0616   }
0617 
0618   /**
0619    * Return true if this object needs to be initialized before all
0620    * other objects because it needs to extract PDFs from the event file.
0621    */
0622   virtual bool preInitialize() const;
0623 
0624   /**
0625    * Called from doinit() to extract PDFs from the event file and add
0626    * the corresponding objects to the current EventGenerator.
0627    */
0628   virtual void initPDFs();
0629   //@}
0630 
0631 protected:
0632 
0633   /**
0634    * The HEPRUP common block.
0635    */
0636   HEPRUP heprup;
0637 
0638   /**
0639    * The HEPEUP common block.
0640    */
0641   HEPEUP hepeup;
0642 
0643   /**
0644    * The ParticleData objects corresponding to the incoming particles.
0645    */
0646   tcPDPair inData;
0647 
0648   /**
0649    * The PDFBase objects which has been used for the beam particle
0650    * when generating the events being read. Specified in the interface
0651    * or derived from PDFGUP and PDFSUP.
0652    */
0653   pair<PDFPtr,PDFPtr> inPDF;
0654 
0655   /**
0656    * The PDFBase object to be used in the subsequent generation.
0657    */
0658   pair<cPDFPtr,cPDFPtr> outPDF;
0659 
0660   /**
0661    * The PartonExtractor object used to construct remnants.
0662    */
0663   PExtrPtr thePartonExtractor;
0664 
0665   /**
0666    * A pointer to a CascadeHandler to be used for CKKW-reweighting.
0667    */
0668   tCascHdlPtr theCKKW;
0669 
0670   /**
0671    * The pairs of PartonBin objects describing the partons which can
0672    * be extracted by the PartonExtractor object.
0673    */
0674   PartonPairVec thePartonBins;
0675 
0676   /**
0677    * The map of XComb objects indexed by the corresponding PartonBin
0678    * pair.
0679    */
0680   XCombMap theXCombs;
0681 
0682   /**
0683    * The Cuts object to be used for this reader.
0684    */
0685   CutsPtr theCuts;
0686 
0687   /**
0688    * The number of events in this reader. If less than zero the number
0689    * of events is unlimited.
0690    */
0691   long theNEvents;
0692 
0693   /**
0694    * The number of events produced by this reader so far. Is reset
0695    * every time an event file is reopened.
0696    */
0697   long position;
0698 
0699   /**
0700    * The number of times this reader has been reopened.
0701    */
0702   int reopened;
0703 
0704   /**
0705    * The maximum number of events to scan to collect information about
0706    * processes and cross sections. If less than 0, all events will be
0707    * scanned.
0708    */
0709   long theMaxScan;
0710 
0711   /**
0712    * Flag to tell whether we are in the process of scanning.
0713    */
0714   bool scanning;
0715 
0716   /**
0717    * True if this is an active reader.
0718    */
0719   bool isActive;
0720 
0721   /**
0722    * Name of file used to cache the events form the reader in a
0723    * fast-readable form. If empty, no cache file will be generated.
0724    */
0725   string theCacheFileName;
0726 
0727   /**
0728    * Determines whether to apply cuts to events before converting them
0729    * to ThePEG format.
0730    */
0731   bool doCutEarly;
0732 
0733   /**
0734    * Collect statistics for this reader.
0735    */
0736   XSecStat stats;
0737 
0738   /**
0739    * Collect statistics for each individual process.
0740    */
0741   StatMap statmap;
0742 
0743   /**
0744    * The pair of PartonBinInstance objects describing the current
0745    * incoming partons in the event.
0746    */
0747   PBIPair thePartonBinInstances;
0748 
0749   /**
0750    * Association between ColourLines and colour indices in the current
0751    * translation.
0752    */
0753   ObjectIndexer<long,ColourLine> colourIndex;
0754 
0755   /**
0756    * Association between Particles and indices in the current
0757    * translation.
0758    */
0759   ObjectIndexer<long,Particle> particleIndex;
0760 
0761   /**
0762    * The instances of the beam particles for the current event.
0763    */
0764   PPair theBeams;
0765 
0766   /**
0767    * The instances of the incoming particles to the sub process for
0768    * the current event.
0769    */
0770   PPair theIncoming;
0771 
0772   /**
0773    * The instances of the outgoing particles from the sub process for
0774    * the current event.
0775    */
0776   PVector theOutgoing;
0777 
0778   /**
0779    * The instances of the intermediate particles in the sub process for
0780    * the current event.
0781    */
0782   PVector theIntermediates;
0783 
0784   /**
0785    * File stream for the cache.
0786    */
0787   CFile theCacheFile;
0788 
0789   /**
0790    * The reweight objects modifying the weights of this reader.
0791    */
0792   ReweightVector reweights;
0793 
0794   /**
0795    * The preweight objects modifying the weights of this reader.
0796    */
0797   ReweightVector preweights;
0798 
0799   /**
0800    * The factor with which this reader was last pre-weighted.
0801    */
0802   double preweight;
0803 
0804   /**
0805    * Should the event be reweighted by PDFs used by the PartonExtractor?
0806    */
0807   bool reweightPDF;
0808 
0809   /**
0810    * Should PDFBase objects be constructed from the information in the
0811    * event file in the initialization?
0812    */
0813   bool doInitPDFs;
0814 
0815   /**
0816    * If this reader is to be used (possibly together with others) for
0817    * CKKW reweighting and veto, this should give the multiplicity of
0818    * outgoing particles in the highest multiplicity matrix element in
0819    * the group.
0820    */
0821   int theMaxMultCKKW;
0822 
0823   /**
0824    * If this reader is to be used (possibly together with others) for
0825    * CKKW reweighting and veto, this should give the multiplicity of
0826    * outgoing particles in the lowest multiplicity matrix element in
0827    * the group.
0828    */
0829   int theMinMultCKKW;
0830 
0831   /**
0832    * The weight multiplying the last read event due to PDF
0833    * reweighting, CKKW reweighting or assigned reweight and preweight
0834    * objects.
0835    */
0836   double lastweight;
0837 
0838   /**
0839    * The optional weights associated to the last read events.
0840    */
0841   map<string,double> optionalWeights;
0842   
0843   /**
0844    * The event number
0845    */
0846   long LHEeventnum;
0847 
0848    /**
0849    * If the maximum cross section of this reader has been increased
0850    * with increaseMaxXSec(), this is the total factor with which it
0851    * has been increased.
0852    */
0853   double maxFactor;
0854 
0855   /**
0856    * npLO for FxFx merging
0857    */
0858   int optionalnpLO;
0859 
0860  /**
0861    * npNLO for FxFx merging
0862    */
0863   int optionalnpNLO;
0864 
0865   /**
0866    * The (reweighted) XWGTUP value should be scaled with this cross
0867    * section when compared to the overestimated cross section.
0868    */
0869   CrossSection weightScale;
0870 
0871   /**
0872    * Individual scales for different sub-processes if reweighted.
0873    */
0874   vector<double> xSecWeights;
0875 
0876   /**
0877    * Individual maximum weights for individual (possibly reweighted)
0878    * processes.
0879    */
0880   map<int,double> maxWeights;
0881 
0882   /**
0883    * Is set to true when getEvent() is called from skip(int).
0884    */
0885   bool skipping;
0886 
0887   /**
0888    *  Option for the treatment of the momenta supplied
0889    */
0890   unsigned int theMomentumTreatment;
0891 
0892   /**
0893    * Set to true if warnings about possible weight incompatibilities
0894    * should be issued.
0895    */
0896   bool useWeightWarnings;
0897 
0898   /**
0899    *  Option to allow reopening of the file
0900    */
0901   bool theReOpenAllowed;
0902 
0903   /**
0904    *  Use the spin information
0905    */
0906   bool theIncludeSpin;
0907 
0908 private:
0909 
0910   /** Access function for the interface. */
0911   void setBeamA(long id);
0912   /** Access function for the interface. */
0913   long getBeamA() const;
0914   /** Access function for the interface. */
0915   void setBeamB(long id);
0916   /** Access function for the interface. */
0917   long getBeamB() const;
0918   /** Access function for the interface. */
0919   void setEBeamA(Energy e);
0920   /** Access function for the interface. */
0921   Energy getEBeamA() const;
0922   /** Access function for the interface. */
0923   void setEBeamB(Energy e);
0924   /** Access function for the interface. */
0925   Energy getEBeamB() const;
0926   /** Access function for the interface. */
0927   void setPDFA(PDFPtr);
0928   /** Access function for the interface. */
0929   PDFPtr getPDFA() const;
0930   /** Access function for the interface. */
0931   void setPDFB(PDFPtr);
0932   /** Access function for the interface. */
0933   PDFPtr getPDFB() const;
0934 
0935 private:
0936 
0937   /**
0938    * Describe an abstract base class with persistent data.
0939    */
0940   static AbstractClassDescription<FxFxReader> initFxFxReader;
0941 
0942   /**
0943    * Private and non-existent assignment operator.
0944    */
0945   FxFxReader & operator=(const FxFxReader &) = delete;
0946 
0947 public:
0948 
0949   /** @cond EXCEPTIONCLASSES */
0950   /** Exception class used by FxFxReader in case inconsistencies
0951    *  are encountered. */
0952   class FxFxInconsistencyError: public Exception {};
0953   
0954   /** Exception class used by FxFxReader in case more events
0955       than available are requested. */
0956   class FxFxReopenWarning: public Exception {};
0957 
0958   /** Exception class used by FxFxReader in case reopening an
0959       event file fails. */
0960   class FxFxReopenError: public Exception {};
0961 
0962   /** Exception class used by FxFxReader in case there is
0963       information missing in the initialization phase. */
0964   class FxFxInitError: public InitException {};
0965   /** @endcond */
0966 
0967 };
0968 
0969 /// Stream output for HEPEUP
0970 ostream & operator<<(ostream & os, const HEPEUP & h);
0971 
0972 }
0973 
0974 
0975 #include "ThePEG/Utilities/ClassTraits.h"
0976 
0977 namespace ThePEG {
0978 
0979 /** @cond TRAITSPECIALIZATIONS */
0980 
0981 /**
0982  * This template specialization informs ThePEG about the
0983  * base class of FxFxReader.
0984  */
0985 template <>
0986 struct BaseClassTrait<FxFxReader,1>: public ClassTraitsType {
0987   /** Typedef of the base class of FxFxReader. */
0988   typedef HandlerBase NthBase;
0989 };
0990 
0991 /**
0992  * This template specialization informs ThePEG about the name of the
0993  * FxFxReader class and the shared object where it is
0994  * defined.
0995  */
0996 template <>
0997 struct ClassTraits<FxFxReader>
0998   : public ClassTraitsBase<FxFxReader> {
0999   /**
1000    * Return the class name.
1001    */
1002   static string className() { return "Herwig::FxFxReader"; }
1003   /**
1004    * Return the name of the shared library to be loaded to get access
1005    * to the FxFxReader class and every other class it uses
1006    * (except the base class).
1007    */
1008   static string library() { return "HwFxFx.so"; }
1009 
1010 };
1011 
1012 /** @endcond */
1013 
1014 }
1015 
1016 #endif /* THEPEG_FxFxReader_H */