Skip to content
Snippets Groups Projects
Commit 93a3c686 authored by deserevi's avatar deserevi
Browse files

* Add storage of emittance theta and phi in the ROOT output file

   - modify the TInitialConditions class to record theta and phi angles
   - store theta and phi in the output tree in EventGeneratorTransfert.cc
parent b45f1a4b
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr *
* * * *
* Creation Date : 10/06/09 * * Creation Date : 10/06/09 *
* Last update : * * Last update : 04/09/09 *
*---------------------------------------------------------------------------* *---------------------------------------------------------------------------*
* Decription: This class records all the information concerning the event * * Decription: This class records all the information concerning the event *
* generators, e.g. vertex of interaction, angles of emitted * * generators, e.g. vertex of interaction, angles of emitted *
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
* stored in the output TTree of the G4 simulation * * stored in the output TTree of the G4 simulation *
*---------------------------------------------------------------------------* *---------------------------------------------------------------------------*
* Comment: * * Comment: *
* + 04/09/09: Add private members for emittance (N. de Sereville) *
* * * *
* * * *
*****************************************************************************/ *****************************************************************************/
...@@ -46,6 +47,9 @@ void TInitialConditions::Clear() ...@@ -46,6 +47,9 @@ void TInitialConditions::Clear()
fIC_Position_X.clear(); fIC_Position_X.clear();
fIC_Position_Y.clear(); fIC_Position_Y.clear();
fIC_Position_Z.clear(); fIC_Position_Z.clear();
// Theta and Phi angles for the emittance
fIC_Incident_Emittance_Theta.clear();
fIC_Incident_Emittance_Phi.clear();
// Incident particle angles // Incident particle angles
fIC_Incident_Angle_Theta.clear(); fIC_Incident_Angle_Theta.clear();
fIC_Incident_Angle_Phi.clear(); fIC_Incident_Angle_Phi.clear();
...@@ -72,6 +76,9 @@ void TInitialConditions::Dump() ...@@ -72,6 +76,9 @@ void TInitialConditions::Dump()
cout << "\tX : " << fIC_Position_X[0] << endl; cout << "\tX : " << fIC_Position_X[0] << endl;
cout << "\tY : " << fIC_Position_Y[0] << endl; cout << "\tY : " << fIC_Position_Y[0] << endl;
cout << "\tZ : " << fIC_Position_Z[0] << endl; cout << "\tZ : " << fIC_Position_Z[0] << endl;
cout << "Theta and Phi angles for the emittance : " << endl;
cout << "\tTheta : " << fIC_Incident_Emittance_Theta[0] << endl;
cout << "\tPhi : " << fIC_Incident_Emittance_Phi[0] << endl;
cout << "Incident particle angles : " << endl; cout << "Incident particle angles : " << endl;
cout << "\tTheta : " << fIC_Incident_Angle_Theta[0] << endl; cout << "\tTheta : " << fIC_Incident_Angle_Theta[0] << endl;
cout << "\tPhi : " << fIC_Incident_Angle_Phi[0] << endl; cout << "\tPhi : " << fIC_Incident_Angle_Phi[0] << endl;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr *
* * * *
* Creation Date : 10/06/09 * * Creation Date : 10/06/09 *
* Last update : * * Last update : 04/09/09 *
*---------------------------------------------------------------------------* *---------------------------------------------------------------------------*
* Decription: This class records all the information concerning the event * * Decription: This class records all the information concerning the event *
* generators, e.g. vertex of interaction, angles of emitted * * generators, e.g. vertex of interaction, angles of emitted *
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
* stored in the output TTree of the G4 simulation * * stored in the output TTree of the G4 simulation *
*---------------------------------------------------------------------------* *---------------------------------------------------------------------------*
* Comment: * * Comment: *
* + 04/09/09: Add private members for emittance (N. de Sereville) *
* * * *
* * * *
*****************************************************************************/ *****************************************************************************/
...@@ -39,6 +40,9 @@ private: ...@@ -39,6 +40,9 @@ private:
vector<Double_t> fIC_Position_X; vector<Double_t> fIC_Position_X;
vector<Double_t> fIC_Position_Y; vector<Double_t> fIC_Position_Y;
vector<Double_t> fIC_Position_Z; vector<Double_t> fIC_Position_Z;
// Theta and Phi angles for the emittance
vector<Double_t> fIC_Incident_Emittance_Theta;
vector<Double_t> fIC_Incident_Emittance_Phi;
// Incident particle angles // Incident particle angles
vector<Double_t> fIC_Incident_Angle_Theta; vector<Double_t> fIC_Incident_Angle_Theta;
vector<Double_t> fIC_Incident_Angle_Phi; vector<Double_t> fIC_Incident_Angle_Phi;
...@@ -70,6 +74,9 @@ public: ...@@ -70,6 +74,9 @@ public:
void SetICPositionX(Double_t PositionX) {fIC_Position_X.push_back(PositionX);} void SetICPositionX(Double_t PositionX) {fIC_Position_X.push_back(PositionX);}
void SetICPositionY(Double_t PositionY) {fIC_Position_Y.push_back(PositionY);} void SetICPositionY(Double_t PositionY) {fIC_Position_Y.push_back(PositionY);}
void SetICPositionZ(Double_t PositionZ) {fIC_Position_Z.push_back(PositionZ);} void SetICPositionZ(Double_t PositionZ) {fIC_Position_Z.push_back(PositionZ);}
// Theta and Phi angles for the emittance
void SetICIncidentEmittanceTheta(Double_t Theta) {fIC_Incident_Emittance_Theta.push_back(Theta);}
void SetICIncidentEmittancePhi(Double_t Phi) {fIC_Incident_Emittance_Phi.push_back(Phi);}
// Incident particle angles // Incident particle angles
void SetICIncidentAngleTheta(Double_t AngleTheta) {fIC_Incident_Angle_Theta.push_back(AngleTheta);} void SetICIncidentAngleTheta(Double_t AngleTheta) {fIC_Incident_Angle_Theta.push_back(AngleTheta);}
void SetICIncidentAnglePhi(Double_t AnglePhi) {fIC_Incident_Angle_Phi.push_back(AnglePhi);} void SetICIncidentAnglePhi(Double_t AnglePhi) {fIC_Incident_Angle_Phi.push_back(AnglePhi);}
...@@ -94,9 +101,12 @@ public: ...@@ -94,9 +101,12 @@ public:
// Vertex of interaction // Vertex of interaction
Double_t GetICPositionX(Int_t i) {return fIC_Position_X.at(i);} Double_t GetICPositionX(Int_t i) {return fIC_Position_X.at(i);}
Double_t GetICPositionY(Int_t i) {return fIC_Position_Y.at(i);} Double_t GetICPositionY(Int_t i) {return fIC_Position_Y.at(i);}
Double_t GetICPositionZ(Int_t i) {return fIC_Position_Z.at(i);} Double_t GetICPositionZ(Int_t i) {return fIC_Position_Z.at(i);}
// Theta and Phi angles for the emittance
Double_t GetICIncidentEmittanceTheta(Int_t i) {return fIC_Incident_Emittance_Theta.at(i);}
Double_t GetICIncidentEmittancePhi(Int_t i) {return fIC_Incident_Emittance_Phi.at(i);}
// Incident particle angles // Incident particle angles
Double_t GetICIncidentAngleTheta(Int_t i){return fIC_Incident_Angle_Theta.at(i);} Double_t GetICIncidentAngleTheta(Int_t i) {return fIC_Incident_Angle_Theta.at(i);}
Double_t GetICIncidentAnglePhi(Int_t i) {return fIC_Incident_Angle_Phi.at(i);} Double_t GetICIncidentAnglePhi(Int_t i) {return fIC_Incident_Angle_Phi.at(i);}
// Incident particle energy // Incident particle energy
Double_t GetICIncidentEnergy(Int_t i) {return fIC_Incident_Energy.at(i);} Double_t GetICIncidentEnergy(Int_t i) {return fIC_Incident_Energy.at(i);}
......
...@@ -316,28 +316,27 @@ void EventGeneratorTransfert::GenerateEvent(G4Event* anEvent , G4ParticleGun* pa ...@@ -316,28 +316,27 @@ void EventGeneratorTransfert::GenerateEvent(G4Event* anEvent , G4ParticleGun* pa
//shoot inside the target with correlated angle //shoot inside the target with correlated angle
if (m_TargetRadius != 0) { if (m_TargetRadius != 0) {
while (sqrt(x0*x0 + y0*y0) > m_TargetRadius) while (sqrt(x0*x0 + y0*y0) > m_TargetRadius) {
{ RandomGaussian2D(0,0,m_BeamFWHMX / 2.35,m_BeamEmmitanceTheta,x0,Beam_thetaX);
RandomGaussian2D(0,0,m_BeamFWHMX / 2.35,m_BeamEmmitanceTheta,x0,Beam_thetaX); RandomGaussian2D(0,0,m_BeamFWHMY / 2.35,m_BeamEmmitancePhi ,y0,Beam_phiY );
RandomGaussian2D(0,0,m_BeamFWHMY / 2.35,m_BeamEmmitancePhi ,y0,Beam_phiY ); }
}
} }
else {
else RandomGaussian2D(0,0,0,m_BeamEmmitanceTheta,x0,Beam_thetaX);
{ RandomGaussian2D(0,0,0,m_BeamEmmitancePhi ,y0,Beam_phiY );
RandomGaussian2D(0,0,0,m_BeamEmmitanceTheta,x0,Beam_thetaX);
RandomGaussian2D(0,0,0,m_BeamEmmitancePhi ,y0,Beam_phiY );
} }
// Calculate Angle in spherical coordinate, passing by the direction vector dir // write emittance angles to ROOT file
G4double Xdir = cos( pi/2. - Beam_thetaX ) ; m_InitConditions->SetICIncidentEmittanceTheta(Beam_thetaX / deg);
G4double Ydir = cos( pi/2. - Beam_phiY ) ; m_InitConditions->SetICIncidentEmittancePhi(Beam_phiY / deg);
G4double Zdir = sin( pi/2. - Beam_thetaX ) + sin( pi/2. - Beam_phiY) ;
// Calculate Angle in spherical coordinate, passing by the direction vector dir
G4double Xdir = cos( pi/2. - Beam_thetaX );
G4double Beam_theta = acos ( Zdir / sqrt( Xdir*Xdir + Ydir*Ydir + Zdir*Zdir ) ); G4double Ydir = cos( pi/2. - Beam_phiY );
G4double Zdir = sin( pi/2. - Beam_thetaX ) + sin( pi/2. - Beam_phiY);
G4double Beam_phi = atan2( Ydir , Xdir ) ; G4double Beam_theta = acos ( Zdir / sqrt( Xdir*Xdir + Ydir*Ydir + Zdir*Zdir ) );
G4double Beam_phi = atan2( Ydir , Xdir ) ;
// write angles to ROOT file // write angles to ROOT file
m_InitConditions->SetICIncidentAngleTheta(Beam_theta / deg); m_InitConditions->SetICIncidentAngleTheta(Beam_theta / deg);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment