CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/GeneratorInterface/ExhumeInterface/interface/CrossSection.h

Go to the documentation of this file.
00001 //-*-C++-*-
00002 //-*-CrossSection.h-*-
00003 //   Written by James Monk and Andrew Pilkington
00005 
00006 #ifndef CROSSSECTION_HH
00007 #define CROSSSECTION_HH
00008 
00009 #include <cmath>
00010 #include <complex>
00011 #include <cstdlib>
00012 #include <iostream>
00013 #include <map>
00014 #include <string>
00015 #include <utility>
00016 #include <vector>
00017 
00018 //#include "CLHEP/config/CLHEP.h"
00019 #include "CLHEP/Vector/LorentzVector.h"
00020 #include "CLHEP/Vector/ThreeVector.h"
00021 
00022 #include "GeneratorInterface/ExhumeInterface/interface/I.h"
00023 #include "GeneratorInterface/ExhumeInterface/interface/PI.h"
00024 //#include "GeneratorInterface/ExhumeInterface/interface/PythiaRecord.h"
00025 #include "GeneratorInterface/ExhumeInterface/interface/Particle.h"
00026 
00027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00028 
00029 //#include "CLHEP/HepMC/include/PythiaWrapper6_2.h"
00030 //#include "CLHEP/HepMC/ConvertHEPEVT.h"
00031 //#include "CLHEP/HepMC/CBhepevt.h"
00032 
00033 namespace CLHEP {
00034 class HepRandomEngine;
00035 }
00036 
00038 namespace Exhume{
00039   
00040   typedef std::pair<double,double> fEntry;
00041   typedef std::pair<const char*,char*> PCharPair;
00042   typedef std::pair<const char*,const void*> PConstVoidPair;
00043   
00044   class CrossSection{
00045 
00046   public:
00047 
00048     CrossSection(const edm::ParameterSet&);
00049     virtual ~CrossSection();
00050     virtual void MaximiseSubParameters()=0;
00051     virtual void SetPartons()=0;
00052     virtual void SetSubParameters()=0;
00053     virtual double SubParameterRange()=0;
00054     virtual double SubParameterWeight()=0;
00055 
00056     double AlphaS(const double&);
00057 
00058     inline void SetRandomEngine(CLHEP::HepRandomEngine* engine){randomEngine = engine;}
00059 
00060     inline double GetRg(const double &x_, const double &Qt){
00061 
00062       return(Rg_(x_, Qt) );
00063     };
00064 
00065     //.....
00066     inline double Differential(){
00067 
00068       if(x1>1.0 || x2 > 1.0){
00069         return(0.0);
00070       }
00071 
00072       //return( SubProcess() );
00073 
00074       //Factor of 2/sqrt(sHat) because we integrate dM not dln(M^2)
00075       return( 2.0 * InvSqrtsHat * Lumi() * SubProcess() * exp(B*(t1 + t2))); 
00076     };
00077     //.....
00078 
00079     inline double GetB(){
00080       return(B);
00081     };
00082 
00083     inline double GetRoot_s(){
00084       return(root_s);
00085     };
00086 
00087     inline std::map<double,double> Getfg2Map(){
00088       return(fg2Map);
00089     };
00090 
00091     inline CLHEP::HepLorentzVector GetProton1(){
00092       return(Proton1);
00093     };
00094 
00095     inline CLHEP::HepLorentzVector GetProton2(){
00096       return(Proton2);
00097     };
00098 
00099     inline std::vector<Particle> GetPartons(){
00100       return(Partons);
00101     };
00102 
00103     inline double Getx1(){
00104       return(x1);
00105     };
00106     
00107     inline double Getx2(){
00108       return(x2);
00109     };
00110 
00111     inline double Gett1(){
00112       return(t1);
00113     };
00114 
00115     inline double Gett2(){
00116       return(t2);
00117     };
00118     
00119     inline double GetsHat(){
00120       return(sHat);
00121     };
00122 
00123     inline double GetSqrtsHat(){
00124       return(SqrtsHat);
00125     };
00126 
00127     inline double GetEta(){
00128       return(y);
00129     };
00130 
00131     inline double GetPhi1(){
00132       return(Phi1);
00133     };
00134 
00135     inline double GetPhi2(){
00136       return(Phi2);
00137     };
00138 
00139     void Hadronise();
00140     void SetKinematics(const double&, const double&,
00141                        const double&, const double&, 
00142                        const double&, const double&);
00143 
00144     inline std::string GetName(){
00145       return(Name);
00146     };
00147 
00148   private:
00149 
00150     void AlphaSInit();
00151 
00152     double Fg1Fg2(const double&, const double&, const double&);
00153     double Fg1Fg2(const int&, const double&, const double&);
00154 
00155     inline double Fg_Qt2(const double &Qt2_, 
00156                          const double &x_, const double &xp_){
00157 
00158       double grad = 5.0 * (Txg(1.1 * Qt2_, x_) - Txg(0.9 * Qt2_, x_) ) / Qt2_;
00159 
00160       //protect from Qt2 == 0
00161 
00162       if(grad!=grad){
00163 
00164         return(0.0);
00165       }
00166       return(grad);    
00167     };
00168     
00169     template <typename T_>
00170     inline void insert(const std::string _name_, const T_ _x_){
00171       PMap.insert
00172         (std::pair<std::string,PConstVoidPair>
00173          (_name_,PConstVoidPair(typeid(_x_).name(),_x_)));
00174     }
00175 
00176     virtual double SubProcess() = 0;
00177 
00178     void LumiInit();
00179     double Lumi();
00180     double Lumi_();
00181     void NoMem();
00182     void   ReadCard(const std::string&);
00183     double Splitting(const double&);
00184     double T(const double&);
00185     double TFast(const double&);
00186 
00187     bool TBegin, TInterpolate;
00188     std::map<double, std::map<double, double> > TMap2d;
00189     std::map<double, std::map<double, double> >::iterator TMjuHigh, TMjuLow;
00190 
00191     double Txg(const double&, const double&);
00192 
00193     double Rg1Rg2(const double&);
00194     double Rg_(const double&, double);
00195 
00196     std::map<double, std::map<double, double> > RgMap2d;
00197     std::map<double, std::map<double, double> >::iterator RgHigh[2], RgLow[2];
00198     bool RgInterpolate[2], RgBegin;
00199 
00200     double B,
00201       Freeze,
00202       LambdaQCD,
00203       Rg,
00204       Survive;
00205 
00206     double PDF;
00207       
00208     double ASFreeze, ASConst;
00209     //.............................
00210     //Used for Lumi function:
00211     
00212     double MinQt2, MidQt2, InvMidQt2, InvMidQt4, InvMaxQt2,
00213       LumSimpsIncr;
00214     unsigned int LumAccuracy, LumNStart;
00215     int LumNSimps, LumNSimps_1;
00216     double *LumSimpsFunc, *_Qt2, *_Qt, *_KtLow, *_KtHigh, 
00217       *_AlphaS, *_CfAs_2PIRg, *_NcAs_2PI;
00218     double LumConst;
00219     double Inv2PI, Nc_2PI, Cf_2PIRg;
00220 
00221     std::map<std::string,PConstVoidPair> PMap;
00222     std::map<const char*,char*> TypeMap;
00223     std::map<double, double> fg2Map;
00224 
00225     //...............................
00226     //Used for T:
00227     double TConst;
00228     int Tn, Tn_1;
00229     double *TFunc;
00230 
00231     //...............................
00232     //Used for Splitting:
00233     double Inv3;
00234 
00235     int Proton1Id, Proton2Id;
00236 
00237   protected:
00238 
00239     std::string Name;
00240 
00241     std::complex<double> F0(const double&);
00242     std::complex<double> f(const double&);
00243     std::complex<double> Fsf(const double&);
00244 
00245     //PPhi is azimuthal angle between protons.  
00246     //InvSqrtsHat = 1/sHat
00247     //Others are obvious.
00248     double x1, x1p, x2, x2p, t1, t2, sHat,  SqrtsHat,
00249       sHat2, InvsHat, InvsHat2, InvSqrtsHat, y, PPhi, Phi1, Phi2,
00250       Mju2, Mju, LnMju2,
00251       Pt1, Pt2, Pt1DotPt2,
00252       x1x2, ey;
00253 
00254     double AlphaEw,
00255       gw,
00256       HiggsVev,
00257       LambdaW;
00258 
00259     double BottomMass,
00260       CharmMass,
00261       StrangeMass,
00262       TopMass;
00263 
00264     double MuonMass,
00265       TauMass;
00266 
00267     double HiggsMass,
00268       WMass,
00269       ZMass;
00270 
00271     int FNAL_or_LHC;
00272     double root_s,
00273       s, Invs;
00274 
00275     CLHEP::HepLorentzVector CentralVector;
00276     CLHEP::HepLorentzVector Proton1, Proton2, P1In, P2In;
00277     /*
00278     struct Particle {
00279       CLHEP::HepLorentzVector p;
00280       int id;
00281     };
00282     */
00283 
00284     std::vector<Particle> Partons;
00285     double Invsx1x2, InvV1MinusV2;
00286 
00287     double Gev2fb;
00288 
00289     std::string lhapdfSetPath_;
00290 
00291     CLHEP::HepRandomEngine* randomEngine;
00292   };
00293 }
00294 
00295 #endif
00296