-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from dglazier/deuteron
Deuteron
- Loading branch information
Showing
55 changed files
with
1,391 additions
and
532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#include "CollidingParticle.h" | ||
#include "FunctionsForGenvector.h" | ||
#include "Manager.h" | ||
|
||
namespace elSpectro{ | ||
|
||
/////////////////////////////////////////////////////////// | ||
//cannot default construct at least need a 4-momentum | ||
CollidingParticle::CollidingParticle(int pdg,Double_t momentum): | ||
Particle(pdg){ | ||
//Set interacting particle pdg | ||
_interactingPdg=pdg; | ||
auto mass= PdgMass(); | ||
LorentzVector lv(0,0,momentum,TMath::Sqrt(momentum*momentum+mass*mass)); | ||
SetP4(lv); | ||
_nominal=P4(); | ||
_interactingParticle=P4ptr(); | ||
} | ||
///////////////////////////////////////////////////////// | ||
//or a model to generate a 4-momentum | ||
CollidingParticle::CollidingParticle(int pdg,Double_t momentum,int parentpdg,DecayModel* model,DecayVectors* decayer): | ||
Particle(parentpdg),_model{model},_decayer{decayer} | ||
{ | ||
//Set interacting particle pdg | ||
_interactingPdg=pdg; | ||
//set the parent LorentzVector | ||
auto mass= PdgMass(); | ||
LorentzVector lv(0,0,momentum,TMath::Sqrt(momentum*momentum+mass*mass)); | ||
SetP4(lv); | ||
_nominal=P4(); | ||
|
||
//Find the relevent particle pointer in the model | ||
//this is the particle which is used in the production process | ||
UInt_t position=0; | ||
for(auto& p:_model->Products()){ | ||
|
||
if(p->Pdg()==pdg){ | ||
|
||
if(_interactingParticle!=nullptr){ | ||
std::cerr<<"CollidingParticle::CollidingParticle, multiple particles with pdg = "<<pdg<<std::endl; exit(0); | ||
} | ||
else{ | ||
_interactingParticle=p->P4ptr(); | ||
} | ||
//Not a stable final state particle! | ||
Manager::Instance().Particles().RemoveStable(p); | ||
_model->SwapProducts(0,position); //make sure interacting particle is first in products vector, must be done after remove | ||
} | ||
else{ //not a beam particle but "spectator" | ||
//remove from stable particle list | ||
//as these will be boosted to lab | ||
//whereas colliding particles and their | ||
//products are already in lab frame | ||
|
||
Manager::Instance().Particles().MoveStableToLab(p); | ||
|
||
} | ||
position++; | ||
} | ||
//move interacting particle to start of products vector | ||
|
||
//We need a "nominal" 4-momentum for our interacting particle | ||
//to do this we boost it from rest into lab frame of parent | ||
_decayer->BoostToParent(P4(),(*_interactingParticle)); | ||
} | ||
///////////////////////////////////////////////////////// | ||
/// rotate beam angles | ||
void CollidingParticle::SetAngleThetaPhi(Double_t th,Double_t phi){ | ||
_dirTheta=th;_dirPhi=phi; | ||
auto p4=_nominal; //copy 4-vector | ||
//and rotate it | ||
genvector::LorentzRotateY(p4,th); | ||
genvector::LorentzRotateZ(p4,phi); | ||
//Set the rotated vector | ||
SetP4(p4); | ||
_nominal=p4; | ||
} | ||
///////////////////////////////////////////////////////// | ||
void CollidingParticle::PostInit(ReactionInfo* info){ | ||
//decay vertex position | ||
|
||
if(_model){ | ||
auto& products=_model->Products(); | ||
//same vertex as parent | ||
for(auto* prod: products){ | ||
prod->SetVertex(VertexID(),VertexPosition()); | ||
} | ||
|
||
_model->PostInit(info); | ||
} | ||
if(_decayer)_decayer->PostInit(info); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
////////////////////////////////////////////////////////////// | ||
/// | ||
///Class: CollidingParticle | ||
///Description: | ||
/// 1) Class for generating initial state LorentzVector | ||
/// | ||
|
||
|
||
#pragma once | ||
|
||
#include "Particle.h" | ||
#include "DecayModel.h" | ||
#include "DecayVectors.h" | ||
|
||
namespace elSpectro{ | ||
|
||
|
||
class CollidingParticle : public Particle { | ||
|
||
public: | ||
|
||
CollidingParticle()=delete; | ||
//cannot default construct at least need a 4-momentum | ||
CollidingParticle(int pdg,Double_t momentum); | ||
//or a model to generate a 4-momentum | ||
CollidingParticle(int pdg,Double_t momentum,int parentpdg,DecayModel* model,DecayVectors* decayer); | ||
|
||
DecayModel* Model()const {return _model;} | ||
|
||
double Generate(){ | ||
if(_decayer.get()==nullptr) return 1.0; | ||
return _decayer->Generate(P4(),_model->Products()); | ||
} | ||
|
||
const DecayVectors* Decayer() const {return _decayer.get();} | ||
void SetDecayer(DecayVectors* decayer){_decayer.reset(decayer);} | ||
|
||
Double_t GenerateComponents(){ | ||
if(_model==nullptr )return 1.0; | ||
|
||
Double_t weight=0; | ||
while((weight)==0){ //sample until physical | ||
weight=Generate(); | ||
weight*=_model->Intensity(); | ||
} | ||
// can add beam divergence etc. here | ||
// ... | ||
return weight; | ||
} | ||
DecayType IsDecay() const noexcept final {return DecayType::Production;} | ||
|
||
void PostInit(ReactionInfo* info) ; | ||
|
||
const LorentzVector* GetInteracting4Vector() const {return _interactingParticle;} | ||
Int_t GetInteractingPdg()const {return _interactingPdg;} | ||
|
||
/*void SetVertexXYZT(double x,double y,double z,double t){ | ||
_productionVertex.SetXYZT(x,y,z,t); | ||
}*/ | ||
|
||
|
||
void SetAngleThetaPhi(Double_t th,Double_t phi); | ||
void SetHorSize(Double_t s){_sizeHor=s;} | ||
void SetVerSize(Double_t s){_sizeVer=s;} | ||
void SetHorDivergence(Double_t s){_divHor=s;} | ||
void SetVerDivergence(Double_t s){_divVer=s;} | ||
|
||
|
||
private: | ||
|
||
DecayModel* _model={nullptr}; //not owner | ||
|
||
std::unique_ptr<DecayVectors> _decayer={nullptr}; //owner | ||
|
||
LorentzVector *_interactingParticle={nullptr}; //not owner; | ||
|
||
LorentzVector _nominal; //nominal beam 4-momentum | ||
// LorentzVector _productionVertex; | ||
//int _prodVertexID={0}; | ||
int _interactingPdg={0}; | ||
Double_t _dirTheta={0}; | ||
Double_t _dirPhi={0}; | ||
Double_t _sizeHor={0}; | ||
Double_t _sizeVer={0}; | ||
Double_t _divHor={0}; | ||
Double_t _divVer={0}; | ||
|
||
|
||
ClassDefOverride(elSpectro::CollidingParticle,1); //class CollidingParticle | ||
|
||
};//class CollidingParticle | ||
|
||
}//namespace elSpectro |
Oops, something went wrong.