herwig is hosted by Hepforge, IPPP Durham
Herwig++  2.7.0
AlpGenHandler.h
00001 // -*- C++ -*-
00002 #ifndef HERWIG_AlpGenHandler_H
00003 #define HERWIG_AlpGenHandler_H
00004 //
00005 // This is the declaration of the AlpGenHandler class.
00006 //
00007 
00008 #include "Herwig++/Shower/ShowerHandler.h"
00009 #include "Herwig++/Shower/Base/Evolver.h"
00010 #include "ThePEG/Config/Pointers.h"
00011 #include "Herwig++/Shower/Couplings/ShowerAlpha.h"
00012 #include "fastjet/PseudoJet.hh"
00013 #include "fastjet/ClusterSequence.hh"
00014 
00015 
00016 namespace Herwig {
00017   class AlpGenHandler;
00018 }
00019 
00020 //declaration of thepeg ptr
00021 namespace ThePEG {
00022   ThePEG_DECLARE_POINTERS(Herwig::AlpGenHandler,AlpGenHandlerPtr);
00023 }
00024 
00025 namespace Herwig {
00026 
00027 using namespace ThePEG;
00028 
00035 class AlpGenHandler: public ShowerHandler {
00036 
00037 public:
00038 
00042   AlpGenHandler();
00043 
00044 public:
00045 
00052   void persistentOutput(PersistentOStream & os) const;
00053 
00059   void persistentInput(PersistentIStream & is, int version);
00061 
00068   static void Init();
00069 
00070 protected:
00071 
00077   virtual void dofinish();
00078 
00084   virtual void doinit();
00085 
00090   virtual void doinitrun();
00092 
00093 public:
00098   virtual bool showerHardProcessVeto();
00099 
00100 
00101 protected:
00102 
00109   virtual IBPtr clone() const;
00110 
00115   virtual IBPtr fullclone() const;
00117 
00118 private:
00119   
00120   /* 
00121    * Run MLM jet-parton matching on the 'extra' jets.
00122    */
00123   
00124   bool lightJetPartonVeto();
00125   
00126   /* 
00127    * Function that calculates deltaR between a parton and a jet
00128    */
00129 
00130   double partonJetDeltaR(ThePEG::tPPtr partonptr, LorentzMomentum jetmom);
00131   
00138   void calini_m();
00139   
00140  
00145   void calsim_m();
00146 
00150   void getFastJets(double rjet, Energy ejcut, double etajcut);
00151   
00152 
00161   void getjet_m(double rjet, Energy ejcut, double etajcut);
00162 
00172   void caldel_m();
00173 
00183   void caldel_hvq();
00184 
00189   void getPreshowerParticles();
00190 
00196   void getShoweredParticles();
00197 
00204   void doSanityChecks(int debugLevel);
00205 
00210   void getDescendents(PPtr theParticle);
00211 
00216   void getTopRadiation(PPtr theParticle);
00217 
00222   ParticleVector pTsort(ParticleVector unsortedVec);
00223   pair< vector<Energy>, vector<Lorentz5Momentum> > ETsort(vector<Energy> unsortedetjet, vector<Lorentz5Momentum> unsortedVec);
00224 
00225   /* 
00226    * A function that prints a vector of Lorentz5Momenta in a fancy way
00227    */
00228   void printMomVec(vector<Lorentz5Momentum> momVec);
00229 
00230 
00231   /* 
00232    * A probability function for varying etclus_ about the mean value
00233    */
00234   Energy etclusran_(double petc);
00235 
00236 private:
00237   
00242   static ClassDescription<AlpGenHandler> initAlpGenHandler;
00243 
00248   AlpGenHandler & operator=(const AlpGenHandler &);
00249 
00250 private:
00251 
00256   PPair preshowerISPs_;
00257 
00262   ParticleVector preshowerFSPs_;
00263 
00270   ParticleVector preshowerFSPsToDelete_;
00271 
00276   PPair showeredISHs_;
00277 
00282   PPair showeredISPs_;
00283 
00288   tPVector showeredFSPs_;
00289 
00297   ParticleVector showeredFSPsToDelete_;
00298 
00303   ParticleVector partonsToMatch_;
00304  
00305   /*
00306    * The shower progenitors
00307    */
00308 
00309   PPtr theProgenitor;
00310   PPtr theLastProgenitor;
00311 
00316   tPVector particlesToCluster_;
00317 
00322   PPair showeredRems_;
00323 
00327   ShowerAlphaPtr alphaS_;
00328 
00336   Energy pdfScale_;
00337 
00341   Energy2 sHat_;
00342 
00347   double alphaSME_;
00349 
00350   /*
00351    * Number of rapidity segments of the calorimeter.
00352    */
00353   unsigned int ncy_;
00354 
00355   /*
00356    * Number of phi segments of the calorimeter.
00357    */
00358   unsigned int ncphi_;
00359 
00360   /*
00361    * Heavy flavour in WQQ,ZQQ,2Q etc (4=c, 5=b, 6=t).
00362    */
00363   int ihvy_;
00364 
00365   /*
00366    * Number of photons in the AlpGen process.
00367    */
00368   int nph_;
00369 
00370   /*
00371    * Number of higgses in the AlpGen process.
00372    */
00373   int nh_;
00374 
00375   /*
00376    * Jet ET cut to apply in jet clustering (in merging).
00377    */
00378   Energy etclus_;
00379 
00380   /*
00381    * Mean Jet ET cut to apply in jet clustering (in merging).
00382    */
00383   Energy etclusmean_;
00384 
00385   /*
00386    * maximum deviation from mean Jet ET cut to apply in jet clustering (in merging).
00387    */
00388   Energy epsetclus_;
00389 
00390 
00391 
00392   /*
00393    * Cone size used in jet clustering (in merging).
00394    */
00395   double rclus_;
00396 
00397   /*
00398    * Max |eta| for jets in clustering (in merging).
00399    */
00400   double etaclmax_;
00401 
00402   /*
00403    * Default 1.5 factor used to decide if a jet matches a parton
00404    * in merging: if DR(parton,jet)<rclusfactor*rclus the parton
00405    * and jet are said to have been matched.
00406    */
00407   double rclusfactor_;
00408 
00409   /*
00410    * The AlpGen hard process code. Relation to the AlpGen process names:
00411    * 1: wqq, 2: zqq, 3: wjet, 4: zjet, 5: vbjet, 6: 2Q, 8: QQh, 9: Njet, 
00412    * 10: wcjet, 11: phjet, 12: hjet, 13: top, 14: wphjet, 15: wphqq, 
00413    * 16: 2Qph.
00414    */
00415   int ihrd_;
00416 
00417   /*
00418    * The number of light jets in the AlpGen process (i.e. the 'extra' ones).
00419    */
00420   int njets_;
00421 
00422   /*
00423    * Mimimum parton-parton R-sep used for generation (used for hvq merging).
00424    */
00425   double drjmin_;
00426 
00427   /*
00428    * This flags that the highest multiplicity ME-level process is
00429    * being processed.
00430    */
00431   bool highestMultiplicity_;
00432 
00433   /*
00434    * This flags that the highest NLO multiplicity ME-level process is
00435    * being processed.
00436    */
00437   bool highestNLOMultiplicity_;
00438   
00439   /*
00440    * This flags whether the etclus_ (merging scale) should be fixed or variable according to a prob. distribution around the mean
00441    */
00442   bool etclusfixed_;
00443 
00444   /*
00445    * The forwards rapidity span of the calorimeter.
00446    */
00447   double ycmax_;
00448 
00449   /*
00450    * The backwards rapidity span of the calorimeter.
00451    */
00452   double ycmin_;
00453 
00454   /*
00455    * The jet algorithm used for parton-jet matching in the MLM procedure.
00456    */
00457   int jetAlgorithm_;
00458 
00459   /*
00460    * Allows the vetoing to be turned off completely - just for convenience.
00461    */
00462   bool vetoIsTurnedOff_;
00463 
00464   /*
00465    * Signals that the LH file being read-in is a NLO (Powheg one).
00466    */
00467   bool inputIsNLO_;
00468 
00469   /*
00470    * Cosine of phi values of calorimeter cell centres.
00471    * Goes phi~=0 to phi~=2*pi          (index = 0 ---> ncphi).
00472    * ==> Cosine goes from +1 ---> +1   (index = 0 ---> ncphi).
00473    */
00474   vector<double> cphcal_;
00475 
00476   /*
00477    * Sine of phi values of calorimeter cell centres.
00478    * Goes phi~=0 to phi~=2*pi             (index = 0 ---> ncphi).
00479    * ==> Sine goes 0 -> 1 -> 0 -> -1 -> 0 (index = 0 ---> ncphi).
00480    */
00481   vector<double> sphcal_;
00482 
00483   /*
00484    * Cosine of theta values of calorimeter cell centres in Y. 
00485    * Goes bwds th~=pi to fwds th~=0       (index = 0 ---> ncy).
00486    * ==> Cosine goes from -1 ---> +1      (index = 0 ---> ncy).
00487    */
00488   vector<double> cthcal_;
00489 
00490   /*
00491    * Sine of theta values of calorimeter cell centres in Y. 
00492    * Goes bwds th~=pi to fwds th~=0       (index = 0 ---> ncy).
00493    * ==> Sine goes from  0 ---> +1 ---> 0 (index = 0 ---> ncy).
00494    */
00495   vector<double> sthcal_;
00496 
00497   /*
00498    * Transverse energy deposit in a given calorimeter cell.
00499    * First array index corresponds to rapidity index of cell,
00500    * second array index corresponds to phi cell index.
00501    */
00502   vector<vector<Energy> > et_;
00503 
00504   /*
00505    * For a given calorimeter cell this holds the index of the jet
00506    * that the cell was clustered into.
00507    */
00508   vector<vector<int> > jetIdx_;
00509 
00510   /*
00511    * Vector holding the Lorentz 5 momenta of each jet.
00512    */
00513   vector<Lorentz5Momentum> pjet_;
00514 
00515   /*
00516    * Vector holding the list of FS particles resulting from 
00517    * the particle input to getDescendents.
00518    */
00519   ParticleVector tmpList_;
00520 
00521   /*
00522    * Variables for the C++ translation of the calini_m(), calsim_m(),
00523    * getjet_m(...) and caldel_m() functions 
00524    */
00525   vector<Energy> etjet_;
00526   double dely_, delphi_;
00527   
00528 };
00529 
00530 }
00531 
00532 #include "ThePEG/Utilities/ClassTraits.h"
00533 
00534 namespace ThePEG {
00535 
00540 template <>
00541 struct BaseClassTrait<Herwig::AlpGenHandler,1> {
00543   typedef Herwig::ShowerHandler NthBase;
00544 };
00545 
00548 template <>
00549 struct ClassTraits<Herwig::AlpGenHandler>
00550   : public ClassTraitsBase<Herwig::AlpGenHandler> {
00552   static string className() { return "Herwig::AlpGenHandler"; }
00560   static string library() { return "AlpGenHandler.so"; }
00561 };
00562 
00565 }
00566 
00567 #endif /* HERWIG_AlpGenHandler_H */