Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-14 08:15:09

0001 ///////////////////////////////////////////////////////////////////////////
0002 //
0003 // Copyright 2010
0004 //
0005 // This file is part of starlight.
0006 //
0007 // starlight is free software: you can redistribute it and/or modify
0008 // it under the terms of the GNU General Public License as published by
0009 // the Free Software Foundation, either version 3 of the License, or
0010 // (at your option) any later version.
0011 //
0012 // starlight is distributed in the hope that it will be useful,
0013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0015 // GNU General Public License for more details.
0016 //
0017 // You should have received a copy of the GNU General Public License
0018 // along with starlight. If not, see <http://www.gnu.org/licenses/>.
0019 //
0020 ///////////////////////////////////////////////////////////////////////////
0021 //
0022 // File and Version Information:
0023 // $Rev:: 276 $: revision of last commit // $Author:: jnystra#$: author of last commit
0024 // $Date:: 2016-09-13 19:54:42 +0100 #$: date of last commit //
0025 // Description:
0026 //
0027 //
0028 //
0029 ///////////////////////////////////////////////////////////////////////////
0030 
0031 #include <iostream>
0032 #include <fstream>
0033 
0034 #include "reportingUtils.h"
0035 #include "starlightconstants.h"
0036 #include "inputParameters.h"
0037 #include "inputParser.h"
0038 #include "starlightconfig.h"
0039 #include <cmath>
0040 #include <cstring>
0041 #include "randomgenerator.h"
0042 
0043 using namespace std;
0044 using namespace starlightConstants;
0045 
0046 parameterlist parameterbase::_parameters;
0047 
0048 #define REQUIRED true
0049 #define NOT_REQUIRED false
0050 
0051 //______________________________________________________________________________
0052 inputParameters::inputParameters()
0053     : _baseFileName("baseFileName", "slight"),
0054       _targetBeamZ("TARGET_BEAM_Z", 0),
0055       _targetBeamA("TARGET_BEAM_A", 0),
0056       _electronBeamLorentzGamma("ELECTRON_BEAM_GAMMA", 0),
0057       _targetBeamLorentzGamma("TARGET_BEAM_GAMMA", 0),
0058       _maxW("W_MAX", 0),
0059       _minW("W_MIN", 0),
0060       _maxW_GP("W_GP_MAX", 0, NOT_REQUIRED),
0061       _minW_GP("W_GP_MIN", 0, NOT_REQUIRED),
0062       _nmbWBins("W_N_BINS", 0),
0063       _maxRapidity("RAP_MAX", 9, NOT_REQUIRED),
0064       _nmbRapidityBins("RAP_N_BINS", 100, NOT_REQUIRED),
0065       _nmbEnergyBins("EGA_N_BINS", 0),
0066       _ptCutEnabled("CUT_PT", false, NOT_REQUIRED),
0067       _ptCutMin("PT_MIN", 0, NOT_REQUIRED),
0068       _ptCutMax("PT_MAX", 0, NOT_REQUIRED),
0069       _etaCutEnabled("CUT_ETA", false, NOT_REQUIRED),
0070       _etaCutMin("ETA_MIN", 0, NOT_REQUIRED),
0071       _etaCutMax("ETA_MAX", 0, NOT_REQUIRED),
0072       _productionMode("PROD_MODE", 0),
0073       _nmbEventsTot("N_EVENTS", 0),
0074       _prodParticleId("PROD_PID", 0),
0075       _randomSeed("RND_SEED", 0),
0076       _beamBreakupMode("BREAKUP_MODE", 0),
0077       _interferenceEnabled("INTERFERENCE", false, NOT_REQUIRED),
0078       _interferenceStrength("IF_STRENGTH", 0, NOT_REQUIRED),
0079       _maxPtInterference("INT_PT_MAX", 0, NOT_REQUIRED),
0080       _nmbPtBinsInterference("INT_PT_N_BINS", 0),
0081       _ptBinWidthInterference("INT_PT_WIDTH", 0),
0082       _protonEnergy("PROTON_ENERGY", 0, NOT_REQUIRED),
0083       _electronEnergy("ELECTRON_ENERGY", 0, NOT_REQUIRED),
0084       _minGammaEnergy("MIN_GAMMA_ENERGY", 6.0, NOT_REQUIRED),
0085       _maxGammaEnergy("MAX_GAMMA_ENERGY", 600000.0, NOT_REQUIRED),
0086       _minGammaQ2("MIN_GAMMA_Q2", 0, NOT_REQUIRED),
0087       _maxGammaQ2("MAX_GAMMA_Q2", 0, NOT_REQUIRED),
0088       _nmbGammaQ2Bins("INT_GAMMA_Q2_BINS", 400, NOT_REQUIRED),
0089       _pythiaParams("PYTHIA_PARAMS", "", NOT_REQUIRED),
0090       _outputFormat("OUTPUT_FORMAT", 0, NOT_REQUIRED),
0091       _backwardsProduction("BACKWARDS_PRODUCTION", false, NOT_REQUIRED),
0092 
0093       _xsecCalcMethod("XSEC_METHOD", 0, NOT_REQUIRED),
0094       _axionMass("AXION_MASS", 50, NOT_REQUIRED),                       // AXION HACK
0095       _rho0PrimeBrFourProng("RHO0PRIME_BR_FOURPRONG", 1, NOT_REQUIRED), // AXION HACK
0096       _rho0PrimeCoupling("RHO0PRIME_COUPLING", 8.4, NOT_REQUIRED),      // AXION HACK
0097       _bslopeDefinition("BSLOPE_DEFINITION", 0, NOT_REQUIRED),
0098       _bslopeValue("BSLOPE_VALUE", 4.0, NOT_REQUIRED),
0099       _impulseVM("SELECT_IMPULSE_VM", 0, NOT_REQUIRED),
0100       _quantumGlauber("QUANTUM_GLAUBER", 0, NOT_REQUIRED)
0101 {
0102   // All parameters must be initialised in initialisation list!
0103   // If not: error: 'parameter<T, validate>::parameter() [with T = unsigned int, bool validate = true]' is private
0104   // or similar
0105 
0106   _ip.addParameter(_baseFileName);
0107 
0108   _ip.addParameter(_targetBeamZ);
0109   _ip.addParameter(_targetBeamA);
0110 
0111   _ip.addParameter(_targetBeamLorentzGamma);
0112   _ip.addParameter(_electronBeamLorentzGamma);
0113 
0114   _ip.addParameter(_maxW);
0115   _ip.addParameter(_minW);
0116 
0117   _ip.addParameter(_maxW_GP);
0118   _ip.addParameter(_minW_GP);
0119 
0120   _ip.addParameter(_nmbWBins);
0121 
0122   _ip.addParameter(_maxRapidity);
0123   _ip.addParameter(_nmbRapidityBins);
0124   //
0125   _ip.addParameter(_nmbEnergyBins);
0126 
0127   _ip.addParameter(_ptCutEnabled);
0128   _ip.addParameter(_ptCutMin);
0129   _ip.addParameter(_ptCutMax);
0130 
0131   _ip.addParameter(_etaCutEnabled);
0132   _ip.addParameter(_etaCutMax);
0133   _ip.addParameter(_etaCutMin);
0134 
0135   _ip.addParameter(_productionMode);
0136   _ip.addParameter(_nmbEventsTot);
0137   _ip.addParameter(_prodParticleId);
0138   _ip.addParameter(_randomSeed);
0139   _ip.addParameter(_beamBreakupMode);
0140   _ip.addParameter(_interferenceEnabled);
0141   _ip.addParameter(_interferenceStrength);
0142   _ip.addParameter(_maxPtInterference);
0143   _ip.addParameter(_nmbPtBinsInterference);
0144   _ip.addParameter(_minGammaEnergy);
0145   _ip.addParameter(_maxGammaEnergy);
0146   _ip.addParameter(_minGammaQ2);
0147   _ip.addParameter(_maxGammaQ2);
0148   _ip.addParameter(_nmbGammaQ2Bins);
0149   _ip.addParameter(_pythiaParams);
0150   _ip.addParameter(_outputFormat);
0151   _ip.addParameter(_backwardsProduction);
0152   _ip.addParameter(_xsecCalcMethod);
0153   _ip.addParameter(_axionMass);            // AXION HACK
0154   _ip.addParameter(_rho0PrimeBrFourProng); // AXION HACK
0155   _ip.addParameter(_rho0PrimeCoupling);    // AXION HACK
0156   _ip.addParameter(_bslopeDefinition);
0157   _ip.addParameter(_bslopeValue);
0158   _ip.addParameter(_impulseVM);
0159   _ip.addParameter(_quantumGlauber);
0160 }
0161 
0162 //______________________________________________________________________________
0163 inputParameters::~inputParameters()
0164 {
0165 }
0166 
0167 //______________________________________________________________________________
0168 bool inputParameters::configureFromFile(const std::string &_configFileName)
0169 {
0170 
0171   int nParameters = _ip.parseFile(_configFileName);
0172 
0173   if (nParameters == -1)
0174   {
0175     printWarn << "could not open file '" << _configFileName << "'" << endl;
0176     return false;
0177   }
0178 
0179   if (_ip.validateParameters(cerr))
0180     printInfo << "successfully read input parameters from '" << _configFileName << "'" << endl;
0181   else
0182   {
0183     printWarn << "problems reading input parameters from '" << _configFileName << "'" << endl
0184               << *this;
0185     return false;
0186   }
0187   return true;
0188 }
0189 bool inputParameters::init()
0190 {
0191 
0192   // Calculate beam gamma in CMS frame
0193   double rap1 = acosh(electronBeamLorentzGamma());
0194   double rap2 = -acosh(targetBeamLorentzGamma());
0195 
0196   double _electronEnergy_lab = (electronBeamLorentzGamma()) * (starlightConstants::mel);
0197   double _ionEnergy_lab = targetBeamLorentzGamma() * (targetBeamA()) * protonMass;
0198   double _ionPz_lab = -1.0 * sqrt(_ionEnergy_lab * _ionEnergy_lab - (targetBeamA() * targetBeamA()) * protonMass * protonMass);
0199   double _electronPz_lab = 1.0 * sqrt(_electronEnergy_lab * _electronEnergy_lab - starlightConstants::mel * (starlightConstants::mel));
0200   double _totalEnergy_lab = 1.0 * _electronEnergy_lab + _ionEnergy_lab;
0201   double _totalPz_lab = _ionPz_lab + _electronPz_lab;
0202   _rap_CM = (1.0 / 2.0) * log((_totalEnergy_lab + _totalPz_lab) / (_totalEnergy_lab - _totalPz_lab));
0203   double _totalEnergy_COM;
0204   _totalEnergy_COM = sqrt((_totalEnergy_lab) * (_totalEnergy_lab) - (_totalPz_lab) * (_totalPz_lab)); // This is Lorentz invariant.
0205 
0206   _beamLorentzGamma = cosh(_rap_CM - rap2);
0207   _targetLorentzGamma = cosh(rap1 - rap2);
0208 
0209   if (targetBeamA() == 1) // proton case 0.87 fm = 4.4 GeV^{-1}
0210     _targetR = 4.4;
0211   else
0212     _targetR = 6.1 * pow(targetBeamA(), 1. / 3.);
0213   //_targetR = 4.4/2.;
0214 
0215   _fixedQ2Range = false;
0216   std::cout << "Rapidity electron beam: " << rap1 << ", rapidity target beam: " << rap2 << ", rapidity CMS system: " << _rap_CM << ", beam gamma in CMS: " << _beamLorentzGamma << std::endl;
0217   std::cout << "Rapidity beam 1 in beam 2 frame: " << rap1 - rap2 << ", beam 1 gamma in beam 2 frame: " << _targetLorentzGamma << std::endl;
0218   _ptBinWidthInterference = maxPtInterference() / nmbPtBinsInterference();
0219   _protonEnergy = _beamLorentzGamma * protonMass;
0220   // Electron energy in the target frame of reference
0221   _electronEnergy = _targetLorentzGamma * starlightConstants::mel;
0222 
0223   if ((targetBeamZ() == 1) && (targetBeamA() == 3))
0224   {
0225     printWarn << "tritium is not currently supported" << endl;
0226     return false;
0227   }
0228   // check that rho production uses wide resonance option
0229   if (_prodParticleId.value() == 113 && _productionMode.value() == 2)
0230   {
0231     printWarn << endl
0232               << "For rho meson production, you should choose the wide resonance option (production mode = 3)" << endl;
0233     return false;
0234   }
0235 
0236   // define interaction type
0237   switch (productionMode())
0238   {
0239   case 1:
0240     _interactionType = PHOTONPHOTON;
0241     break;
0242   case 2:
0243     _interactionType = PHOTONPOMERONNARROW;
0244     break;
0245   case 3:
0246     _interactionType = PHOTONPOMERONWIDE;
0247     break;
0248   case 4:
0249     _interactionType = PHOTONPOMERONINCOHERENT;
0250     break;
0251   case 5:
0252     _interactionType = PHOTONUCLEARSINGLE;
0253     break;
0254   case 6:
0255     _interactionType = PHOTONUCLEARDOUBLE;
0256     break;
0257   case 7:
0258     _interactionType = PHOTONUCLEARSINGLEPA;
0259     break;
0260   case 8:
0261     _interactionType = PHOTONUCLEARSINGLEPAPY;
0262     break;
0263     //  case 9:
0264     //      _interactionType = PHOTONPHOTONKNIEHL;
0265     //      break;
0266     //         case 10:
0267     //                 _interactionType = PHOTONPHOTONKNIEHLMODIFIED;
0268     //                 break;
0269   case 12:
0270     _interactionType = E_PHOTONPOMERONNARROW;
0271     break;
0272   case 13:
0273     _interactionType = E_PHOTONPOMERONWIDE;
0274     break;
0275 
0276   default:
0277     printWarn << "unknown production mode '" << _productionMode << "'" << endl;
0278     return false;
0279   }
0280   if ((_productionMode.value() == 4) && (_interferenceEnabled.value()))
0281   {
0282     printWarn << " cannot enable interference for incoherent production " << endl;
0283     return false;
0284   }
0285 
0286   double mass = 0;
0287   double width = 0;
0288   double defaultMinW = 0; // default for _minW, unless it is defined later [GeV/c^2]
0289   double defaultMaxW = 0; // default for _maxW, unless it is defined later [GeV/c^2]
0290   switch (prodParticleId())
0291   {
0292 
0293     //  case 24:  // W+W- pair
0294     //      _particleType = W;
0295     //      _decayType    = WW;
0296     //      defaultMinW   = 2 * muonMass;
0297     //      break;
0298   case 115: // a_2(1320)
0299     _particleType = A2;
0300     _decayType = SINGLEMESON;
0301     mass = starlightConstants::a2Mass;
0302     width = starlightConstants::a2Width;
0303     defaultMinW = mass - 5 * width; // JES 6.17.2015 to avoid problems with default of 0
0304     defaultMaxW = mass + 5 * width; // JES 6.17.2015 to avoid problems with no default
0305     _inputBranchingRatio = 1.0;
0306     break;
0307   case 221: // eta
0308     _particleType = ETA;
0309     _decayType = SINGLEMESON;
0310     mass = starlightConstants::etaMass;
0311     width = starlightConstants::etaWidth;
0312     defaultMinW = mass - 5 * width; // JES 6.17.2015 to avoid problems with default of 0
0313     defaultMaxW = mass + 5 * width; // JES 6.17.2015 to avoid problems with no default
0314     _inputBranchingRatio = 1.0;
0315     break;
0316   case 225: // f_2(1270)
0317     _particleType = F2;
0318     _decayType = SINGLEMESON;
0319     mass = starlightConstants::f2Mass;
0320     width = starlightConstants::f2Width;
0321     defaultMinW = mass - 5 * width; // JES 6.17.2015 to avoid problems with default of 0
0322     defaultMaxW = mass + 5 * width; // JES 6.17.2015 to avoid problems with no default
0323     _inputBranchingRatio = starlightConstants::f2BrPiPi;
0324     break;
0325   case 331: // eta'(958)
0326     _particleType = ETAPRIME;
0327     _decayType = SINGLEMESON;
0328     mass = starlightConstants::etaPrimeMass;
0329     width = starlightConstants::etaPrimeWidth;
0330     defaultMinW = mass - 5 * width; // JES 6.17.2015 to avoid problems with default of 0
0331     defaultMaxW = mass + 5 * width; // JES 6.17.2015 to avoid problems with no default
0332     _inputBranchingRatio = 1.0;
0333     break;
0334   case 335: // f_2'(1525)
0335     _particleType = F2PRIME;
0336     _decayType = SINGLEMESON;
0337     mass = starlightConstants::f2PrimeMass;
0338     width = starlightConstants::f2PrimeWidth;
0339     defaultMinW = mass - 5 * width; // JES 6.17.2015 to avoid problems with default of 0
0340     defaultMaxW = mass + 5 * width; // JES 6.17.2015 to avoid problems with no default
0341     _inputBranchingRatio = starlightConstants::f2PrimeBrKK;
0342     break;
0343   case 441: // eta_c(1s)
0344     _particleType = ETAC;
0345     _decayType = SINGLEMESON;
0346     mass = starlightConstants::etaCMass;
0347     width = starlightConstants::etaCWidth;
0348     defaultMinW = mass - 5 * width; // JES 6.17.2015 to avoid problems with default of 0
0349     defaultMaxW = mass + 5 * width; // JES 6.17.2015 to avoid problems with no default
0350     _inputBranchingRatio = 1.0;
0351     break;
0352   case 9010221: // f_0(980), was orginally called 10221? updated to standard number
0353     _particleType = F0;
0354     _decayType = SINGLEMESON;
0355     mass = starlightConstants::f0Mass;
0356     width = starlightConstants::f0Width;
0357     defaultMinW = mass - 5 * width; // JES 6.17.2015 to avoid problems with default of 0
0358     defaultMaxW = mass + 5 * width; // JES 6.17.2015 to avoid problems with no default
0359     _inputBranchingRatio = starlightConstants::f0BrPiPi;
0360     break;
0361   case 33: // Z"/Z0  This is the rho^0 rho^0 final state SRK
0362     _particleType = ZOVERZ03;
0363     _decayType = SINGLEMESON;
0364     defaultMinW = 4 * starlightConstants::pionChargedMass;
0365     defaultMaxW = 1.6; // JES 6.17.2015 to avoid problems with no default
0366     _inputBranchingRatio = 1.0;
0367     break;
0368   case 88: // axion// AXION HACK, till break statement
0369     _particleType = AXION;
0370     _decayType = SINGLEMESON;
0371     mass = _axionMass.value();
0372     width = 1 / (64 * starlightConstants::pi) * mass * mass * mass / (1000 * 1000); // Fix Lambda=1000 GeV, rescaling is trivial.
0373     defaultMinW = mass - 5 * width;                                                 // JES 6.17.2015 to avoid problems with default of 0
0374     defaultMaxW = mass + 5 * width;                                                 // JES 6.17.2015 to avoid problems with no default
0375     break;                                                                          // AXION HACK, end
0376                                                                                     //  case 25: // Higgs
0377                                                                                     //      _particleType = HIGGS;
0378                                                                                     //      _decayType    = SINGLEMESON;
0379                                                                                     //      break;
0380   case 113:                                                                         // rho(770)
0381     _particleType = RHO;
0382     _decayType = WIDEVMDEFAULT;
0383     mass = starlightConstants::rho0Mass;
0384     width = starlightConstants::rho0Width;
0385     defaultMinW = 2 * starlightConstants::pionChargedMass;
0386     defaultMaxW = mass + 5 * width;
0387     _inputBranchingRatio = starlightConstants::rho0BrPiPi;
0388     break;
0389   case 913: // rho(770) with direct pi+pi- decay, interference given by ZEUS data
0390     _particleType = RHOZEUS;
0391     _decayType = WIDEVMDEFAULT;
0392     mass = starlightConstants::rho0Mass;
0393     width = starlightConstants::rho0Width;
0394     defaultMinW = 2 * starlightConstants::pionChargedMass;
0395     defaultMaxW = mass + 5 * width; // use the same 1.5GeV max mass as ZEUS
0396     _inputBranchingRatio = starlightConstants::rho0BrPiPi;
0397     break;
0398   case 999: // pi+pi-pi+pi- phase space decay
0399     _particleType = FOURPRONG;
0400     _decayType = WIDEVMDEFAULT;
0401     mass = starlightConstants::rho0PrimeMass;
0402     width = starlightConstants::rho0PrimeWidth;
0403     defaultMinW = 4 * starlightConstants::pionChargedMass;
0404     defaultMaxW = mass + 5 * width;
0405     _inputBranchingRatio = _rho0PrimeBrFourProng.value();
0406     break;
0407   case 223: // omega(782)
0408     _particleType = OMEGA;
0409     _decayType = NARROWVMDEFAULT;
0410     mass = starlightConstants::OmegaMass;
0411     width = starlightConstants::OmegaWidth;
0412     defaultMinW = mass - 5 * width;
0413     defaultMaxW = mass + 5 * width;
0414     _inputBranchingRatio = starlightConstants::OmegaBrPiPi;
0415     break;
0416   case 223022: // omega(782) -> pi0 + gamma
0417     _particleType = OMEGA_pi0gamma;
0418     _decayType = NARROWVMDEFAULT;
0419     mass = starlightConstants::OmegaMass;
0420     width = starlightConstants::OmegaWidth;
0421     defaultMinW = mass - 5 * width;
0422     defaultMaxW = mass + 5 * width;
0423     _inputBranchingRatio = starlightConstants::OmegaBrPi0Gamma;
0424     break;
0425   case 333: // phi(1020)
0426     _particleType = PHI;
0427     _decayType = NARROWVMDEFAULT;
0428     mass = starlightConstants::PhiMass;
0429     width = starlightConstants::PhiWidth;
0430     defaultMinW = 2 * kaonChargedMass;
0431     defaultMaxW = mass + 5 * width;
0432     _inputBranchingRatio = starlightConstants::PhiBrKK;
0433     break;
0434   case 443: // J/psi
0435     _particleType = JPSI;
0436     _decayType = NARROWVMDEFAULT;
0437     mass = starlightConstants::JpsiMass;
0438     width = starlightConstants::JpsiWidth;
0439     defaultMinW = mass - 5 * width;
0440     defaultMaxW = mass + 5 * width;
0441     _inputBranchingRatio = (starlightConstants::JpsiBree + starlightConstants::JpsiBrmumu) / 2.;
0442     break;
0443   case 443011: // J/psi
0444     _particleType = JPSI_ee;
0445     _decayType = NARROWVMDEFAULT;
0446     mass = starlightConstants::JpsiMass;
0447     width = starlightConstants::JpsiWidth;
0448     defaultMinW = mass - 5 * width;
0449     defaultMaxW = mass + 5 * width;
0450     _inputBranchingRatio = starlightConstants::JpsiBree;
0451     break;
0452   case 443013: // J/psi
0453     cout << "In inputParameters setting J/psi mass!" << endl;
0454     _particleType = JPSI_mumu;
0455     _decayType = NARROWVMDEFAULT;
0456     mass = starlightConstants::JpsiMass;
0457     width = starlightConstants::JpsiWidth;
0458     defaultMinW = mass - 5 * width;
0459     defaultMaxW = mass + 5 * width;
0460     _inputBranchingRatio = starlightConstants::JpsiBrmumu;
0461     break;
0462   case 444: // psi(2S)
0463     _particleType = JPSI2S;
0464     _decayType = NARROWVMDEFAULT;
0465     mass = starlightConstants::Psi2SMass;
0466     width = starlightConstants::Psi2SWidth;
0467     defaultMinW = mass - 5 * width;
0468     defaultMaxW = mass + 5 * width;
0469     _inputBranchingRatio = (starlightConstants::Psi2SBree + starlightConstants::Psi2SBrmumu) / 2.;
0470     break;
0471   case 444011: // psi(2S)
0472     _particleType = JPSI2S_ee;
0473     _decayType = NARROWVMDEFAULT;
0474     mass = starlightConstants::Psi2SMass;
0475     width = starlightConstants::Psi2SWidth;
0476     defaultMinW = mass - 5 * width;
0477     defaultMaxW = mass + 5 * width;
0478     _inputBranchingRatio = starlightConstants::Psi2SBree;
0479     break;
0480   case 444013: // psi(2S)
0481     _particleType = JPSI2S_mumu;
0482     _decayType = NARROWVMDEFAULT;
0483     mass = starlightConstants::Psi2SMass;
0484     width = starlightConstants::Psi2SWidth;
0485     defaultMinW = mass - 5 * width;
0486     defaultMaxW = mass + 5 * width;
0487     _inputBranchingRatio = starlightConstants::Psi2SBrmumu;
0488     break;
0489   case 553: // Upsilon(1S)
0490     _particleType = UPSILON;
0491     _decayType = NARROWVMDEFAULT;
0492     mass = starlightConstants::Upsilon1SMass;
0493     width = starlightConstants::Upsilon1SWidth;
0494     defaultMinW = mass - 5 * width;
0495     defaultMaxW = mass + 5 * width;
0496     _inputBranchingRatio = (starlightConstants::Upsilon1SBree + starlightConstants::Upsilon1SBrmumu) / 2.;
0497     break;
0498   case 553011: // Upsilon
0499     _particleType = UPSILON_ee;
0500     _decayType = NARROWVMDEFAULT;
0501     mass = starlightConstants::Upsilon1SMass;
0502     width = starlightConstants::Upsilon1SWidth;
0503     defaultMinW = mass - 5 * width;
0504     defaultMaxW = mass + 5 * width;
0505     _inputBranchingRatio = starlightConstants::Upsilon1SBree;
0506     break;
0507   case 553013: // Upsilon
0508     _particleType = UPSILON_mumu;
0509     _decayType = NARROWVMDEFAULT;
0510     mass = starlightConstants::Upsilon1SMass;
0511     width = starlightConstants::Upsilon1SWidth;
0512     defaultMinW = mass - 5 * width;
0513     defaultMaxW = mass + 5 * width;
0514     _inputBranchingRatio = starlightConstants::Upsilon1SBrmumu;
0515     break;
0516   case 554: // Upsilon(2S)
0517     _particleType = UPSILON2S;
0518     _decayType = NARROWVMDEFAULT;
0519     mass = starlightConstants::Upsilon2SMass;
0520     width = starlightConstants::Upsilon2SWidth;
0521     defaultMinW = mass - 5 * width;
0522     defaultMaxW = mass + 5 * width;
0523     _inputBranchingRatio = (starlightConstants::Upsilon2SBree + starlightConstants::Upsilon2SBrmumu) / 2.;
0524     break;
0525   case 554011: // Upsilon(2S)
0526     _particleType = UPSILON2S_ee;
0527     _decayType = NARROWVMDEFAULT;
0528     mass = starlightConstants::Upsilon2SMass;
0529     width = starlightConstants::Upsilon2SWidth;
0530     defaultMinW = mass - 5 * width;
0531     defaultMaxW = mass + 5 * width;
0532     _inputBranchingRatio = starlightConstants::Upsilon2SBree;
0533     break;
0534   case 554013: // Upsilon(2S)
0535     _particleType = UPSILON2S_mumu;
0536     _decayType = NARROWVMDEFAULT;
0537     mass = starlightConstants::Upsilon2SMass;
0538     width = starlightConstants::Upsilon2SWidth;
0539     defaultMinW = mass - 5 * width;
0540     defaultMaxW = mass + 5 * width;
0541     _inputBranchingRatio = starlightConstants::Upsilon2SBrmumu;
0542     break;
0543   case 555: // Upsilon(3S)
0544     _particleType = UPSILON3S;
0545     _decayType = NARROWVMDEFAULT;
0546     mass = starlightConstants::Upsilon3SMass;
0547     width = starlightConstants::Upsilon3SWidth;
0548     defaultMinW = mass - 5 * width;
0549     defaultMaxW = mass + 5 * width;
0550     _inputBranchingRatio = (starlightConstants::Upsilon3SBree + starlightConstants::Upsilon3SBrmumu) / 2.;
0551     break;
0552   case 555011: // Upsilon(3S)
0553     _particleType = UPSILON3S_ee;
0554     _decayType = NARROWVMDEFAULT;
0555     mass = starlightConstants::Upsilon3SMass;
0556     width = starlightConstants::Upsilon3SWidth;
0557     defaultMinW = mass - 5 * width;
0558     defaultMaxW = mass + 5 * width;
0559     _inputBranchingRatio = starlightConstants::Upsilon3SBree;
0560     break;
0561   case 555013: // Upsilon(3S)
0562     _particleType = UPSILON3S_mumu;
0563     _decayType = NARROWVMDEFAULT;
0564     mass = starlightConstants::Upsilon3SMass;
0565     width = starlightConstants::Upsilon3SWidth;
0566     defaultMinW = mass - 5 * width;
0567     defaultMaxW = mass + 5 * width;
0568     _inputBranchingRatio = starlightConstants::Upsilon3SBrmumu;
0569     break;
0570   default:
0571     printWarn << "unknown particle ID " << _prodParticleId << endl;
0572     return false;
0573   } // _prodParticleId
0574 
0575   if (_minW.value() == -1)
0576     _minW = defaultMinW;
0577   if (_maxW.value() == -1)
0578     _maxW = defaultMaxW;
0579   if (_maxW.value() <= _minW.value())
0580   {
0581     printWarn << "maxW must be greater than minW" << endl;
0582     return false;
0583   }
0584 
0585   if (_minW_GP.value() == -1)
0586     _minW_GP = 0;
0587   if (_maxW_GP.value() == -1)
0588     _maxW_GP = 1e7;
0589   if (_maxW_GP.value() <= _minW_GP.value())
0590   {
0591     printWarn << "maxW_GA must be greater than minW_GP" << endl;
0592     printWarn << "The value of minW_GP is " << _minW_GP << endl;
0593     printWarn << "The value of maxW_GP is " << _maxW_GP << endl;
0594     return false;
0595   }
0596   if (_minW_GP.value() > _totalEnergy_COM)
0597   {
0598     /* If the minimum COM energy of gamma and nucleon is set by user
0599     to be greater than the total energy supply by electron and target, code will terminate. */
0600     printWarn << "ERROR: The current input minimum CoM energy (_minW_GP) is: " << _minW_GP
0601               << " which is larger than the total center-of-mass energy of the electron-ion system: "
0602               << _totalEnergy_COM << endl;
0603     cout << "Exiting now..." << endl;
0604     return false;
0605   }
0606 
0607   // Sanity check on Q2 range in case it is specified by user
0608   if (_minGammaQ2.value() != 0 || _maxGammaQ2.value() != 0)
0609   {
0610     if (_minGammaQ2.value() < 0 || _maxGammaQ2.value() <= _minGammaQ2.value())
0611       printWarn << "Input values for min and max Q2 are inconsistent: " << _minGammaQ2.value() << "," << _maxGammaQ2.value()
0612                 << ". Continuing with default " << endl;
0613     else
0614       _fixedQ2Range = true;
0615   }
0616   // Photon energy limits in C.M.S frame, used for some basic safety chekcs
0617   _cmsMinPhotonEnergy = 0.5 * (((mass + protonMass) * (mass + protonMass) -
0618                                 protonMass * protonMass) /
0619                                (_protonEnergy.value() + sqrt(_protonEnergy.value() * _protonEnergy.value() - protonMass * protonMass)));
0620   _cmsMaxPhotonEnergy = 0.5 * mass * exp(9);
0621   // Photon limits in target frame: this is where the photon flux is well described
0622   _targetMaxPhotonEnergy = (_targetLorentzGamma - 10.) * starlightConstants::mel;
0623   _targetMinPhotonEnergy = mass;
0624   printInfo << "using the following " << *this;
0625 
0626   return true;
0627 }
0628 
0629 //______________________________________________________________________________
0630 ostream &
0631 inputParameters::print(ostream &out) const
0632 {
0633   out << "starlight parameters:" << endl
0634       << "    base file name  ...................... '" << _baseFileName.value() << "'" << endl
0635       << "    target beam atomic number .............. " << _targetBeamZ.value() << endl
0636       << "    target beam atomic mass number ......... " << _targetBeamA.value() << endl
0637       << "    Lorentz gamma of beams in CM frame ..... " << _beamLorentzGamma << endl
0638       << "    mass W of produced hadronic system ..... " << _minW.value() << " < W < " << _maxW.value() << " GeV/c^2" << endl
0639       << "    # of W bins ............................ " << _nmbWBins.value() << endl
0640       << "    maximum absolute value for rapidity .... " << _maxRapidity.value() << endl
0641       << "    # of rapidity bins ..................... " << _nmbRapidityBins.value() << endl
0642       << "    # of Egamma bins ....................... " << _nmbEnergyBins.value() << endl
0643       << "    cut in pT............................... " << yesNo(_ptCutEnabled.value()) << endl;
0644   if (_ptCutEnabled.value())
0645   {
0646     out << "        minumum pT.......................... " << _ptCutMin.value() << " GeV/c" << endl
0647         << "        maximum pT.......................... " << _ptCutMax.value() << " GeV/c" << endl;
0648   }
0649   out << "    cut in eta.............................. " << yesNo(_etaCutEnabled.value()) << endl;
0650   if (_etaCutEnabled.value())
0651   {
0652     out << "        minumum eta......................... " << _etaCutMin.value() << endl
0653         << "        maximum eta......................... " << _etaCutMax.value() << endl;
0654   }
0655   out << "    production mode ........................ " << _productionMode.value() << endl
0656       << "    number of events to generate ........... " << _nmbEventsTot.value() << endl
0657       << "    PDG ID of produced particle ............ " << _prodParticleId.value() << endl
0658       << "    seed for random generator .............. " << _randomSeed.value() << endl
0659       << "    breakup mode for beam particles ........ " << _beamBreakupMode.value() << endl
0660       << "    interference enabled ................... " << yesNo(_interferenceEnabled.value()) << endl;
0661   if (_interferenceEnabled.value())
0662   {
0663     out << "    interference strength .................. " << _interferenceStrength.value() << endl
0664         << "    maximum p_T for interference calc. ..... " << _maxPtInterference.value() << " GeV/c" << endl
0665         << "    # of p_T bins for interference calc. ... " << _nmbPtBinsInterference.value() << endl;
0666   }
0667   if (_productionMode.value() != 1)
0668   {
0669     if (_productionMode.value() == 4)
0670     {
0671       out << "    coherent scattering off nucleus ........ no" << endl;
0672     }
0673     else
0674     {
0675       out << "    coherent scattering off nucleus ........ yes" << endl;
0676     }
0677   }
0678   if (_fixedQ2Range == true)
0679   {
0680     out << "    fixed photon Q2 range .................. " << _minGammaQ2.value() << " < Q2 < "
0681         << _maxGammaQ2.value() << " GeV/c^2 " << endl;
0682   }
0683   out << "    Q2_BINS...............    " << nmbGammaQ2Bins() << endl;
0684   out << "    Quantum Glauber parameter...............  " << _quantumGlauber.value() << endl;
0685   out << "    Impulse VM parameter....................  " << _impulseVM.value() << endl;
0686   return out;
0687 }
0688 
0689 //______________________________________________________________________________
0690 ostream &
0691 inputParameters::write(ostream &out) const
0692 {
0693 
0694   out << "baseFileName" << baseFileName() << endl
0695       << "TARGET_BEAM_Z" << targetBeamZ() << endl
0696       << "TARGET_BEAM_A" << targetBeamA() << endl
0697       << "BEAM_GAMMA" << beamLorentzGamma() << endl
0698       << "W_MAX" << maxW() << endl
0699       << "W_MIN" << minW() << endl
0700       << "W_GP_MAX" << maxW_GP() << endl
0701       << "W_GP_MIN" << minW_GP() << endl
0702       << "W_N_BINS" << nmbWBins() << endl
0703       << "RAP_MAX" << maxRapidity() << endl
0704       << "RAP_N_BINS" << nmbRapidityBins() << endl
0705       << "CUT_PT" << ptCutEnabled() << endl
0706       << "PT_MIN" << ptCutMin() << endl
0707       << "PT_MAX" << ptCutMax() << endl
0708       << "CUT_ETA" << etaCutEnabled() << endl
0709       << "ETA_MIN" << etaCutMin() << endl
0710       << "ETA_MAX" << etaCutMax() << endl
0711       << "PROD_MODE" << productionMode() << endl
0712       << "N_EVENTS" << nmbEvents() << endl
0713       << "PROD_PID" << prodParticleId() << endl
0714       << "RND_SEED" << randomSeed() << endl
0715       << "BREAKUP_MODE" << beamBreakupMode() << endl
0716       << "INTERFERENCE" << interferenceEnabled() << endl
0717       << "IF_STRENGTH" << interferenceStrength() << endl
0718       << "INT_PT_MAX" << maxPtInterference() << endl
0719       << "INT_PT_N_BINS" << nmbPtBinsInterference() << endl;
0720   out << "USING FIXED RANGE" << _fixedQ2Range << endl;
0721   if (_fixedQ2Range == true)
0722   {
0723     out << "Q2_MIN" << minGammaQ2() << endl
0724         << "Q2_MAX" << maxGammaQ2() << endl;
0725   }
0726   out << " Q2_BINS" << nmbGammaQ2Bins() << endl;
0727   return out;
0728 }
0729 
0730 std::string
0731 inputParameters::parameterValueKey() const
0732 {
0733   return parameterbase::_parameters.validationKey();
0734 }