ThePEG  1.8.0
PartonExtractor.h
1 // -*- C++ -*-
2 //
3 // PartonExtractor.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_PartonExtractor_H
10 #define ThePEG_PartonExtractor_H
11 // This is the declaration of the PartonExtractor class.
12 
13 #include "ThePEG/Handlers/HandlerBase.h"
14 #include "ThePEG/Handlers/LastXCombInfo.h"
15 #include "ThePEG/PDF/PartonBin.h"
16 #include "ThePEG/PDF/PartonBinInstance.h"
17 #include "ThePEG/PDF/PDFBase.h"
18 #include "ThePEG/PDT/ParticleData.h"
19 #include "PartonExtractor.xh"
20 
21 namespace ThePEG {
22 
44 class PartonExtractor: public HandlerBase, public LastXCombInfo<> {
45 
47  friend class XComb;
48 
49 public:
50 
52  typedef map<cPPtr,PBIPtr> PartonBinInstanceMap;
53 
54 public:
55 
62 
66  virtual ~PartonExtractor();
68 
69 public:
70 
77  virtual bool canHandle(const cPDPair &) { return true; }
78 
84  virtual PartonPairVec getPartons(Energy maxEnergy, const cPDPair &,
85  const Cuts &) const;
86 
92  virtual Energy2 newScale();
93 
98  virtual void colourConnect(tPPtr particle, tPPtr parton,
99  const tPVector & remnants) const;
100 
108  virtual PBIPair newRemnants(tPPair oldp, tPPair newp, tStepPtr step);
109 
114  virtual pair<int,int> nDims(const PBPair & pbins);
115 
120  virtual void prepare(const PBIPair & pbins);
121 
125  virtual bool generateL(const PBIPair & pbins,
126  const double * r1, const double * r2);
127 
133  virtual void generateL(PartonBinInstance & pb, const double * r);
134 
139  virtual Energy2 generateSHat(Energy2 s, const PBIPair & pbins,
140  const double * r1, const double * r2,
141  bool mepartons = false);
142 
149  virtual double fullFn(const PBIPair & pbins, Energy2 scale,
150  pair<bool,bool> noLastPDF = make_pair(false,false));
151 
155  virtual void construct(const PBIPair & pbins, tStepPtr step) const;
156 
164  virtual void constructRemnants(const PBIPair & pbins, tSubProPtr sub,
165  tStepPtr step) const;
166 
179  virtual LorentzRotation
181  bool side1, bool side2) const;
183 
191 
195  void select(tXCombPtr newXComb);
196 
198 
203  int maxTries() const { return theMaxTries; }
204 
212  tcPDFPtr getPDF(tcPDPtr particle) const;
213 
214 protected:
215 
219 
233  virtual bool generate(PartonBinInstance & pb, const double * r,
234  Energy2 shat, const Lorentz5Momentum & first,
235  bool haveMEPartons = false);
236 
240  virtual double fullFn(const PartonBinInstance & pb,
241  bool noLastPDF = false);
242 
248  virtual void construct(PartonBinInstance & pb,
249  tStepPtr step, bool boost = true) const;
250 
255  PBIPtr newRemnants(tPBIPtr oldpb, tPPtr newp, const LorentzMomentum & k);
256 
260  void addNewRemnants(tPBIPtr oldpb, tPBIPtr newpb, tStepPtr step);
261 
273  virtual void transformRemnants(LorentzMomentum & Ph, LorentzMomentum & Pr,
274  const LorentzMomentum & k,
275  const LorentzMomentum & P) const;
276 
288  virtual void
290  const LorentzMomentum & k) const;
292 
293 public:
294 
301  void persistentOutput(PersistentOStream & os) const;
302 
308  void persistentInput(PersistentIStream & is, int version);
310 
314  static void Init();
315 
316 protected:
317 
322  virtual void addPartons(tPBPtr incoming ,const PDFCuts & cuts,
323  tcPDFPtr pdf ,PartonVector & pbins) const;
324 
328  tcPDFPtr noPDF() const { return theNoPDF; }
329 
334  template <typename Iterator>
335  void findConnect(tColinePtr line, tPPtr parton, bool anti,
336  Iterator first, Iterator last) const {
337  for ( ; first != last; ++first ) {
338  if ( *first != parton && (**first).hasColour(anti) &&
339  !(**first).colourLine(anti) ) {
340  line->addColoured(*first, anti);
341  return;
342  }
343  }
344  throw RemColException(*this);
345  }
346 
347 protected:
348 
355  virtual IBPtr clone() const;
356 
361  virtual IBPtr fullclone() const;
363 
366 
371  virtual void dofinish();
373 
374 private:
375 
380 
384  vector<PDFPtr> theSpecialDensities;
385 
390 
395 
400 
406 
412  bool flatSHatY;
413 
414 private:
415 
420 
425 
426 };
427 
432 template <>
435  typedef HandlerBase NthBase;
436 };
437 
440 template <>
442 struct ClassTraits<PartonExtractor>: public ClassTraitsBase<PartonExtractor> {
443  static string className() { return "ThePEG::PartonExtractor"; }
444 };
445 
448 }
449 
450 #endif /* ThePEG_PartonExtractor_H */