00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ThePEG_StandardEventHandler_H
00010 #define ThePEG_StandardEventHandler_H
00011
00012
00013 #include "ThePEG/Config/ThePEG.h"
00014 #include "ThePEG/Handlers/EventHandler.h"
00015 #include "ThePEG/Repository/Strategy.fh"
00016 #include "ThePEG/Handlers/SamplerBase.fh"
00017 #include "ThePEG/PDF/PartonBin.fh"
00018 #include "ThePEG/MatrixElement/MEBase.fh"
00019 #include "SubProcessHandler.fh"
00020 #include "StandardXComb.fh"
00021 #include "StandardEventHandler.fh"
00022 #include <fstream>
00023
00024 namespace ThePEG {
00025
00043 class StandardEventHandler: public EventHandler {
00044
00045 public:
00046
00048 typedef vector<SubHdlPtr> SubHandlerList;
00049
00051 typedef Selector<StdXCombPtr> XSelector;
00052
00054 typedef vector<StdXCombPtr> XVector;
00055
00057 typedef vector<CrossSection> XSVector;
00058
00061 typedef map<tMEPtr,XVector> MEXMap;
00062
00063 public:
00064
00070 StandardEventHandler();
00071
00075 virtual ~StandardEventHandler();
00077
00078 public:
00079
00084 virtual void initialize();
00085
00090 virtual void statistics(ostream &) const;
00091
00097 virtual CrossSection histogramScale() const;
00098
00104 virtual CrossSection integratedXSec() const;
00105
00111 virtual CrossSection integratedXSecErr() const;
00112
00120 virtual CrossSection dSigDR(const vector<double> & r);
00121
00125 virtual EventPtr generateEvent();
00126
00131 virtual EventPtr continueEvent();
00132
00137 const LorentzRotation & currentEventBoost() const { return theCurrentEventBoost; }
00139
00147 tCutsPtr cuts() const { return theCuts; }
00148
00153 int nBins() const;
00154
00159 int maxDim(int bin) const { return theMaxDims[bin]; }
00160
00164 bool weighted() const { return weightedEvents; }
00165
00170 int lumiDim() const { return theLumiDim; }
00171
00176 int nDim(int bin) const { return lumiDim() + maxDim(bin); }
00178
00179 protected:
00180
00194 virtual CrossSection dSigDR(const pair<double,double> ll, Energy2 maxS,
00195 int ibin, int nr, const double * r);
00196
00202 tStdXCombPtr select(int bin, double & weight);
00203
00216 void addME(Energy maxEnergy, tSubHdlPtr sub, tPExtrPtr extractor,
00217 tCutsPtr cuts, tCascHdlPtr ckkw, tMEPtr me, const PBPair & pBins);
00218
00223 tCollPtr performCollision();
00224
00232 virtual void initGroups();
00233
00240 LorentzRotation & currentEventBoost() { return theCurrentEventBoost; }
00241
00245 void setScale(Energy2);
00246
00250 const XVector & xCombs() const { return theXCombs; }
00251
00255 XVector & xCombs() { return theXCombs; }
00256
00260 const XSVector & xSecs() const { return theXSecs; }
00261
00265 XSVector & xSecs() { return theXSecs; }
00266
00274 int binStrategy() const { return theBinStrategy; }
00275
00276 private:
00277
00281 const SubHandlerList & subProcesses() const { return theSubProcesses; }
00282
00286 SubHandlerList & subProcesses() { return theSubProcesses; }
00287
00288 public:
00289
00295 virtual void doupdate();
00296
00302 virtual void doinit();
00303
00308 virtual void doinitrun();
00309
00314 virtual void dofinish();
00316
00323 void persistentOutput(PersistentOStream & os) const;
00324
00330 void persistentInput(PersistentIStream & is, int version);
00332
00336 static void Init();
00337
00338 protected:
00339
00346 virtual IBPtr clone() const;
00347
00352 virtual IBPtr fullclone() const;
00354
00359 void reject(double weight);
00360
00364 tSamplerPtr sampler() { return theSampler; }
00365
00369 tcSamplerPtr sampler() const { return theSampler; }
00370
00371 private:
00372
00377 PDPtr theIncomingA;
00382 PDPtr theIncomingB;
00383
00387 SubHandlerList theSubProcesses;
00388
00392 CutsPtr theCuts;
00393
00397 XVector theXCombs;
00398
00403 XSVector theXSecs;
00404
00412 int theBinStrategy;
00413
00418 MEXMap theMEXMap;
00419
00424 vector<int> theMaxDims;
00425
00430 LorentzRotation theCurrentEventBoost;
00431
00435 bool weightedEvents;
00436
00442 SamplerPtr theSampler;
00443
00448 int theLumiDim;
00449
00453 static ClassDescription<StandardEventHandler> initStandardEventHandler;
00454
00458 void setIncomingA(PDPtr);
00459
00463 void setIncomingB(PDPtr);
00464
00465 protected:
00466
00472 class StandardEventHandlerUpdateException: public UpdateException {};
00473
00478 class StandardEventHandlerInitError: public Exception {};
00481 private:
00482
00486 const StandardEventHandler & operator=(const StandardEventHandler &);
00487
00488 };
00489
00496 template <>
00497 struct BaseClassTrait<StandardEventHandler,1>: public ClassTraitsType {
00499 typedef EventHandler NthBase;
00500 };
00501
00506 template <>
00507 struct ClassTraits<StandardEventHandler>
00508 : public ClassTraitsBase<StandardEventHandler> {
00512 static string className() { return "ThePEG::StandardEventHandler"; }
00513 };
00514
00517 }
00518
00519 #endif