Skip to content

Commit

Permalink
Merge pull request #19 from eic/WgA_limits_feature
Browse files Browse the repository at this point in the history
Added Wgp limits features
  • Loading branch information
zsweger authored Feb 17, 2023
2 parents aee144a + d34b985 commit 70ccfc2
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 9 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ ELECTRON_BEAM_GAMMA = (Electron Energy)/(0.000511 GeV)
ELECTRON_BEAM_GAMMA = 9785 # 5GeV electrons from eRHIC
ELECTRON_BEAM_GAMMA = 19569 #10GeV electrons from eRHIC
ELECTRON_BEAM_GAMMA = 35225 #18GeV electrons from eRHIC
```
* Note: The constraints on the center-of-mass energy of the vitrual photon and ion is set by:
```
W_GP_MAX = Max value of W_gp that user can set and wants to use (GeV)
W_GP_MIN = Min value of W_gp that user can set and wants to use (GeV)
```
* For example:
```
W_GP_MAX = 30 # W_gp will have a maximum value of 30 GeV.
W_GP_MIN = 2 # W_gp will start to sample from the minimum value of 2 GeV. W_GP_MIN should not be greater than the center-of-mass energy of the electron and ion beams.
```
* For exclusive backward (u-channel) production, use:
```
Expand Down
Binary file modified Readme.docx
Binary file not shown.
Binary file modified Readme.pdf
Binary file not shown.
9 changes: 7 additions & 2 deletions include/inputParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ class inputParameters {
double cmsMinPhotonEnergy () const { return _cmsMinPhotonEnergy; } ///< returns maximum photon energy
double maxW () const { return _maxW.value(); } ///< returns maximum mass W of produced hadronic system [GeV/c^2]
double minW () const { return _minW.value(); } ///< returns minimum mass W of produced hadronic system [GeV/c^2]
double maxW_GP () const { return _maxW_GP.value(); } ///< returns maximum W of produced virtual photon and nucleon system [GeV/c^2]
double minW_GP () const { return _minW_GP.value(); } ///< returns minimum W of produced virtual photon and nucleon system [GeV/c^2]
unsigned int nmbWBins () const { return _nmbWBins.value(); } ///< returns number of W bins in lookup table
double maxRapidity () const { return _maxRapidity.value(); } ///< returns maximum absolute value of rapidity
unsigned int nmbRapidityBins () const { return _nmbRapidityBins.value(); } ///< returns number of rapidity bins in lookup table
Expand Down Expand Up @@ -236,7 +238,7 @@ class inputParameters {
starlightConstants::interactionTypeEnum interactionType () const { return _interactionType; } ///< returns interaction type
double protonEnergy () const { return _protonEnergy.value(); }
double electronEnergy () const { return _electronEnergy.value(); }
double inputBranchingRatio () const { return _inputBranchingRatio; }
double inputBranchingRatio () const { return _inputBranchingRatio; }
double targetRadius () const { return _targetR; }

void setBaseFileName (std::string v ) { _baseFileName = v; }
Expand All @@ -249,6 +251,8 @@ class inputParameters {
//void setMaxPhotonEnergy (double v) { _maxPhotonEnergy = v ; } ///< sets maximim photon energy
void setMaxW (double v) { _maxW = v; } ///< sets maximum mass W of produced hadronic system [GeV/c^2]
void setMinW (double v) { _minW = v; } ///< sets minimum mass W of produced hadronic system [GeV/c^2]
void setmaxW_GP (double v) { _maxW_GP = v; } ///< sets maximum mass W of produced virtual photon and nucleon system [GeV/c^2]
void setminW_GP (double v) { _minW_GP = v; } ///< sets minimum mass W of produced virtual photon and nucleon system [GeV/c^2]
void setNmbWBins (unsigned int v) { _nmbWBins = v; } ///< sets number of W bins in lookup table
void setMaxRapidity (double v) { _maxRapidity = v; } ///< sets maximum absolute value of rapidity
void setNmbRapidityBins (unsigned int v) { _nmbRapidityBins = v; } ///< sets number of rapidity bins in lookup table
Expand Down Expand Up @@ -289,7 +293,6 @@ class inputParameters {

void setProtonEnergy (double v) { _protonEnergy = v; } ///< sets proton energy
void setElectronEnergy (double v) { _electronEnergy = v; } ///< sets electron energy

template<typename T>
inline bool setParameter(std::string expression);

Expand All @@ -316,6 +319,8 @@ class inputParameters {
parameter<double, VALIDITY_CHECK> _targetBeamLorentzGamma; ///< Lorentz gamma factor of beam 2 in collider frame
parameter<double, VALIDITY_CHECK> _maxW; ///< maximum mass W of produced hadronic system [GeV/c^2]
parameter<double, VALIDITY_CHECK> _minW; ///< minimum mass W of produced hadronic system; if set to -1 default value is taken [GeV/c^2]
parameter<double, VALIDITY_CHECK> _maxW_GP; ///< maximum mass W of produced virtual photon and nucleon system, has no maximum limit [GeV/c^2]
parameter<double, VALIDITY_CHECK> _minW_GP; ///< minimum mass W of produced virtual photon and nucleon system, should be no greater than COM energy of source + traget or code will terminate [GeV/c^2]
parameter<unsigned int, VALIDITY_CHECK> _nmbWBins; ///< number of W bins in lookup table
parameter<double, VALIDITY_CHECK> _maxRapidity; ///< maximum absolute value of rapidity
parameter<unsigned int, VALIDITY_CHECK> _nmbRapidityBins; ///< number of rapidity bins in lookup table
Expand Down
4 changes: 3 additions & 1 deletion include/photonNucleusCrossSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "beambeamsystem.h"
#include "inputParameters.h"

class photonNucleusCrossSection {
class photonNucleusCrossSection{

public:

Expand Down Expand Up @@ -135,6 +135,8 @@ class photonNucleusCrossSection {
double _maxPhotonEnergy; ///< max photon energy in lab frame [GeV] (for vectormesons only)
double _cmsMinPhotonEnergy;
double _targetRadii;
double _maxW_GP; ///< max W_GP energy
double _minW_GP; ///< min W_GP energy

};

Expand Down
2 changes: 2 additions & 0 deletions slight.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ TARGET_BEAM_GAMMA = 293.2 #275 GeV protons from eRHIC
W_MAX = -1 #Max value of w from HERA
W_MIN = -1 #Min value of w from HERA
W_N_BINS = 50 #Bins i w
W_GP_MAX = -1 #Max value of W_gp (virtual photon+nucleon COM energy)
W_GP_MIN = -1 #Min value of W_gp
EGA_N_BINS = 400
CUT_PT = 0 #Cut in pT? 0 = (no, 1 = yes)
PT_MIN = 1.0 #Minimum pT in GeV
Expand Down
31 changes: 30 additions & 1 deletion src/inputParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ inputParameters::inputParameters()
_targetBeamLorentzGamma ("TARGET_BEAM_GAMMA",0),
_maxW ("W_MAX",0),
_minW ("W_MIN",0),
_maxW_GP ("W_GP_MAX", 0,NOT_REQUIRED),
_minW_GP ("W_GP_MIN", 0,NOT_REQUIRED),
_nmbWBins ("W_N_BINS",0),
_maxRapidity ("RAP_MAX",9,NOT_REQUIRED),
_nmbRapidityBins ("RAP_N_BINS",100,NOT_REQUIRED),
Expand Down Expand Up @@ -110,7 +112,10 @@ inputParameters::inputParameters()

_ip.addParameter(_maxW);
_ip.addParameter(_minW);


_ip.addParameter(_maxW_GP);
_ip.addParameter(_minW_GP);

_ip.addParameter(_nmbWBins);

_ip.addParameter(_maxRapidity);
Expand Down Expand Up @@ -194,6 +199,8 @@ inputParameters::configureFromFile(const std::string &_configFileName)
double _totalEnergy_lab = 1.0*_electronEnergy_lab + _ionEnergy_lab;
double _totalPz_lab = _ionPz_lab + _electronPz_lab;
_rap_CM = (1.0/2.0)*log((_totalEnergy_lab + _totalPz_lab)/(_totalEnergy_lab - _totalPz_lab));
double _totalEnergy_COM;
_totalEnergy_COM = sqrt((_totalEnergy_lab) * (_totalEnergy_lab) - (_totalPz_lab) * (_totalPz_lab)); //This is Lorentz invariant.

_beamLorentzGamma = cosh(_rap_CM-rap2);
_targetLorentzGamma = cosh(rap1-rap2);
Expand Down Expand Up @@ -565,6 +572,26 @@ inputParameters::configureFromFile(const std::string &_configFileName)
return false;
}

if (_minW_GP.value() == -1)
_minW_GP = 0;
if (_maxW_GP.value() == -1)
_maxW_GP = 1e7;
if ( _maxW_GP.value() <= _minW_GP.value() ) {
printWarn << "maxW_GA must be greater than minW_GP" << endl;
printWarn <<"The value of minW_GP is " << _minW_GP << endl;
printWarn <<"The value of maxW_GP is " << _maxW_GP << endl;
return false;
}
if(_minW_GP.value() > _totalEnergy_COM) {
/* If the minimum COM energy of gamma and nucleon is set by user
to be greater than the total energy supply by electron and target, code will terminate. */
printWarn << "ERROR: The current input minimum CoM energy (_minW_GP) is: "<< _minW_GP
<< " which is larger than the total center-of-mass energy of the electron-ion system: "
<<_totalEnergy_COM << endl;
cout<<"Exiting now..." << endl;
return false;
}

// Sanity check on Q2 range in case it is specified by user
if( _minGammaQ2.value() != 0 || _maxGammaQ2.value() != 0){
if( _minGammaQ2.value() <0 || _maxGammaQ2.value() <=_minGammaQ2.value() )
Expand Down Expand Up @@ -647,6 +674,8 @@ inputParameters::write(ostream& out) const
<< "BEAM_GAMMA" << beamLorentzGamma () <<endl
<< "W_MAX" << maxW () <<endl
<< "W_MIN" << minW () <<endl
<< "W_GP_MAX" << maxW_GP () <<endl
<< "W_GP_MIN" << minW_GP () <<endl
<< "W_N_BINS" << nmbWBins () <<endl
<< "RAP_MAX" << maxRapidity () <<endl
<< "RAP_N_BINS" << nmbRapidityBins () <<endl
Expand Down
7 changes: 5 additions & 2 deletions src/photonNucleusCrossSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ photonNucleusCrossSection::photonNucleusCrossSection(const inputParameters& inpu
_maxQ2 (inputParametersInstance.maxGammaQ2() ),
_maxPhotonEnergy (inputParametersInstance.cmsMaxPhotonEnergy()),
_cmsMinPhotonEnergy(inputParametersInstance.cmsMinPhotonEnergy()),
_targetRadii (inputParametersInstance.targetRadius() )
_targetRadii (inputParametersInstance.targetRadius() ),
_maxW_GP (inputParametersInstance.maxW_GP() ),
_minW_GP (inputParametersInstance.minW_GP() )
{
// new options - impulse aproximation (per Joakim) and Quantum Glauber (per SK) SKQG
_impulseSelected = inputParametersInstance.impulseVM();
Expand Down Expand Up @@ -909,7 +911,8 @@ photonNucleusCrossSection::sigmagp(const double Wgp)
// Function for the gamma-proton --> VectorMeson
// cross section. Wgp is the gamma-proton CM energy.
// Unit for cross section: fm**2

//If W_gp is not in the allowed region, i.e. W_GP_MIN < W_gp < W_GP_MAX, do not sample.
if(Wgp < _minW_GP || Wgp > _maxW_GP) return 0;
double sigmagp_r=0.;

// Near the threshold CM energy (between WgpMin and WgpMax),
Expand Down
18 changes: 15 additions & 3 deletions utils/ConvertStarlightAsciiToTree.C
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ void ConvertStarlightAsciiToTree(const char* inFileName = "slight.out",
std::map<string, int> set_up;
double photon_setup[5];
//
Float_t q2, Egamma, vertex_t;
Float_t q2, W, Egamma, vertex_t;
outTree->Branch("beam1","TLorentzVector", &beam1, 32000, -1);
outTree->Branch("beam2","TLorentzVector", &beam2, 32000, -1);
//
outTree->Branch("Egamma", &Egamma, "Egamma/F");
outTree->Branch("Q2", &q2, "q2/F");
outTree->Branch("W", &W, "W/F");
outTree->Branch("t", &vertex_t, "vertex_t/F");
outTree->Branch("Target","TLorentzVector", &target, 32000, -1);
outTree->Branch("source", "TLorentzVector", &source, 32000, -1);
Expand Down Expand Up @@ -215,7 +216,11 @@ void ConvertStarlightAsciiToTree(const char* inFileName = "slight.out",
*source = TLorentzVector(px, py, pz, E);

lineStream.clear();
//
// Four-momentum of the gamma-ion system started as four-momentum of the target.
double pxtot = tpx;
double pytot = tpy;
double pztot = tpz;
double Etot = tE;
for (int i = 0; i < nmbTracks; ++i) {
// read tracks
int particleCode;
Expand All @@ -228,13 +233,20 @@ void ConvertStarlightAsciiToTree(const char* inFileName = "slight.out",
R__ASSERT(label == "TRACK:");
Double_t daughterMass = IDtoMass(particleCode);
if (daughterMass < 0) {break;}
/*Adding up the momenta and energies of every daughter particle produced to get the total four-momentum.*/
const double E = sqrt( momentum[0] * momentum[0] + momentum[1] * momentum[1]
+ momentum[2] * momentum[2] + daughterMass * daughterMass);
new ( (*daughterParticles)[i] ) TLorentzVector(momentum[0], momentum[1], momentum[2], E);
*parentParticle += *(static_cast<TLorentzVector*>(daughterParticles->At(i)));

// Distributing the components of the four-momentum of the system to 3d momentum vector and Energy.
pxtot += momentum[0];
pytot += momentum[1];
pztot += momentum[2];
Etot += E;
lineStream.clear();
}
W = sqrt(Etot * Etot - pxtot * pxtot - pytot * pytot - pztot * pztot); //Lorentz invariant.

daughterParticles->Compress();
outTree->Fill();
}
Expand Down

0 comments on commit 70ccfc2

Please sign in to comment.