This file is indexed.

/usr/include/ThePEG/LesHouches/LesHouchesReader.h is in libthepeg-dev 1.8.0-1.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
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
// -*- C++ -*-
//
// LesHouchesReader.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_LesHouchesReader_H
#define THEPEG_LesHouchesReader_H
// This is the declaration of the LesHouchesReader class.

#include "LesHouches.h"
#include "ThePEG/Handlers/HandlerBase.h"
#include "ThePEG/Utilities/ObjectIndexer.h"
#include "ThePEG/Utilities/Exception.h"
#include "ThePEG/Utilities/XSecStat.h"
#include "ThePEG/PDF/PartonBinInstance.h"
#include "ThePEG/PDF/PartonBin.fh"
#include "ThePEG/MatrixElement/ReweightBase.h"
#include "LesHouchesEventHandler.fh"
#include "LesHouchesReader.fh"
#include "ThePEG/Utilities/CFile.h"
#include <cstdio>
#include <cstring>

namespace ThePEG {

/**
 * LesHouchesReader is an abstract base class to be used for objects
 * which reads event files or streams from matrix element
 * generators. Derived classes must at least implement the open() and
 * doReadEvent() methods to read in information about the whole run into
 * the HEPRUP variable and next event into the HEPEUP variable
 * respectively. Also the close() function to close the file or stream
 * read must be implemented. Although these functions are named as if
 * we are reading from event files, they could just as well implement
 * the actual generation of events.
 *
 * After filling the HEPRUP and HEPEUP variables, which are protected
 * and easily accesible from the sub-class, this base class will then
 * be responsible for transforming this data to the ThePEG Event
 * record in the getEvent() method. <code>LesHouchesReader</code>s can
 * only be used inside LesHouchesEventHandler objects.
 *
 * In the initialization the virtual open() and scan() functions are
 * called. Here the derived class must provide the information about
 * the processes in the variables corresponding to the HEPRUP common
 * block. Note that the IDWTUP is required to be +/- 1, and sub
 * classes are required to change the information accordingly to
 * ensure the correct corss section sampling. Note also that the
 * controlling LesHouchesEventHandler may choose to generate weighted
 * events even if IDWTUP is 1.
 *
 * Note that the information given per process in e.g. the XSECUP and
 * XMAXUP vectors is not used by the LesHouchesEventHandler and by
 * default the LesHouchesReader is not assumed to be able to actively
 * choose between the sub-processes. Instead, the
 * LesHouchesEventHandler can handle several LesHouchesReader objects
 * and choose between them. However, a sub-class of LesHouchesReader
 * may set the flag isActive, in which case it is assumed to be able
 * to select between its sub-processes itself.
 *
 * The LesHouchesReader may be assigned a number ReweightBase objects
 * which either completely reweights the events produced (in the
 * reweights vector), or only biases the selection without influencing
 * the cross section (in the preweights vector). Note that it is the
 * responsibility of a sub-class to call the reweight() function and
 * multiply the weight according to its return value (typically done
 * in the readEvent() function).
 *
 * @see \ref LesHouchesReaderInterfaces "The interfaces"
 * defined for LesHouchesReader.
 * @see Event
 * @see LesHouchesEventHandler
 */
class LesHouchesReader: public HandlerBase, public LastXCombInfo<> {

  /**
   * LesHouchesEventHandler should have access to our private parts.
   */
  friend class LesHouchesEventHandler;

  /**
   * Map for accumulating statistics of cross sections per process
   * number.
   */
  typedef map<int,XSecStat> StatMap;

  /**
   * Map of XComb objects describing the incoming partons indexed by
   * the corresponding PartonBin pair.
   */
  typedef map<tcPBPair,XCombPtr> XCombMap;

  /**
   * A vector of pointers to ReweightBase objects.
   */
  typedef vector<ReweightPtr> ReweightVector;

public:

  /** @name Standard constructors and destructors. */
  //@{
  /**
   * Default constructor. If the optional argument is true, the reader
   * is assumed to be able to produce events on demand for a given
   * process.
   */
  LesHouchesReader(bool active = false);

  /**
   * Copy-constructor.
   */
  LesHouchesReader(const LesHouchesReader &);

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

public:

  /** @name Main virtual fuctions to be overridden in
   *  sub-classes. They are named as if we are reading from event
   *  files, but could equally well implement the actual generation of
   *  events. */
  //@{
  /**
   * Open a file or stream with events and read in the run information
   * into the heprup variable.
   */
  virtual void open() = 0;

  /**
   * Read the next event from the file or stream into the
   * corresponding protected variables. Return false if there is no
   * more events.
   */
  virtual bool doReadEvent() = 0;

  /**
   * Close the file or stream from which events have been read.
   */
  virtual void close() = 0;
  //@}

  /** @name Other important function which may be overridden in
   *  sub-classes which wants to bypass the basic HEPRUP or HEPEUP
   *  variables or otherwise facilitate the conversion to ThePEG
   *  objects. */
  //@{
  /**
   * Initialize. This function is called by the LesHouchesEventHandler
   * to which this object is assigned.
   */
  virtual void initialize(LesHouchesEventHandler & eh);

  /**
   * Calls readEvent() or uncacheEvent() to read information into the
   * LesHouches common block variables. This function is called by the
   * LesHouchesEventHandler if this reader has been selectod to
   * produce an event.
   *
   * @return the weight asociated with this event. If negative weights
   * are allowed it should be between -1 and 1, otherwise between 0
   * and 1. If outside these limits the previously estimated maximum
   * is violated. Note that the estimated maximum then should be
   * updated from the outside.
   */
  virtual double getEvent();

  /**
   * Calls doReadEvent() and performs pre-defined reweightings. A
   * sub-class overrides this function it must make sure that the
   * corresponding reweightings are done.
   */
  virtual bool readEvent();

  /**
   * Skip \a n events. Used by LesHouchesEventHandler to make sure
   * that a file is scanned an even number of times in case the events
   * are not ramdomly distributed in the file.
   */
  virtual void skip(long n);

  /**
   * Get an XComb object. Converts the information in the Les Houches
   * common block variables to an XComb object describing the sub
   * process. This is the way information is conveyed from the reader
   * to the controlling LesHouchesEventHandler.
   */
  tXCombPtr getXComb();

  /**
   * Get a SubProcess object corresponding to the information in the
   * Les Houches common block variables.
   */
  tSubProPtr getSubProcess();

  /**
   * Scan the file or stream to obtain information about cross section
   * weights and particles etc. This function should fill the
   * variables corresponding to the /HEPRUP/ common block. The
   * function returns the number of events scanned.
   */
  virtual long scan();

  /**
   * Take the information corresponding to the HEPRUP common block and
   * initialize the statistics for this reader.
   */
  virtual void initStat();

  /**
   * Reweights the current event using the reweights and preweights
   * vectors. It is the responsibility of the sub-class to call this
   * function after the HEPEUP information has been retrieved.
   */
  double reweight();

  /**
   * Converts the information in the Les Houches common block
   * variables into a Particle objects.
   */
  virtual void fillEvent();

  /**
   * Removes the particles created in the last generated event,
   * preparing to produce a new one.
   */
  void reset();

  /**
   * Possibility for subclasses to recover from non-conformant
   * settings of XMAXUP when an event file has been scanned with \a
   * neve events. Should set weightScale so that the average XMAXUP
   * times weightScale gives the cross section for a process. (This is
   * needed for MadEvent).
   */
  virtual void setWeightScale(long neve);

  //@}

  /** @name Access information about the current event. */
  //@{

  /**
   * Return the size of this event in bytes. To be used for the cache
   * file. \a npart is the number of particles. If \a npart is 0, the
   * number is taken from NUP.
   */
  static size_t eventSize(int N) {
    return (N + 1)*sizeof(int) +       // IDPRUP, ISTUP
      (7*N + 4)*sizeof(double) +       // XWGTUP, SCALUP, AQEDUP, AQCDUP, PUP,
                                       // VTIMUP, SPINUP
      N*sizeof(long) +                 // IDUP
      2*N*sizeof(pair<int,int>) +      // MOTHUP, ICOLUP
      sizeof(pair<double,double>) +    // XPDWUP.
      2*sizeof(double);                // lastweight and preweight
  }

  /**
   * The current event weight given by XWGTUP times possible
   * reweighting. Note that this is not necessarily the same as what
   * is returned by getEvent(), which is scaled with the maximum
   * weight.
   */
  double eventWeight() const { return hepeup.XWGTUP*lastweight; }

  /**
   * Return the optional named weights associated to the current event.
   */
  const map<string,double>& optionalEventWeights() const { return optionalWeights; }

  /**
   * The pair of PartonBinInstance objects describing the current
   * incoming partons in the event.
   */
  const PBIPair & partonBinInstances() const { return thePartonBinInstances; }
  /**
   * Return the instances of the beam particles for the current event.
   */
  const PPair & beams() const { return theBeams; }
  /**
   * Return the instances of the incoming particles to the sub process
   * for the current event.
   */
  const PPair & incoming() const { return theIncoming; }
  /**
   * Return the instances of the outgoing particles from the sub process
   * for the current event.
   */
  const PVector & outgoing() const { return theOutgoing; }
  /**
   * Return the instances of the intermediate particles in the sub
   * process for the current event.
   */
  const PVector & intermediates() const { return theIntermediates; }
  /**
   * If this reader is to be used (possibly together with others) for
   * CKKW reweighting and veto, this should give the multiplicity of
   * outgoing particles in the highest multiplicity matrix element in
   * the group.
   */
  int maxMultCKKW() const { return theMaxMultCKKW; }
  /**
   * If this reader is to be used (possibly together with others) for
   * CKKW reweighting and veto, this should give the multiplicity of
   * outgoing particles in the lowest multiplicity matrix element in
   * the group.
   */
  int minMultCKKW() const { return theMinMultCKKW; }  //@}

  /** @name Other inlined access functions. */
  //@{
  /**
   * The number of events found in this reader. If less than zero the
   * number of events are unlimited.
   */
  long NEvents() const { return theNEvents; }

  /**
   * The number of events produced so far. Is reset to zero if an
   * event file is reopened.
   */
  long currentPosition() const { return position; }

  /**
   * The maximum number of events to scan to collect information about
   * processes and cross sections. If less than 0, all events will be
   * scanned.
   */
  long maxScan() const { return theMaxScan; }

  /**
   * Return true if this reader is active.
   */
  bool active() const { return isActive; }

  /**
   * True if negative weights may be produced.
   */
  bool negativeWeights() const { return heprup.IDWTUP < 0; }

  /**
   * The collected cross section statistics for this reader.
   */
  const XSecStat & xSecStats() const { return stats; }

  /**
   * Collected statistics about the individual processes.
   */
  const StatMap & processStats() const { return statmap; }

  /**
   * Select the current event. It will later be rejected with a
   * probability given by \a weight.
   */
  void select(double weight) {
    stats.select(weight);
    statmap[hepeup.IDPRUP].select(weight);
  }

  /**
   * Accept the current event assuming it was previously selcted.
   */
  void accept() {
    stats.accept();
    statmap[hepeup.IDPRUP].accept();
  }

  /**
   * Reject the current event assuming it was previously accepted.
   */
  void reject(double w) {
    stats.reject(w);
    statmap[hepeup.IDPRUP].reject(w);
  }

  /**
   * Increase the overestimated cross section for this reader.
   */
  virtual void increaseMaxXSec(CrossSection maxxsec);

  /**
   * The PartonExtractor object used to construct remnants.
   */
  tPExtrPtr partonExtractor() const { return thePartonExtractor; }

  /**
   * Return a possibly null pointer to a CascadeHandler to be used for
   * CKKW-reweighting.
   */
  tCascHdlPtr CKKWHandler() const { return theCKKW; }

  /**
   * The pairs of PartonBin objects describing the partons which can
   * be extracted by the PartonExtractor object.
   */
  const PartonPairVec & partonBins() const { return thePartonBins; }

  /**
   * The map of XComb objects indexed by the corresponding PartonBin
   * pair.
   */
  const XCombMap & xCombs() const { return theXCombs; }

  /**
   * The Cuts object to be used for this reader.
   */
  const Cuts & cuts() const { return *theCuts; }

  //@}

protected:

  /** @name Functions for manipulating cache files. */
  //@{

  /**
   * Name of file used to cache the events form the reader in a
   * fast-readable form. If empty, no cache file will be generated.
   */
  string cacheFileName() const { return theCacheFileName; }

  /**
   * Determines whether to apply cuts to events converting them to
   * ThePEG format.
   */
  bool cutEarly() const { return doCutEarly; }

  /**
   * File stream for the cache.
   */
  CFile cacheFile() const { return theCacheFile;}

  /**
   * Open the cache file for reading.
   */
  void openReadCacheFile();

  /**
   * Open the cache file for writing.
   */
  void openWriteCacheFile();

  /**
   * Close the cache file;
   */
  void closeCacheFile();

  /**
   * Write the current event to the cache file.
   */
  void cacheEvent() const;

  /**
   * Read an event from the cache file. Return false if something went wrong.
   */
  bool uncacheEvent();

  /**
   * Reopen a reader. If we have reached the end of an event file,
   * reopen it and issue a warning if we have used up a large fraction
   * of it.
   */
  void reopen();

  /**
   * Helper function to write a variable to a memory location
   */
  template <typename T>
  static char * mwrite(char * pos, const T & t, size_t n = 1) {
    std::memcpy(pos, &t, n*sizeof(T));
    return pos + n*sizeof(T);
  }

  /**
   * Helper function to read a variable from a memory location
   */
  template <typename T>
  static const char * mread(const char * pos, T & t, size_t n = 1) {
    std::memcpy(&t, pos, n*sizeof(T));
    return pos + n*sizeof(T);
  }

  //@}

  /** @name Auxilliary virtual methods which may be verridden by sub-classes. */
  //@{
  /**
   * Check the existence of a pair of PartonBin objects corresponding
   * to the current event.
   *
   * @return false if no pair of suitable PartonBin objects was found.
   */
  virtual bool checkPartonBin();

  /**
   * Create instances of all particles in the event and store them
   * in particleIndex.
   */
  virtual void createParticles();

  /**
   * Using the already created particles create a pair of
   * PartonBinInstance objects corresponding to the incoming
   * partons. Return the corresponding PartonBin objects.
   */
  virtual tcPBPair createPartonBinInstances();

  /**
   * Create instances of the incoming beams in the event and store
   * them in particleIndex. If no beam particles are included in the
   * event they are created from the run info.
   */
  virtual void createBeams();

  /**
   * Go through the mother indices and connect up the Particles.
   */
  virtual void connectMothers();
  //@}

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 interfaces.
   */
  static void Init();

protected:

  /** @name Set functions for some variables not in the Les Houches accord. */
  //@{
  /**
   * The number of events in this reader. If less than zero the number
   * of events is unlimited.
   */
  void NEvents(long x) { theNEvents = x; }

  /**
   * The map of XComb objects indexed by the corresponding PartonBin
   * pair.
   */
  XCombMap & xCombs() { return theXCombs; }  
  //@}

  /** @name Standard (and non-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() {
    close();
    HandlerBase::dofinish();
  }

  /**
   * Return true if this object needs to be initialized before all
   * other objects because it needs to extract PDFs from the event file.
   */
  virtual bool preInitialize() const;

  /**
   * Called from doinit() to extract PDFs from the event file and add
   * the corresponding objects to the current EventGenerator.
   */
  virtual void initPDFs();
  //@}

protected:

  /**
   * The HEPRUP common block.
   */
  HEPRUP heprup;

  /**
   * The HEPEUP common block.
   */
  HEPEUP hepeup;

  /**
   * The ParticleData objects corresponding to the incoming particles.
   */
  tcPDPair inData;

  /**
   * The PDFBase objects which has been used for the beam particle
   * when generating the events being read. Specified in the interface
   * or derived from PDFGUP and PDFSUP.
   */
  pair<PDFPtr,PDFPtr> inPDF;

  /**
   * The PDFBase object to be used in the subsequent generation.
   */
  pair<cPDFPtr,cPDFPtr> outPDF;

  /**
   * The PartonExtractor object used to construct remnants.
   */
  PExtrPtr thePartonExtractor;

  /**
   * A pointer to a CascadeHandler to be used for CKKW-reweighting.
   */
  tCascHdlPtr theCKKW;

  /**
   * The pairs of PartonBin objects describing the partons which can
   * be extracted by the PartonExtractor object.
   */
  PartonPairVec thePartonBins;

  /**
   * The map of XComb objects indexed by the corresponding PartonBin
   * pair.
   */
  XCombMap theXCombs;

  /**
   * The Cuts object to be used for this reader.
   */
  CutsPtr theCuts;

  /**
   * The number of events in this reader. If less than zero the number
   * of events is unlimited.
   */
  long theNEvents;

  /**
   * The number of events produced by this reader so far. Is reset
   * every time an event file is reopened.
   */
  long position;

  /**
   * The number of times this reader has been reopened.
   */
  int reopened;

  /**
   * The maximum number of events to scan to collect information about
   * processes and cross sections. If less than 0, all events will be
   * scanned.
   */
  long theMaxScan;

  /**
   * Flag to tell whether we are in the process of scanning.
   */
  bool scanning;

  /**
   * True if this is an active reader.
   */
  bool isActive;

  /**
   * Name of file used to cache the events form the reader in a
   * fast-readable form. If empty, no cache file will be generated.
   */
  string theCacheFileName;

  /**
   * Determines whether to apply cuts to events before converting them
   * to ThePEG format.
   */
  bool doCutEarly;

  /**
   * Collect statistics for this reader.
   */
  XSecStat stats;

  /**
   * Collect statistics for each individual process.
   */
  StatMap statmap;

  /**
   * The pair of PartonBinInstance objects describing the current
   * incoming partons in the event.
   */
  PBIPair thePartonBinInstances;

  /**
   * Association between ColourLines and colour indices in the current
   * translation.
   */
  ObjectIndexer<long,ColourLine> colourIndex;

  /**
   * Association between Particles and indices in the current
   * translation.
   */
  ObjectIndexer<long,Particle> particleIndex;

  /**
   * The instances of the beam particles for the current event.
   */
  PPair theBeams;

  /**
   * The instances of the incoming particles to the sub process for
   * the current event.
   */
  PPair theIncoming;

  /**
   * The instances of the outgoing particles from the sub process for
   * the current event.
   */
  PVector theOutgoing;

  /**
   * The instances of the intermediate particles in the sub process for
   * the current event.
   */
  PVector theIntermediates;

  /**
   * File stream for the cache.
   */
  CFile theCacheFile;

  /**
   * The reweight objects modifying the weights of this reader.
   */
  ReweightVector reweights;

  /**
   * The preweight objects modifying the weights of this reader.
   */
  ReweightVector preweights;

  /**
   * The factor with which this reader was last pre-weighted.
   */
  double preweight;

  /**
   * Should the event be reweighted by PDFs used by the PartonExtractor?
   */
  bool reweightPDF;

  /**
   * Should PDFBase objects be constructed from the information in the
   * event file in the initialization?
   */
  bool doInitPDFs;

  /**
   * If this reader is to be used (possibly together with others) for
   * CKKW reweighting and veto, this should give the multiplicity of
   * outgoing particles in the highest multiplicity matrix element in
   * the group.
   */
  int theMaxMultCKKW;

  /**
   * If this reader is to be used (possibly together with others) for
   * CKKW reweighting and veto, this should give the multiplicity of
   * outgoing particles in the lowest multiplicity matrix element in
   * the group.
   */
  int theMinMultCKKW;

  /**
   * The weight multiplying the last read event due to PDF
   * reweighting, CKKW reweighting or assigned reweight and preweight
   * objects.
   */
  double lastweight;

  /**
   * The optional weights associated to the last read events.
   */
  map<string,double> optionalWeights;

  /**
   * If the maximum cross section of this reader has been increased
   * with increaseMaxXSec(), this is the total factor with which it
   * has been increased.
   */
  double maxFactor;

  /**
   * The (reweighted) XWGTUP value should be scaled with this cross
   * section when compared to the overestimated cross section.
   */
  CrossSection weightScale;

  /**
   * Individual scales for different sub-processes if reweighted.
   */
  vector<double> xSecWeights;

  /**
   * Individual maximum weights for individual (possibly reweighted)
   * processes.
   */
  map<int,double> maxWeights;

  /**
   * Is set to true when getEvent() is called from skip(int).
   */
  bool skipping;

  /**
   *  Option for the treatment of the momenta supplied
   */
  unsigned int theMomentumTreatment;

  /**
   * Set to true if warnings about possible weight incompatibilities
   * should be issued.
   */
  bool useWeightWarnings;

  /**
   *  Option to allow reopening of the file
   */
  bool theReOpenAllowed;

  /**
   *  Use the spin information
   */
  bool theIncludeSpin;

private:

  /** Access function for the interface. */
  void setBeamA(long id);
  /** Access function for the interface. */
  long getBeamA() const;
  /** Access function for the interface. */
  void setBeamB(long id);
  /** Access function for the interface. */
  long getBeamB() const;
  /** Access function for the interface. */
  void setEBeamA(Energy e);
  /** Access function for the interface. */
  Energy getEBeamA() const;
  /** Access function for the interface. */
  void setEBeamB(Energy e);
  /** Access function for the interface. */
  Energy getEBeamB() const;
  /** Access function for the interface. */
  void setPDFA(PDFPtr);
  /** Access function for the interface. */
  PDFPtr getPDFA() const;
  /** Access function for the interface. */
  void setPDFB(PDFPtr);
  /** Access function for the interface. */
  PDFPtr getPDFB() const;

private:

  /**
   * Describe an abstract base class with persistent data.
   */
  static AbstractClassDescription<LesHouchesReader> initLesHouchesReader;

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

public:

  /** @cond EXCEPTIONCLASSES */
  /** Exception class used by LesHouchesReader in case inconsistencies
   *  are encountered. */
  class LesHouchesInconsistencyError: public Exception {};
  
  /** Exception class used by LesHouchesReader in case more events
      than available are requested. */
  class LesHouchesReopenWarning: public Exception {};

  /** Exception class used by LesHouchesReader in case reopening an
      event file fails. */
  class LesHouchesReopenError: public Exception {};

  /** Exception class used by LesHouchesReader in case there is
      information missing in the initialization phase. */
  class LesHouchesInitError: public InitException {};
  /** @endcond */

};

/// Stream output for HEPEUP
ostream & operator<<(ostream & os, const HEPEUP & h);

}


#include "ThePEG/Utilities/ClassTraits.h"

namespace ThePEG {

/** @cond TRAITSPECIALIZATIONS */

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

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

};

/** @endcond */

}

#endif /* THEPEG_LesHouchesReader_H */