PrimaryGeneratorAction Class Reference

#include <PrimaryGeneratorAction.hh>

Inheritance diagram for PrimaryGeneratorAction:
MyConfigure

List of all members.

Public Member Functions

 PrimaryGeneratorAction ()
virtual ~PrimaryGeneratorAction ()
void GeneratePrimaries (G4Event *)
void Initialize ()
void ResetGen (G4String)
void ReadCard (G4String)
void * get_extra (G4String)
void Dump ()
void Reset ()
void set_EnergyMode (G4String val)
void set_DirectionMode (G4String val)
void set_PositionMode (G4String val)
void set_TimeMode (G4String val)
void set_pidMode (G4String val)
void set_EM_hist_filename (G4String val)
void set_EM_hist_histname (G4String val)
void set_DM_hist_filename (G4String val)
void set_DM_hist_histname (G4String val)
void set_PM_hist_filename (G4String val)
void set_PM_hist_histname (G4String val)
void set_root_filename (G4String val)
void set_root_treename (G4String val)
void set_root_index (int val)
void SetUniformDirection ()
void SetRandomDirection ()
void SetRandomPosition ()
void SetRandomEnergy ()
void SetUniformPosition ()
void BuildHistoFromFile ()
void root_get_para ()
void root_build ()
void root_set_Position ()
void root_set_Energy ()
void root_set_Time ()
void root_set_pid ()
void root_set_Rand ()
void root_set_extra ()
std::vector< G4String > GetWords (G4String formula)
bool FindMacro (G4String word, G4String &value)
void Replace (G4String &formula, G4String word, G4String value)
double CalFormula (G4String formula, int iRep=0)
G4String ReplaceMacro (G4String formula)

Static Public Member Functions

static PrimaryGeneratorActionGetPrimaryGeneratorAction ()

Static Public Attributes

static std::vector< G4String > knownValueNames
static std::vector< G4String > knownValues

Private Member Functions

void InformEventHeaderHeader ()

Private Attributes

G4ParticleGun * particleGun
PrimaryGeneratorMessengergunMessenger
G4ParticleDefinition * fParticle
G4String fType
G4String ParticleName
G4int Z
G4int A
G4int C
G4double E
G4double Pa
G4double Ekin
G4double mass
G4int EnergyType
G4double Px
G4double Py
G4double Pz
G4double Theta
G4double Phi
G4double x
G4double y
G4double z
G4double t
G4double xSpread
G4double ySpread
G4double zSpread
G4double PosLimit2
G4double MomSpread
G4double EkinSpread
G4String RandMode
G4String EnergyMode
G4String PositionMode
G4String TimeMode
G4String pidMode
G4String DirectionMode
G4String PhiMode
G4String ThetaMode
G4double ThetaSpread
G4double PhiSpread
G4double Ephi
G4double Etheta
G4double Epsi
TH1F * EM_hist
G4String EM_hist_filename
G4String EM_hist_histname
TH1F * DM_hist
G4String DM_hist_filename
G4String DM_hist_histname
TH3 * PM_hist
THnSparseF * PM_hist_sparse
G4String PM_hist_filename
G4String PM_hist_histname
G4String UP_SubDet
G4String UP_Volume
G4String UP_Type
G4bool UseRoot
TChain * m_TChain
G4int root_num
G4int root_index
G4String root_filename
G4String root_treename
double root_double [20]
int root_int [5]
std::string * root_str [2]
TFile * fp
bool flag_weight
bool flag_ox
bool flag_oy
bool flag_oz
bool flag_opx
bool flag_opy
bool flag_opz
bool flag_ipx
bool flag_ipy
bool flag_ipz
bool flag_ot
bool flag_process
bool flag_volume
bool flag_R0
bool flag_R1
bool flag_ppid
bool flag_ptid
TF1 * fXPositionFinalFocusFit
double fXPositionFinalFocus_Lower
double fXPositionFinalFocus_Upper
TF1 * fYPositionFinalFocusFit
double fYPositionFinalFocus_Lower
double fYPositionFinalFocus_Upper
TH2F * fMuPCBeamDistHist
TH2F * fMuPCBeamDistRandom
TH2F * fFFBeamDistRandom
TH3F * fCollimatedInputHist_XYPz
TH3F * fCollimatedInputHist_XPxPz
TH3F * fCollimatedInputHist_YPyPz
TF1 * fEnergyLoss

Static Private Attributes

static PrimaryGeneratorActionfPrimaryGeneratorAction = 0

Detailed Description

Definition at line 31 of file PrimaryGeneratorAction.hh.


Constructor & Destructor Documentation

PrimaryGeneratorAction::PrimaryGeneratorAction (  ) 

Definition at line 45 of file PrimaryGeneratorAction.cc.

References fCollimatedInputHist_XPxPz, fCollimatedInputHist_XYPz, fCollimatedInputHist_YPyPz, fMuPCBeamDistHist, fPrimaryGeneratorAction, fXPositionFinalFocus_Lower, fXPositionFinalFocus_Upper, fXPositionFinalFocusFit, fYPositionFinalFocus_Lower, fYPositionFinalFocus_Upper, fYPositionFinalFocusFit, gunMessenger, Initialize(), and ReadCard().

Referenced by GetPrimaryGeneratorAction().

00046         : MyConfigure(),
00047         root_index(0),
00048         m_TChain(0),
00049         particleGun(0),  //pointer a to G4  class
00050         gunMessenger(0),   //messenger of this class
00051         fParticle(0),
00052         fp(0)
00053 {
00054         if (fPrimaryGeneratorAction){
00055                 G4Exception("PrimaryGeneratorAction::PrimaryGeneratorAction()","Run0031",
00056                                 FatalException, "PrimaryGeneratorAction constructed twice.");
00057         }
00058         fPrimaryGeneratorAction = this;
00059         //create a messenger for this class
00060         gunMessenger = new PrimaryGeneratorMessenger(this);
00061 
00062         // default particle kinematic
00063         G4String file_name = getenv("GENFILEROOT");
00064         ReadCard(file_name);
00065         Initialize();
00066 
00067         // Initialise all the TURTLE/data fits
00068         fXPositionFinalFocusFit = NULL;
00069         fYPositionFinalFocusFit = NULL;
00070 
00071         fXPositionFinalFocus_Lower = -1.5;
00072         fXPositionFinalFocus_Upper = 1.5;
00073 
00074         fYPositionFinalFocus_Lower = -1.5;
00075         fYPositionFinalFocus_Upper = 1.5;
00076 
00077         fMuPCBeamDistHist = NULL;
00078         
00079         // Set the "collimated" input hists to NULL
00080         fCollimatedInputHist_XYPz = NULL;
00081         fCollimatedInputHist_XPxPz = NULL;
00082         fCollimatedInputHist_YPyPz = NULL;
00083 
00084         //      fMuPCBeamDistRandom = new TH2F("muPC_random", "muPC_random", 100,-24,24, 100,-24,24);
00085         //      fFFBeamDistRandom = new TH2F("FF_random", "FF_random", 100,-24,24, 100,-24,24);;
00086 }

PrimaryGeneratorAction::~PrimaryGeneratorAction (  )  [virtual]

Definition at line 88 of file PrimaryGeneratorAction.cc.

References DM_hist, EM_hist, gunMessenger, m_TChain, particleGun, and PM_hist.

00089 {
00090   /*  TFile* output = new TFile("test.root", "RECREATE");
00091   fMuPCBeamDistRandom->Write();
00092   fFFBeamDistRandom->Write();
00093   output->Close();
00094   */
00095         delete particleGun;
00096         delete gunMessenger;
00097         if(EM_hist) delete EM_hist;
00098         if(DM_hist) delete DM_hist;
00099         if(PM_hist) delete PM_hist;
00100         if(m_TChain) delete m_TChain;
00101 }


Member Function Documentation

void PrimaryGeneratorAction::BuildHistoFromFile (  ) 

Definition at line 826 of file PrimaryGeneratorAction.cc.

References DirectionMode, DM_hist, DM_hist_filename, DM_hist_histname, EM_hist, EM_hist_filename, EM_hist_histname, EnergyMode, fp, PM_hist, PM_hist_filename, PM_hist_histname, PM_hist_sparse, and PositionMode.

Referenced by Initialize(), and PrimaryGeneratorMessenger::SetNewValue().

00826                                                {
00827         G4String dir_name = getenv("CONFIGUREDATAROOT");
00828         if (dir_name[dir_name.size()-1] != '/') dir_name.append("/");
00829 
00830         // EnergyMode
00831         if (EnergyMode=="histo"){
00832                 G4String full_infile_name = dir_name +  EM_hist_filename;
00833 //              if (fp) delete fp;
00834                 fp = new TFile(full_infile_name.c_str());
00835                 if (fp==NULL) {
00836                         std::cout<<"ERROR: Can not find file: "<<full_infile_name<<"!!!"<<std::endl;
00837                         G4Exception("PrimaryGeneratorAction::BuildHistoFromFile()",
00838                                         "InvalidInput", FatalException,
00839                                         "Can not find file");
00840                 }
00841                 TH1F* h = (TH1F*)fp->Get(EM_hist_histname.c_str());
00842                 if(h==NULL){
00843                         std::cout<<"ERROR: Can not find file: "<<full_infile_name<<"!!!"<<std::endl;
00844                         G4Exception("PrimaryGeneratorAction::BuildHistoFromFile()",
00845                                         "InvalidInput", FatalException,
00846                                         "Can not find file");
00847                 }
00848                 EM_hist = h;
00849         }
00850 
00851         // DirectionMode
00852         if (DirectionMode=="histo"){
00853                 G4String full_infile_name = dir_name +  DM_hist_filename;
00854                 if (fp) delete fp;
00855                 fp = new TFile(full_infile_name.c_str());
00856                 if (fp==NULL) {
00857                         std::cout<<"ERROR: Can not find file: "<<full_infile_name<<"!!!"<<std::endl;
00858                         G4Exception("PrimaryGeneratorAction::BuildHistoFromFile()",
00859                                         "InvalidInput", FatalException,
00860                                         "Can not find file");
00861                 }
00862                 TH1F* h = (TH1F*)fp->Get(DM_hist_histname.c_str());
00863                 if(h==NULL){
00864                         std::cout<<"ERROR: Can not find file: "<<full_infile_name<<"!!!"<<std::endl;
00865                         G4Exception("PrimaryGeneratorAction::BuildHistoFromFile()",
00866                                         "InvalidInput", FatalException,
00867                                         "Can not find file");
00868                 }
00869                 DM_hist = h;
00870         }
00871         
00872         if (PositionMode =="histo"){
00873                 G4String full_infile_name = dir_name +  PM_hist_filename;
00874 //              if (fp) delete fp;
00875                 fp = new TFile(full_infile_name.c_str());
00876                 if (fp==NULL) {
00877                         std::cout<<"ERROR: Can not find file: "<<full_infile_name<<"!!!"<<std::endl;
00878                         G4Exception("PrimaryGeneratorAction::BuildHistoFromFile()",
00879                                         "InvalidInput", FatalException,
00880                                         "Can not find file");
00881                 }
00882                 TObject* obj=fp->Get(PM_hist_histname.c_str());
00883                 if(obj==NULL){
00884                         std::cout<<"ERROR: Can not find file: "<<full_infile_name<<"!!!"<<std::endl;
00885                         G4Exception("PrimaryGeneratorAction::BuildHistoFromFile()",
00886                                         "InvalidInput", FatalException,
00887                                         "Can not find file");
00888                 }
00889                 if(obj->InheritsFrom("TH3")){
00890                   PM_hist = (TH3*) obj;
00891                 
00892                 }
00893                 else if (obj->InheritsFrom("THnSparse")) {
00894                   PM_hist_sparse = (THnSparseF*) obj;
00895                   // should also check that it's 3dimenstional here
00896                 }
00897                 else {
00898                         std::cout<<"ERROR: Cannot generate positions from non-3D histogram: "<<PM_hist_histname<<"!!!"<<std::endl;
00899                         G4Exception("PrimaryGeneratorAction::BuildHistoFromFile()",
00900                                         "InvalidInput", FatalException,
00901                                         "Wrong hist type");
00902                 }
00903         }
00904 
00905 }

double MyConfigure::CalFormula ( G4String  formula,
int  iRep = 0 
) [inherited]

Definition at line 23 of file MyConfigure.cc.

Referenced by SimpleGeometryParameter::Calculate(), and ReadCard().

00023                                                         {
00024 //      std::cout<<"TO Calculate for: \""<<formula<<"\" "<<iRep<<std::endl; // to be deleted
00025 //      formula = ReplaceMacro(formula);
00026         TF1 *f1 = new TF1("f1", formula);
00027         double value = f1->Eval(iRep);
00028 //      std::cout<<"\t=>"<<value<<std::endl;
00029         delete f1;
00030         return value;
00031 }

void PrimaryGeneratorAction::Dump (  ) 

Definition at line 1321 of file PrimaryGeneratorAction.cc.

References A, C, DirectionMode, DM_hist_filename, DM_hist_histname, E, Ekin, EkinSpread, EM_hist_filename, EM_hist_histname, EnergyMode, EnergyType, Ephi, Epsi, Etheta, fType, MomSpread, Pa, ParticleName, Phi, PhiMode, PhiSpread, pidMode, PM_hist_filename, PM_hist_histname, PositionMode, PosLimit2, root_filename, root_treename, t, Theta, ThetaMode, ThetaSpread, TimeMode, UP_SubDet, UP_Type, UP_Volume, x, xSpread, y, ySpread, z, Z, and zSpread.

Referenced by ReadCard().

01321                                  {
01322         std::cout<<"---------------PrimaryGeneratorAction---------------------"<<std::endl;
01323         std::cout<<"Type:                                         "<<fType<<std::endl;
01324         if (fType=="ion"){
01325         std::cout<<"Z:                                            "<<Z<<std::endl;
01326         std::cout<<"A:                                            "<<A<<std::endl;
01327         std::cout<<"C:                                            "<<C<<std::endl;
01328         std::cout<<"E:                                            "<<E<<std::endl;
01329         }
01330         else{
01331         std::cout<<"Particle:                                     "<<ParticleName<<std::endl;
01332         }
01333         std::cout<<"Default Momentum Direction: theta =           "<<Theta/deg<<"deg, phi = "<<Phi/deg<<"deg"<<std::endl;
01334         std::cout<<"Default Phi Spread:                           "<<PhiSpread/deg<<"deg"<<std::endl;
01335         std::cout<<"Default Ephi Spread:                          "<<Ephi/deg<<"deg"<<std::endl;
01336         std::cout<<"Default Etheta Spread:                        "<<Etheta/deg<<"deg"<<std::endl;
01337         std::cout<<"Default Epsi Spread:                          "<<Epsi/deg<<"deg"<<std::endl;
01338         std::cout<<"Default Theta Spread:                         "<<ThetaSpread/deg<<"deg"<<std::endl;
01339         if (EnergyType==0){
01340         std::cout<<"Default Momentum Amplitude:                   "<<Pa/MeV<<"MeV"<<std::endl;
01341         std::cout<<"Default Momentum Spread(MeV/c):               ("<<MomSpread/MeV<<std::endl;
01342         }
01343         else if (EnergyType==1){
01344         std::cout<<"Default Kinetic Energy:                       "<<Ekin/MeV<<"MeV"<<std::endl;
01345         std::cout<<"Default Energy Spread(MeV):                   ("<<EkinSpread/MeV<<std::endl;
01346         }
01347         std::cout<<"Default Position(mm):                         ("<<x/mm<<", "<<y/mm<<", "<<z/mm<<")"<<std::endl;
01348         std::cout<<"Default Position Spread(mm):                  ("<<xSpread/mm<<", "<<ySpread/mm<<", "<<zSpread/mm<<")"<<std::endl;
01349         std::cout<<"Default Position Limit(mm):                   ("<<sqrt(PosLimit2)/mm<<std::endl;
01350         std::cout<<"Default Time(ns):                             ("<<t/ns<<std::endl;
01351         std::cout<<"EnergyMode:                                   "<<EnergyMode<<std::endl;
01352         std::cout<<"PositionMode:                                 "<<PositionMode<<std::endl;
01353         std::cout<<"TimeMode:                                     "<<TimeMode<<std::endl;
01354         std::cout<<"pidMode:                                      "<<pidMode<<std::endl;
01355         std::cout<<"Uniform In sub-detector:                      "<<UP_SubDet<<std::endl;
01356         std::cout<<"  Volume:                                     "<<UP_Volume<<std::endl;
01357         std::cout<<"  Type:                                       "<<UP_Type<<std::endl;
01358         std::cout<<"DirectionMode:                                "<<DirectionMode<<std::endl;
01359         std::cout<<"PhiMode:                                      "<<PhiMode<<std::endl;
01360         std::cout<<"ThetaMode:                                    "<<ThetaMode<<std::endl;
01361         std::cout<<"File Name for EnergyMode = histo:             "<<EM_hist_filename<<std::endl;
01362         std::cout<<"Histogram Name for EnergyMode = histo:        "<<EM_hist_histname<<std::endl;
01363         std::cout<<"File Name for DirectionMode = histo:          "<<DM_hist_filename<<std::endl;
01364         std::cout<<"Histogram Name for DirectionMode = histo:     "<<DM_hist_histname<<std::endl;
01365         std::cout<<"File Name for PositionMode = histo:          "<<PM_hist_filename<<std::endl;
01366         std::cout<<"Histogram Name for PositionMode = histo:     "<<PM_hist_histname<<std::endl;
01367         std::cout<<"File Name for Energy/Position/TimeMode = root: "<<root_filename<<std::endl;
01368         std::cout<<"Tree Name for Energy/Position/TimeMode = root: "<<root_treename<<std::endl;
01369         std::cout<<"---------------------------------------------------------"<<std::endl;
01370 }

bool MyConfigure::FindMacro ( G4String  word,
G4String &  value 
) [inherited]

Definition at line 87 of file MyConfigure.cc.

References MyConfigure::knownValueNames, and MyConfigure::knownValues.

Referenced by MyConfigure::Replace(), and MyConfigure::ReplaceMacro().

00087                                                          {
00088         bool found = false;
00089         for (int i = 0; i< knownValues.size(); i++){
00090                 if (knownValueNames[i]==word){
00091                         value = knownValues[i];
00092                         found = true;
00093                         break;
00094                 }
00095         }
00096         return found;
00097 }

void PrimaryGeneratorAction::GeneratePrimaries ( G4Event *  anEvent  ) 

Inform the event header of the primary particle so we store info in the output root tree

Definition at line 130 of file PrimaryGeneratorAction.cc.

References A, C, DirectionMode, DM_hist, E, EM_hist, EnergyMode, fCollimatedInputHist_XPxPz, fCollimatedInputHist_XYPz, fCollimatedInputHist_YPyPz, fEnergyLoss, fMuPCBeamDistHist, fParticle, fType, fXPositionFinalFocusFit, fYPositionFinalFocusFit, InformEventHeaderHeader(), mass, MomSpread, Pa, particleGun, PhiMode, pidMode, PM_hist, PM_hist_sparse, PositionMode, RandMode, root_double, root_get_para(), root_index, root_int, SetRandomDirection(), SetRandomEnergy(), SetRandomPosition(), SetUniformDirection(), SetUniformPosition(), ThetaMode, TimeMode, UseRoot, x, xSpread, y, ySpread, z, Z, and zSpread.

00131 {
00132         //this function is called at the begining of event
00133         // 
00134         if (UseRoot){
00135                 root_get_para();
00136         }
00137         if (RandMode=="root"){
00138                 long seeds[3];
00139 //              seeds[0] = root_double[7];
00140 //              seeds[1] = root_double[8];
00141                 seeds[0] = root_int[3];
00142                 seeds[1] = root_int[4];
00143                 seeds[2] = 0;
00144 //              std::cout<<"setTheSeeds("<<(int)seeds[0]<<","<<(int)seeds[1]<<")"<<std::endl;
00145                 CLHEP::HepRandom::setTheSeeds(seeds);
00146         }
00147 
00148         // Show Status:
00149 //      std::cout<<"==>Event "<<root_index<<std::endl;
00150 //    CLHEP::HepRandom::showEngineStatus();
00151 
00152         if (fType=="ion"){
00153                 if (!fParticle){
00154                         G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
00155                         fParticle = particleTable->GetIon(Z,A,E*keV);
00156                         if (!fParticle){
00157                                 std::cout<<"ERROR: In PrimaryGeneratorAction::PrimaryGeneratorAction() Cannot find particle "
00158                                                  <<"Z = "<<Z
00159                                                  <<", A = "<<A
00160                                                  <<", E = "<<E<<" keV"
00161                                                  <<"!!!"<<std::endl;
00162                                 G4Exception("PrimaryGeneratorAction::PrimaryGeneratorAction()","Run0031",
00163                                                 FatalException, "Cannot find particle.");
00164                         }
00165                 }
00166                 if (fType == "stable"){
00167                         fParticle->SetPDGStable(true);
00168                 }
00169                 particleGun->SetParticleDefinition(fParticle);
00170                 mass = particleGun->GetParticleDefinition()->GetPDGMass();
00171                 particleGun->SetParticleCharge(C*eplus);
00172         }
00173 
00174         if ( pidMode == "root"){
00175                 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
00176                 G4ParticleDefinition* particle = particleTable->FindParticle(root_int[0]);
00177                 if (!particle){
00178                         std::cout<<"ERROR: In PrimaryGeneratorAction::PrimaryGeneratorAction() Cannot find particle "<<root_int[0]<<"!!! Will use geantino"<<std::endl;
00179 //                      G4Exception("PrimaryGeneratorAction::PrimaryGeneratorAction()","Run0031",
00180 //                                      FatalException, "Cannot find particle.");
00181                         particle = particleTable->FindParticle("geantino");
00182                 }
00183                 if (fType == "stable"){
00184                         particle->SetPDGStable(true);
00185                 }
00186                 particleGun->SetParticleDefinition(particle);
00187                 mass = particleGun->GetParticleDefinition()->GetPDGMass();
00188         }
00189 
00190         if ( EnergyMode == "histo"){
00191                 G4double ekin = EM_hist->GetRandom() / 1e3 * MeV;
00192                 //              G4double mom = sqrt(ekin*ekin + 2*ekin*mass);
00193                 particleGun->SetParticleEnergy(ekin);
00194         }
00195         else if ( EnergyMode == "root" ){
00196                 //std::cout<<"PGA EM = root!"
00197                 //           <<", ("<<root_double[3]
00198                 //           <<","<<root_double[4]
00199                 //           <<","<<root_double[5]
00200                 //           <<") MeV"
00201                 //           <<std::endl;
00202                 G4double ekin = sqrt(root_double[3]*root_double[3]*MeV*MeV+root_double[4]*root_double[4]*MeV*MeV+root_double[5]*root_double[5]*MeV*MeV+mass*mass)-mass;
00203                 particleGun->SetParticleMomentumDirection(G4ThreeVector(root_double[3] * MeV, root_double[4] * MeV, root_double[5] * MeV).unit());
00204                 particleGun->SetParticleEnergy(ekin);
00205         }
00206         else if ( EnergyMode == "gRand" || EnergyMode == "uRand" ){
00207                 SetRandomEnergy();
00208         }
00209         else if ( EnergyMode == "collimated") {
00210           if (!fCollimatedInputHist_XYPz && !fCollimatedInputHist_XPxPz && !fCollimatedInputHist_YPyPz) {
00211             TDirectory* prev_dir = gDirectory;
00212             // Get the relevant functions/histograms
00213             std::string dir_name = getenv("CONFIGUREDATAROOT");
00214             dir_name += "CollimatedInput.root";
00215             TFile* collimated_file = new TFile(dir_name.c_str(), "READ");
00216             
00217             fCollimatedInputHist_XYPz = (TH3F*) (collimated_file->Get("hXYPz"))->Clone();
00218             fCollimatedInputHist_XYPz->SetDirectory(0);
00219 
00220             fCollimatedInputHist_XPxPz = (TH3F*) (collimated_file->Get("hXPxPz"))->Clone();
00221             fCollimatedInputHist_XPxPz->SetDirectory(0);
00222 
00223             fCollimatedInputHist_YPyPz = (TH3F*) (collimated_file->Get("hYPyPz"))->Clone();
00224             fCollimatedInputHist_YPyPz->SetDirectory(0);
00225 
00226             collimated_file->Close();
00227             gDirectory = prev_dir; // need to go back to where we were so that we can get the tree written to the output file
00228           }
00229 
00230           // The idea here is to make sure the correlations are maintained
00231           // The plan is:
00232           //  1. Generate a random set of XYPz
00233           //  2. Select a random x position based on the values of Px and Pz
00234           //  3. Select a random y position based on the values of Py and Pz
00235           //  4. Track this (x, y) pair back to make sure that it passed the ellipse
00236           double px, py, pz; // the variables we want to get
00237           double x, y, z;
00238           z = -7.06*cm; // already set by location of ColMon
00239 
00240           TH2F* hXPx = NULL; // we will use these to store the projections of the various plots
00241           TH1D* hPx = NULL;
00242           TH2F* hYPy = NULL;
00243           TH1D* hPy = NULL;
00244 
00245           double monitor_location = 2*cm; // the monitor we read out from to get collimated information was 20mm in front of the collimator
00246           double hole_ellipse_half_x = 1.6*cm; // the two radii of the hole in the collimator
00247           double hole_ellipse_half_y = 2.5*cm;
00248 
00249           bool found = false;
00250           while (!found) {
00251             fCollimatedInputHist_XYPz->GetRandom3(x, y, pz);
00252             x *= cm; y *= cm; pz *= MeV;
00253             //      std::cout << "Drawn (x, y, pz): (" << x/cm << " cm, " << y/cm << " cm, " << pz/MeV << " MeV)" << std::endl;
00254 
00255             // First get the slice in the X-Z plane
00256             int bin = fCollimatedInputHist_XPxPz->GetZaxis()->FindBin(pz);
00257             fCollimatedInputHist_XPxPz->GetZaxis()->SetRange(bin, bin);
00258             hXPx = (TH2F*) fCollimatedInputHist_XPxPz->Project3D("xy");
00259 
00260             if (hXPx->GetEntries() == 0) {
00261               continue;
00262             }
00263 
00264             // Now get the slice in the y plane so that we can randomly select a value for x
00265             bin = hXPx->GetYaxis()->FindBin(x);
00266             hXPx->GetYaxis()->SetRange(bin, bin);
00267             hPx = hXPx->ProjectionX();
00268 
00269             if (hPx->GetEntries() == 0) {
00270               continue;
00271             }
00272 
00273             // Randomly select a value for x
00274             px = hPx->GetRandom()*MeV;
00275 
00276             // First get the slice in the Y-Z plane
00277             bin = fCollimatedInputHist_YPyPz->GetZaxis()->FindBin(pz);
00278             fCollimatedInputHist_YPyPz->GetZaxis()->SetRange(bin, bin);
00279             hYPy = (TH2F*) fCollimatedInputHist_YPyPz->Project3D("xy");
00280 
00281             if (hYPy->GetEntries() == 0) {
00282               continue;
00283             }
00284 
00285 
00286             // Now get the slice in the y plane so that we can randomly select a value for y
00287             bin = hYPy->GetYaxis()->FindBin(y);
00288             hYPy->GetYaxis()->SetRange(bin, bin);
00289             hPy = hYPy->ProjectionX();
00290             
00291             if (hPy->GetEntries() == 0) {
00292               continue;
00293             }
00294 
00295             // Randomly select a value for y
00296             py = hPy->GetRandom()*MeV;
00297             //      std::cout << "Drawn (px, py) = (" << px/MeV << " MeV, " << py/MeV << " MeV)" << std::endl;
00298 
00299             // Track back to make sure we did pass ellipse
00300             double p_total = std::sqrt(px*px + py*py + pz*pz);
00301 
00302             double unit_px = px / p_total;
00303             double trackback_x = x - unit_px*monitor_location;
00304             double unit_py = py / p_total;
00305             double trackback_y = y - unit_py*monitor_location;
00306 
00307             double ellipse = (trackback_x*trackback_x)/(hole_ellipse_half_x*hole_ellipse_half_x) + (trackback_y*trackback_y)/(hole_ellipse_half_y*hole_ellipse_half_y);
00308             if (ellipse <= 1) {
00309               //              std::cout << ellipse << " OK" << std::endl;
00310               found = true;
00311             }
00312           }
00313           G4ParticleMomentum particleMomentum(px, py, pz);
00314 
00315           G4double mom = particleMomentum.mag();
00316           G4double mass = particleGun->GetParticleDefinition()->GetPDGMass();
00317           G4double ekin = sqrt(mom*mom+mass*mass)-mass;
00318           particleGun->SetParticleEnergy(ekin);
00319           particleGun->SetParticleMomentumDirection(particleMomentum.unit());
00320 
00321           G4ThreeVector start_pos(x, y, z);
00322           particleGun->SetParticlePosition(start_pos);
00323 
00324           //      std::cout << particleMomentum/MeV << " MeV, " << mom/MeV << " MeV, " << mass << ", " << ekin << ", " << start_pos/cm << " cm" << std::endl;
00325         }
00326         else if ( EnergyMode != "none" ){
00327                 std::cout<<"ERROR: unknown EnergyMode: "<<EnergyMode<<"!!!"<<std::endl;
00328                 G4Exception("PrimaryGeneratorAction::GeneratePrimaries()",
00329                                 "InvalidSetup", FatalException,
00330                                 "unknown EnergyMode");
00331         }
00332 
00333         if ( DirectionMode == "uniform" ){
00334                 SetUniformDirection();
00335         }
00336         else if ( DirectionMode == "histo" ){
00337                 G4double theta = DM_hist->GetRandom() * rad;
00338                 G4double phi = G4UniformRand() * 360. *deg;
00339                 G4ThreeVector dir_3Vec(1, 1, 1);
00340                 dir_3Vec.setTheta(theta);
00341                 dir_3Vec.setPhi(phi);
00342                 particleGun->SetParticleMomentumDirection(dir_3Vec);
00343         }
00344         else if ( DirectionMode == "turtle" || PositionMode == "turtle") {
00345 
00346           // Plan
00347           // -- Get an X-Y position at muPC
00348           // -- Get an X-Y position at final focus 
00349           // -- Get the direction vector between the two
00350           // -- Track the direction forward to a start point
00351 
00352           if (!fXPositionFinalFocusFit && !fYPositionFinalFocusFit && !fMuPCBeamDistHist) {
00353             TDirectory* prev_dir = gDirectory;
00354             // Get the relevant functions/histograms
00355             std::string dir_name = getenv("CONFIGUREDATAROOT");
00356             dir_name += "TURTLE_fits.root";
00357             TFile* turtle_file = new TFile(dir_name.c_str(), "READ");
00358             
00359             // Get the functions that describe the x and y positions of the beam at the final focus
00360             fXPositionFinalFocusFit = (TF1*) turtle_file->Get("final_focus_horizontal");
00361             fYPositionFinalFocusFit = (TF1*) turtle_file->Get("final_focus_vertical");
00362 
00363             // Get the histogram of the beam distribution at the muPC
00364             fMuPCBeamDistHist = (TH2F*) turtle_file->Get("hmuPC_XYWires")->Clone(); // need to clone because the file will be closing soon
00365             fMuPCBeamDistHist->SetDirectory(0); // need to set directory to 0 so that we can use this histogram after the file is closed
00366             turtle_file->Close();
00367             gDirectory = prev_dir; // need to go back to where we were so that we can get the tree written to the output file
00368           }
00369 
00370           double x_muPC = 0;
00371           double y_muPC = 0;
00372           fMuPCBeamDistHist->GetRandom2(x_muPC, y_muPC);
00373           //      fMuPCBeamDistRandom->Fill(x_muPC, y_muPC);
00374           double z_muPC = 52.5; // approx 10cm downstream of the end of the beampipe (from previous g4sim geometry)
00375           
00376           double x_ff = fXPositionFinalFocusFit->GetRandom()*10; // convert from cm to mm
00377           double y_ff = fYPositionFinalFocusFit->GetRandom()*10; // convert from cm to mm
00378           //      fFFBeamDistRandom->Fill(x_ff, y_ff);
00379           double z_ff = 120; // 12cm downstream of the beam pipe (according to MuSun report)
00380           
00381           // Translate to having the target at the origin
00382           double z_pos_beam_pipe = -285.58 - 60; // relative to target
00383           double translation = z_pos_beam_pipe; // from g4sim geometry
00384           //      std::cout << "translation = " << translation << std::endl;
00385           z_muPC += translation; // from the g4sim geometry
00386           z_ff += translation; 
00387           
00388           G4ThreeVector muPCPos(x_muPC*mm, y_muPC*mm, z_muPC*mm);
00389           G4ThreeVector ffPos(x_ff*mm, y_ff*mm, z_ff*mm);
00390           //      std::cout << "muPC: (" << muPCPos.x()/mm << ", " << muPCPos.y()/mm << ", " << muPCPos.z()/mm << ") mm" << std::endl;  
00391           //      std::cout << "FF: (" << ffPos.x()/mm << ", " << ffPos.y()/mm << ", " << ffPos.z()/mm << ") mm" << std::endl;
00392           
00393           G4ThreeVector direction = (ffPos - muPCPos).unit();
00394           //      std::cout << "dir: (" << direction.x()/mm << ", " << direction.y()/mm << ", " << direction.z()/mm << ") mm" << std::endl;     
00395           
00396           // Track back to exit of beam pipe (z = -304*mm)
00397           double n_steps = (z_pos_beam_pipe - muPCPos.z()/mm) / (direction.z()/mm);
00398           //      std::cout << "n_steps to start of beam pipe: " << n_steps << std::endl;
00399           G4ThreeVector start_pos = muPCPos + n_steps*direction;
00400           //      std::cout << "start: (" << start_pos.x()/mm << ", " << start_pos.y()/mm << ", " << start_pos.z()/mm << ") mm" << std::endl;
00401 
00402           particleGun->SetParticlePosition(start_pos);
00403           particleGun->SetParticleMomentumDirection(direction);
00404         }
00405         else if ( DirectionMode == "muPC" || PositionMode == "muPC" || PositionMode == "collimator" || DirectionMode == "collimator") {
00406           if (!fMuPCBeamDistHist) {
00407             TDirectory* prev_dir = gDirectory;
00408             // Get the relevant functions/histograms
00409             std::string dir_name = getenv("CONFIGUREDATAROOT");
00410             dir_name += "mupc_profile_run3600_Al50.root";
00411             TFile* mupc_profile_file = new TFile(dir_name.c_str(), "READ");
00412             
00413             // Get the histogram of the beam distribution at the muPC
00414             fMuPCBeamDistHist = (TH2F*) mupc_profile_file->Get("muPC/hmuPC_XYWires")->Clone(); // need to clone because the file will be closing soon
00415             fMuPCBeamDistHist->SetDirectory(0); // need to set directory to 0 so that we can use this histogram after the file is closed
00416             mupc_profile_file->Close();
00417             gDirectory = prev_dir; // need to go back to where we were so that we can get the tree written to the output file
00418           }
00419 
00420           bool found = false;
00421           
00422           while (!found) {
00423 
00424             if (DirectionMode == "muPC" || PositionMode == "muPC") {
00425               found = true; // we take anything if we want to start from the beginning
00426             }
00427 
00428             double x, y, z;
00429             z = -(285.58+7.5)*mm;
00430             fMuPCBeamDistHist->GetRandom2(x, y);
00431             x *= mm; y *= mm;
00432             G4ThreeVector muPCPos(x, y, z);
00433             //    std::cout << "(x, y, z) = (" << x << ", " << y << ", " << z << ")" << std::endl;
00434 
00435 
00436             double dMom=G4RandGauss::shoot(0,MomSpread);
00437             double pz = Pa + dMom;
00438             //    std::cout << "Pa = " << Pa << ", dMom = " << dMom << std::endl;
00439             double px = G4RandGauss::shoot(0, 0.033*pz);
00440             double py = G4RandGauss::shoot(0, 0.11*pz);
00441             double p_tot = std::sqrt(px*px + py*py + pz*pz);
00442             //      std::cout << "Before: (px, py, pz) = (" << px << ", " << py << ", " << pz << ")" << std::endl;
00443             //      std::cout << "p_tot = " << p_tot << std::endl;
00444             
00445             // Rescale components so that we get the correct momentum again
00446             double scale_factor = pz / p_tot;
00447             px *= scale_factor;
00448             py *= scale_factor;
00449             pz *= scale_factor;
00450             p_tot = std::sqrt(px*px + py*py + pz*pz);
00451             //      std::cout << "After: (px, py, pz) = (" << px << ", " << py << ", " << pz << ")" << std::endl;
00452             //      std::cout << "p_tot = " << p_tot << std::endl;
00453             G4ThreeVector particleMomentum(px, py, pz);
00454             G4ThreeVector direction = particleMomentum.unit();
00455 
00456             // want to scale back so that total magnitude is the same as the pz we got earlier
00457             G4double mom = particleMomentum.mag();
00458             G4double scale = pz / particleMomentum.mag();
00459             //      std::cout << "AE: scale = " << pz << " / " << particleMomentum.mag() << " = " << scale << std::endl;
00460             particleMomentum *= scale;
00461             //      std::cout << "AE: Now " << particleMomentum.mag() << std::endl;
00462             G4double mass = particleGun->GetParticleDefinition()->GetPDGMass();
00463             G4double ekin = sqrt(mom*mom+mass*mass)-mass;
00464             particleGun->SetParticleEnergy(ekin);
00465             particleGun->SetParticleMomentumDirection(direction);
00466                     
00467             if (DirectionMode == "collimator" || PositionMode == "collimator") {
00468               double z_pos_collimator = -90.5;
00469               double n_steps = (z_pos_collimator - muPCPos.z()/mm) / (direction.z()/mm);
00470               G4ThreeVector start_pos = muPCPos + n_steps*direction;
00471 
00472               double hole_ellipse_half_x = 16*mm; // the two radii of the hole in the collimator
00473               double hole_ellipse_half_y = 25*mm;
00474               double ellipse = (start_pos.x()*start_pos.x())/(hole_ellipse_half_x*hole_ellipse_half_x) + (start_pos.y()*start_pos.y())/(hole_ellipse_half_y*hole_ellipse_half_y);
00475               if ( ellipse < 1) {
00476                 particleGun->SetParticlePosition(start_pos);
00477 
00478                 if (!fEnergyLoss) {
00479                   fEnergyLoss = new TF1("energy_loss", "[0]*TMath::Landau(x, [1], [2]) + [3]*TMath::Exp([4]*x^[5] + [6]) + [7]*TMath::Gaus(x, [8], [9])", 0, 0.03);
00480                   // Set the parameters (hard-coded from the fit I did separately (2014-11-04)
00481                   fEnergyLoss->SetParameter(0, 14051.2);
00482                   fEnergyLoss->SetParameter(1, 0.0141187);
00483                   fEnergyLoss->SetParameter(2, 0.000738656);
00484                   fEnergyLoss->SetParameter(3, -0.0127883);
00485                   fEnergyLoss->SetParameter(4, 0.0599257);
00486                   fEnergyLoss->SetParameter(5, 11.5222);
00487                   fEnergyLoss->SetParameter(6, -1.30946);
00488                   fEnergyLoss->SetParameter(7, 2510.06);
00489                   fEnergyLoss->SetParameter(8, 0.0155356);
00490                   fEnergyLoss->SetParameter(9, 0.00170543);
00491                 }
00492                 // Add some energy loss
00493                 double e_loss = fEnergyLoss->GetRandom()*GeV;
00494                 G4double new_mom = mom - e_loss;
00495                 mass = particleGun->GetParticleDefinition()->GetPDGMass();
00496                 ekin = sqrt(new_mom*new_mom+mass*mass)-mass;
00497                 particleGun->SetParticleEnergy(ekin);
00498                 //              std::cout << "Old Mom: " << mom << ", e_loss: " << e_loss << ", new_mom: " << new_mom << std::endl;
00499                 found = true;
00500               }
00501             }
00502             if (DirectionMode == "muPC" || PositionMode == "muPC") {
00503               // Track back to the end of the beam pipe
00504               double z_pos_beam_pipe = -285.58 - 60;
00505               double n_steps = (z_pos_beam_pipe - muPCPos.z()/mm) / (direction.z()/mm);
00506               //          std::cout << "n_steps to start of beam pipe: " << n_steps << std::endl;
00507               G4ThreeVector start_pos = muPCPos + n_steps*direction;
00508               //              std::cout << "AE: PosSpread: " << xSpread << ", " << ySpread << ", " << zSpread << std::endl;
00509               G4ThreeVector move(xSpread, ySpread, zSpread); // to translate the whole beam
00510               start_pos += move;
00511               particleGun->SetParticlePosition(start_pos);
00512             }
00513           }
00514         }
00515         else if ( DirectionMode != "none" ){
00516                 std::cout<<"ERROR: unknown DirectionMode: "<<DirectionMode<<"!!!"<<std::endl;
00517                 G4Exception("PrimaryGeneratorAction::GeneratePrimaries()",
00518                                 "InvalidSetup", FatalException,
00519                                 "unknown DirectionMode");
00520         }
00521 
00522 
00523         if ( PhiMode== "gRand" || PhiMode=="uRand" || ThetaMode== "gRand" || ThetaMode=="uRand" ){
00524                 SetRandomDirection();
00525         }
00526 
00527         if ( PositionMode == "uniform" ){
00528                 SetUniformPosition();
00529         }
00530         else if ( PositionMode == "root" ){
00531                 //std::cout<<"PGA PM = root!"
00532                 //           <<", ("<<root_double[0]
00533                 //           <<","<<root_double[1]
00534                 //           <<","<<root_double[2]
00535                 //           <<") mm"
00536                 //           <<std::endl;
00537                 particleGun->SetParticlePosition(G4ThreeVector(root_double[0] * mm, root_double[1] * mm, (root_double[2])*mm));
00538         }
00539         else if ( PositionMode == "gRand" || PositionMode == "sRand" || PositionMode == "bRand" ){
00540                 SetRandomPosition();
00541         }
00542         else if ( PositionMode == "target") {
00543           SetRandomPosition();  
00544         }
00545         else if ( PositionMode == "source") {
00546           SetRandomPosition();  
00547         }
00548         else if ( PositionMode == "histo") {
00549           if (PM_hist) { // if we have a TH3F
00550                 double x=0,y=0,z=0;
00551                 PM_hist->GetRandom3(x,y,z);
00552                 G4ThreeVector pos_3Vec(x, y, z);
00553                 particleGun->SetParticlePosition(pos_3Vec);
00554           }
00555           else if (PM_hist_sparse) {
00556             double random_pos[3];
00557             PM_hist_sparse->GetRandom(random_pos);
00558             G4ThreeVector pos_3Vec(random_pos[0], random_pos[1], random_pos[2]);
00559             particleGun->SetParticlePosition(pos_3Vec); // should probably try and avoid having same line twice
00560           }
00561         }
00562         else if ( PositionMode == "turtle" || PositionMode == "muPC" || PositionMode == "collimator") {
00563           // Already handled in the DirectionMode if block
00564         }
00565         else if ( PositionMode != "none" ){
00566                 std::cout<<"ERROR: unknown PositionMode: "<<PositionMode<<"!!!"<<std::endl;
00567                 G4Exception("PrimaryGeneratorAction::GeneratePrimaries()",
00568                                 "InvalidSetup", FatalException,
00569                                 "unknown PositionMode");
00570         }
00571 
00572         if ( TimeMode == "root" ){
00573                 //std::cout<<"PGA TM = root!"
00574                 //           <<", ("<<root_double[6]
00575                 //           <<") ns"
00576                 //           <<std::endl;
00577                 particleGun->SetParticleTime(root_double[6]*ns);
00578         }
00579         else if ( TimeMode != "none" ){
00580                 std::cout<<"ERROR: unknown TimeMode: "<<TimeMode<<"!!!"<<std::endl;
00581                 G4Exception("PrimaryGeneratorAction::GeneratePrimaries()",
00582                                 "InvalidSetup", FatalException,
00583                                 "unknown TimeMode");
00584         }
00585 
00586         //      std::cout << "Particle Momentum: " << particleGun->GetParticleEnergy() << std::endl << std::endl;
00587         particleGun->GeneratePrimaryVertex(anEvent);
00588 
00589 //      std::cout.precision(17);
00590 //      std::cout<<"\tDirection: "<<particleGun->GetParticleMomentumDirection()<<std::endl;
00591 //      std::cout<<"\tEnergy: "<<particleGun->GetParticleEnergy()/MeV<<" MeV"<<std::endl;
00592 //      std::cout.precision(3);
00593 //    CLHEP::HepRandom::showEngineStatus();
00594 
00596         InformEventHeaderHeader();
00597         if (!UseRoot) root_index++;
00598 }

void * PrimaryGeneratorAction::get_extra ( G4String  name  ) 

Definition at line 110 of file PrimaryGeneratorAction.cc.

References flag_opx, flag_opy, flag_opz, flag_ot, flag_ox, flag_oy, flag_oz, flag_ppid, flag_process, flag_ptid, flag_R0, flag_R1, flag_volume, flag_weight, root_double, root_int, and root_str.

Referenced by MyAnalysisSvc::EndOfEventAction(), and MonitorSD::ProcessHits().

00110                                                     {
00111         if (name=="weight") {if(!flag_weight)  return &root_double[9];}
00112         else if (name=="ox") {if(!flag_ox)  return &root_double[10];}
00113         else if (name=="oy") {if(!flag_oy)  return &root_double[11];}
00114         else if (name=="oz") {if(!flag_oz)  return &root_double[12];}
00115         else if (name=="opx") {if(!flag_opx)  return &root_double[13];}
00116         else if (name=="opy") {if(!flag_opy)  return &root_double[14];}
00117         else if (name=="opz") {if(!flag_opz)  return &root_double[15];}
00118         else if (name=="ot") {if(!flag_ot)  return &root_double[16];}
00119         else if (name=="ppid") {if(!flag_ppid)  return &root_int[1];}
00120         else if (name=="ptid") {if(!flag_ptid)  return &root_int[2];}
00121         else if (name=="process") {if(!flag_process)  return root_str[0];}
00122         else if (name=="volume") {if(!flag_volume)  return root_str[1];}
00123 //      else if (name=="R0") {if(flag_R0)  return &root_double[7];}
00124 //      else if (name=="R1") {if(flag_R1)  return &root_double[8];}
00125         else if (name=="R0") {if(!flag_R0)  return &root_int[3];}
00126         else if (name=="R1") {if(!flag_R1)  return &root_int[4];}
00127         return NULL;
00128 }

PrimaryGeneratorAction * PrimaryGeneratorAction::GetPrimaryGeneratorAction (  )  [static]

Definition at line 103 of file PrimaryGeneratorAction.cc.

References fPrimaryGeneratorAction, and PrimaryGeneratorAction().

Referenced by MonitorSD::Initialize(), and MyAnalysisSvc::MyAnalysisSvc().

00103                                                                          {
00104         if ( !fPrimaryGeneratorAction ){
00105                 new PrimaryGeneratorAction();
00106         }
00107         return fPrimaryGeneratorAction;
00108 }

std::vector< G4String > MyConfigure::GetWords ( G4String  formula  )  [inherited]

Definition at line 48 of file MyConfigure.cc.

Referenced by MyConfigure::ReplaceMacro().

00048                                                          {
00049         std::vector<G4String> words;
00050         words.clear();
00051         const char* cformula = formula.c_str();
00052         int length = strlen(cformula);
00053         char temp[1240];
00054         int tempoffset = 0;
00055         for ( int offset = 0; offset < length; offset++ ){
00056                 char c = cformula[offset];
00057                 bool isword = false;
00058                 if (c>='a'&&c<='z'
00059                         ||c>='A'&&c<='Z'
00060                         ||c>='0'&&c<='9'
00061                         ||c=='_'
00062                    ){
00063                         temp[tempoffset++] = cformula[offset];
00064                         isword = true;
00065                 }
00066                 if (!isword||offset==length-1){
00067                         if (tempoffset>0){
00068                                 temp[tempoffset++] = '\0';
00069                                 tempoffset=0;
00070                                 G4String word = temp;
00071                                 bool found = false;
00072                                 for(int iWord = 0; iWord<words.size(); iWord++){
00073                                         if (words[iWord]==word){
00074                                                 found = true;
00075                                                 break;
00076                                         }
00077                                 }
00078                                 if (!found){
00079                                         words.push_back(word);
00080                                 }
00081                         }
00082                 }
00083         }
00084         return words;
00085 }

void PrimaryGeneratorAction::InformEventHeaderHeader (  )  [private]

Definition at line 600 of file PrimaryGeneratorAction.cc.

References EventHeaderSvc::GetEventHeaderSvc(), particleGun, EventHeaderSvc::SetInitialMomentum(), EventHeaderSvc::SetInitialParticle(), EventHeaderSvc::SetInitialPosition(), and EventHeaderSvc::SetSeedsValue().

Referenced by GeneratePrimaries().

00600                                                     {
00601         // Set Random number seeds in the event header (R0 and R1) taken from elsewhere
00602         EventHeaderSvc::GetEventHeaderSvc()->SetSeedsValue();
00603 
00604         // Set the primary particle's momentum in the event header 
00605         G4ParticleMomentum mom=particleGun->GetParticleMomentumDirection();
00606         double E_kinetic=particleGun->GetParticleEnergy();
00607         double M=particleGun->GetParticleDefinition()->GetPDGMass();
00608         double P=sqrt(E_kinetic*E_kinetic + 2*M*E_kinetic);
00609         mom=P*mom;
00610         EventHeaderSvc::GetEventHeaderSvc()->SetInitialMomentum(mom.x(),mom.y(),mom.z());
00611 
00612         // Set the primary particle's position in the event header 
00613         G4ThreeVector pos=particleGun->GetParticlePosition();
00614         EventHeaderSvc::GetEventHeaderSvc()->SetInitialPosition(pos.x(),pos.y(),pos.z());
00615 
00616         // Set the primary particle's position in the event header 
00617         EventHeaderSvc::GetEventHeaderSvc()->SetInitialParticle(particleGun->GetParticleDefinition()->GetParticleName());
00618 }

void PrimaryGeneratorAction::Initialize (  ) 

Definition at line 1265 of file PrimaryGeneratorAction.cc.

References BuildHistoFromFile(), DirectionMode, Ekin, EnergyMode, EnergyType, fType, mass, Pa, particleGun, ParticleName, Phi, pidMode, PositionMode, RandMode, root_build(), root_double, root_int, root_str, t, Theta, TimeMode, UseRoot, x, y, and z.

Referenced by PrimaryGeneratorAction(), ResetGen(), and PrimaryGeneratorMessenger::SetNewValue().

01265                                        {
01266         if (fType == "simple" || fType == "stable" || fType == "ion" ){
01267                 G4int n_particle = 1;
01268                 if (particleGun) delete particleGun;
01269                 particleGun  = new G4ParticleGun(n_particle);
01270         }
01271         else {
01272                 G4Exception("PrimaryGeneratorAction::PrimaryGeneratorAction()","Run0031",
01273                                 FatalException, "unknown generator type.");
01274         }
01275 
01276         G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
01277         G4ParticleDefinition* particle = particleTable->FindParticle(ParticleName);
01278         if (!particle){
01279                 std::cout<<"ERROR: In PrimaryGeneratorAction::PrimaryGeneratorAction() Cannot find particle "<<ParticleName<<"!!!"<<std::endl;
01280                 G4Exception("PrimaryGeneratorAction::PrimaryGeneratorAction()","Run0031",
01281                                 FatalException, "Cannot find particle.");
01282         }
01283         if (fType == "stable"){
01284                 particle->SetPDGStable(true);
01285         }
01286         particleGun->SetParticleDefinition(particle);
01287         mass = particleGun->GetParticleDefinition()->GetPDGMass();
01288         G4ThreeVector dir(1,0,0);
01289         dir.setTheta(Theta);
01290         dir.setPhi(Phi);
01291         particleGun->SetParticleMomentumDirection(dir.unit());
01292         if (EnergyType==0){
01293                 Ekin = sqrt(Pa*Pa+mass*mass)-mass;
01294         }
01295         particleGun->SetParticleEnergy(Ekin);
01296         particleGun->SetParticlePosition(G4ThreeVector(x,y,z));
01297         particleGun->SetParticleTime(t);
01298 
01299         if (EnergyMode == "histo" || DirectionMode == "histo" || PositionMode == "histo" ){
01300                 BuildHistoFromFile();
01301         }
01302         UseRoot = false;
01303         if ( EnergyMode == "root" || PositionMode == "root" || TimeMode == "root" || pidMode == "root" || RandMode == "root"){
01304                 UseRoot = true;
01305                 root_build();
01306         }
01307         root_double[9]=1; // weight
01308         root_double[10]=-1;
01309         root_double[11]=-1;
01310         root_double[12]=-1;
01311         root_double[13]=-1;
01312         root_double[14]=-1;
01313         root_double[15]=-1;
01314         root_double[16]=-1;
01315         root_str[0]=0;
01316         root_str[1]=0;
01317         root_int[1]=-1;
01318         root_int[2]=-1;
01319 }

void PrimaryGeneratorAction::ReadCard ( G4String  file_name  ) 

Definition at line 990 of file PrimaryGeneratorAction.cc.

References A, C, MyConfigure::CalFormula(), DirectionMode, DM_hist_filename, DM_hist_histname, Dump(), E, Ekin, EkinSpread, EM_hist_filename, EM_hist_histname, EnergyMode, EnergyType, Ephi, Epsi, Etheta, fType, MyConfigure::knownValueNames, MyConfigure::knownValues, MomSpread, Pa, ParticleName, Phi, PhiMode, PhiSpread, pidMode, PM_hist_filename, PM_hist_histname, PositionMode, PosLimit2, RandMode, MyConfigure::ReplaceMacro(), Reset(), root_filename, root_treename, t, Theta, ThetaMode, ThetaSpread, TimeMode, UP_SubDet, UP_Type, UP_Volume, x, xSpread, y, ySpread, z, Z, and zSpread.

Referenced by PrimaryGeneratorAction(), ResetGen(), and PrimaryGeneratorMessenger::SetNewValue().

00990                                                        {
00991         std::cout<<" -- PrimaryGeneratorAction: Reading from \""<<file_name<<"\""<<std::endl;
00992         Reset();
00993         if(file_name[0] != '/'){ // Relative Dir
00994                 G4String dir_name = getenv("CONFIGUREROOT");
00995                 if (dir_name[dir_name.size()-1] != '/') dir_name.append("/");
00996                 file_name = dir_name + file_name;
00997         }
00998         std::ifstream fin_card(file_name);
00999         if ( !fin_card ){
01000                 std::cout<<"generator file \""<<file_name<<"\" is not available!!!"<<std::endl;
01001                 G4Exception("PrimaryGeneratorAction::PrimaryGeneratorAction()","Run0031",
01002                                 FatalException, "generator file is not available.");
01003         }
01004         std::stringstream buf_card;
01005         std::string s_card;
01006         while(getline(fin_card,s_card)){
01007                 buf_card.str("");
01008                 buf_card.clear();
01009                 buf_card<<s_card;
01010                 const char* c = s_card.c_str();
01011                 int length = strlen(c);
01012                 int offset = 0;
01013                 for ( ; offset < length; offset++ ){
01014                         if ( c[offset] != ' ' ) break;
01015                 }
01016                 if ( c[offset] == '#' ) continue;
01017                 else if ( c[offset] == '/' && c[offset+1] == '/' ) continue;
01018                 else if ( length - offset == 0 ) continue;
01019                 std::string keyword;
01020                 std::string temp;
01021                 buf_card>>keyword;
01022                 if ( keyword == "Type:" ){
01023                         buf_card>>fType;
01024                 }
01025                 else if ( keyword == "Particle:" ){
01026                         buf_card>>ParticleName;
01027                 }
01028                 else if ( keyword == "Z:" ){
01029                         buf_card>>Z;
01030                 }
01031                 else if ( keyword == "A:" ){
01032                         buf_card>>A;
01033                 }
01034                 else if ( keyword == "C:" ){
01035                         buf_card>>C;
01036                 }
01037                 else if ( keyword == "E:" ){
01038                         buf_card>>E;
01039                 }
01040                 else if ( keyword == "Direction:" ){
01041                         buf_card>>temp;
01042                         Theta = CalFormula(ReplaceMacro(temp))*deg;
01043                         buf_card>>temp;
01044                         Phi = CalFormula(ReplaceMacro(temp))*deg;
01045                 }
01046                 else if ( keyword == "PhiSpread:" ){
01047                         buf_card>>temp;
01048                         PhiSpread = CalFormula(ReplaceMacro(temp))*deg;
01049                 }
01050                 else if ( keyword == "Ephi:" ){
01051                         buf_card>>temp;
01052                         Ephi = CalFormula(ReplaceMacro(temp))*deg;
01053                 }
01054                 else if ( keyword == "Etheta:" ){
01055                         buf_card>>temp;
01056                         Etheta = CalFormula(ReplaceMacro(temp))*deg;
01057                 }
01058                 else if ( keyword == "Epsi:" ){
01059                         buf_card>>temp;
01060                         Epsi = CalFormula(ReplaceMacro(temp))*deg;
01061                 }
01062                 else if ( keyword == "ThetaSpread:" ){
01063                         buf_card>>temp;
01064                         ThetaSpread = CalFormula(ReplaceMacro(temp))*deg;
01065                 }
01066                 else if ( keyword == "MomAmp:" ){
01067                         buf_card>>temp;
01068                         Pa = CalFormula(ReplaceMacro(temp))*MeV;
01069                         EnergyType = 0;
01070                 }
01071                 else if ( keyword == "MomSpread:" ){
01072                         buf_card>>temp;
01073                         MomSpread = CalFormula(ReplaceMacro(temp))*MeV;
01074                 }
01075                 else if ( keyword == "Ekin:" ){
01076                         buf_card>>temp;
01077                         Ekin = CalFormula(ReplaceMacro(temp))*MeV;
01078                         EnergyType = 1;
01079                 }
01080                 else if ( keyword == "EkinSpread:" ){
01081                         buf_card>>temp;
01082                         EkinSpread = CalFormula(ReplaceMacro(temp))*MeV;
01083                 }
01084                 else if ( keyword == "Position:" ){
01085                         buf_card>>temp;
01086                         x = CalFormula(ReplaceMacro(temp))*mm;
01087                         buf_card>>temp;
01088                         y = CalFormula(ReplaceMacro(temp))*mm;
01089                         buf_card>>temp;
01090                         z = CalFormula(ReplaceMacro(temp))*mm;
01091                 }
01092                 else if ( keyword == "PosSpread:" ){
01093                         buf_card>>temp;
01094                         xSpread = CalFormula(ReplaceMacro(temp))*mm;
01095                         buf_card>>temp;
01096                         ySpread = CalFormula(ReplaceMacro(temp))*mm;
01097                         buf_card>>temp;
01098                         zSpread = CalFormula(ReplaceMacro(temp))*mm;
01099                 }
01100                 else if ( keyword == "PosLimit:" ){
01101                         buf_card>>temp;
01102                         PosLimit2 = CalFormula(ReplaceMacro(temp))*mm;
01103                         PosLimit2 *= PosLimit2;
01104                 }
01105                 else if ( keyword == "Time:" ){
01106                         buf_card>>temp;
01107                         t = CalFormula(ReplaceMacro(temp))*ns;
01108                 }
01109                 else if ( keyword == "RandMode:" ){
01110                         buf_card>>RandMode;
01111                 }
01112                 else if ( keyword == "EnergyMode:" ){
01113                         buf_card>>EnergyMode;
01114                 }
01115                 else if ( keyword == "PositionMode:" ){
01116                         buf_card>>PositionMode;
01117                 }
01118                 else if ( keyword == "TimeMode:" ){
01119                         buf_card>>TimeMode;
01120                 }
01121                 else if ( keyword == "pidMode:" ){
01122                         buf_card>>pidMode;
01123                 }
01124                 else if ( keyword == "DirectionMode:" ){
01125                         buf_card>>DirectionMode;
01126                 }
01127                 else if ( keyword == "ThetaMode:" ){
01128                         buf_card>>ThetaMode;
01129                 }
01130                 else if ( keyword == "PhiMode:" ){
01131                         buf_card>>PhiMode;
01132                 }
01133                 else if ( keyword == "EMHFN:" ){
01134                         buf_card>>EM_hist_filename;
01135                 }
01136                 else if ( keyword == "EMHHN:" ){
01137                         buf_card>>EM_hist_histname;
01138                 }
01139                 else if ( keyword == "DMHFN:" ){
01140                         buf_card>>DM_hist_filename;
01141                 }
01142                 else if ( keyword == "DMHHN:" ){
01143                         buf_card>>DM_hist_histname;
01144                 }
01145                 else if ( keyword == "PMHFN:" ){
01146                         buf_card>>PM_hist_filename;
01147                 }
01148                 else if ( keyword == "PMHHN:" ){
01149                         buf_card>>PM_hist_histname;
01150                 }
01151                 else if ( keyword == "RFN:" ){
01152                         buf_card>>root_filename;
01153                 }
01154                 else if ( keyword == "RTN:" ){
01155                         buf_card>>root_treename;
01156                 }
01157                 else if ( keyword == "UIV:" ){
01158                         buf_card>>UP_Type>>UP_SubDet>>UP_Volume;
01159                 }
01160                 else if ( keyword == "DEFINE:" ){
01161                         G4String MacroName;
01162                         G4String MacroValue;
01163                         buf_card>>MacroName>>MacroValue;
01164 //                      std::cout<<"found DEFINE:"<<std::endl; // to be deleted
01165                         MacroValue = ReplaceMacro(MacroValue);
01166                         bool foundName = false;
01167                         for (int i = 0; i < knownValueNames.size(); i++){
01168                                 if (knownValueNames[i]==MacroName){ // If this name occurred once, replace the value
01169                                         foundName = true;
01170                                         knownValues[i]=MacroValue;
01171                                         break;
01172                                 }
01173                         }
01174                         if (!foundName){
01175                                 knownValueNames.push_back(MacroName);
01176                                 knownValues.push_back(MacroValue);
01177                         }
01178                 }
01179                 else{
01180                         std::cout<<"In PrimaryGeneratorAction::ReadCard, unknown name: '"<<keyword<<"' in file "<<file_name<<std::endl;
01181                         std::cout<<"Will ignore this line!"<<std::endl;
01182                 }
01183         }
01184         fin_card.close();
01185         buf_card.str("");
01186         buf_card.clear();
01187         Dump();
01188 }

void MyConfigure::Replace ( G4String &  formula,
G4String  word,
G4String  value 
) [inherited]

Definition at line 99 of file MyConfigure.cc.

References MyConfigure::FindMacro().

Referenced by MyConfigure::ReplaceMacro().

00099                                                                          {
00100 //      std::cout<<"-- \""<<formula<<"\""<<std::endl; // to be deleted
00101         G4String newform = "";
00102         const char* cformula = formula.c_str();
00103         int length = strlen(cformula);
00104         char temp[1024];
00105         int tempoffset = 0;
00106         char cnewform[1024];
00107         int newformoffset = 0;
00108         for ( int offset = 0; offset < length; offset++ ){
00109                 char c = cformula[offset];
00110                 bool isword = false;
00111                 if (c>='a'&&c<='z'
00112                         ||c>='A'&&c<='Z'
00113                         ||c>='0'&&c<='9'
00114                         ||c=='_'
00115                    ){
00116                         temp[tempoffset++] = cformula[offset];
00117                         isword = true;
00118                 }
00119                 if (!isword||offset==length-1){
00120                         if (tempoffset>0){
00121                                 temp[tempoffset] = '\0';
00122                                 tempoffset=0;
00123                                 if (newformoffset>0){
00124                                         cnewform[newformoffset] = '\0';
00125                                         newformoffset=0;
00126                                         G4String newformtemp = cnewform;
00127                                         newform=newform+newformtemp;
00128                                 }
00129                                 G4String word = temp;
00130 //                              std::cout<<"            \""<<word<<"\""<<std::endl; // to be deleted
00131                                 G4String newword;
00132                                 bool found = FindMacro(word,newword);
00133                                 if (found){
00134                                         newform=newform+"("+newword+")";
00135                                 }
00136                                 else{
00137                                         newform=newform+word;
00138                                 }
00139 //                              std::cout<<"            to \""<<newword<<"\""<<std::endl; // to be deleted
00140                         }
00141                         if(!isword){
00142                                 cnewform[newformoffset++] = cformula[offset];
00143                         }
00144                         if (offset==length-1){
00145                                 cnewform[newformoffset] = '\0';
00146                                 G4String newformtemp = cnewform;
00147                                 newform=newform+newformtemp;
00148                         }
00149                 }
00150         }
00151 //      std::cout<<"    -->\""<<newform<<"\""<<std::endl; // to be deleted
00152         formula = newform;
00153 }

G4String MyConfigure::ReplaceMacro ( G4String  formula  )  [inherited]

Definition at line 33 of file MyConfigure.cc.

References MyConfigure::FindMacro(), MyConfigure::GetWords(), and MyConfigure::Replace().

Referenced by SimpleGeometryParameter::GetValue(), and ReadCard().

00033                                                   {
00034 //      std::cout<<"TO replace for: \""<<formula<<"\""<<std::endl; // to be deleted
00035         std::vector<G4String> words = GetWords(formula);
00036 //      std::cout<<"    "<<words.size()<<" words"<<std::endl; // to be deleted
00037         for (int iWord = 0; iWord < words.size(); iWord++ ){
00038 //              std::cout<<"            "<<iWord<<std::endl; // to be deleted
00039                 G4String value;
00040                 if (FindMacro(words[iWord],value)){
00041                         Replace(formula,words[iWord],value);
00042                 }
00043         }
00044 //      std::cout<<"\t=>"<<formula<<std::endl;
00045         return formula;
00046 }

void PrimaryGeneratorAction::Reset (  ) 

Definition at line 1190 of file PrimaryGeneratorAction.cc.

References A, C, DirectionMode, DM_hist, DM_hist_filename, DM_hist_histname, E, Ekin, EkinSpread, EM_hist, EM_hist_filename, EM_hist_histname, EnergyMode, EnergyType, Ephi, Epsi, Etheta, flag_ipx, flag_ipy, flag_ipz, flag_opx, flag_opy, flag_opz, flag_ot, flag_ox, flag_oy, flag_oz, flag_ppid, flag_process, flag_ptid, flag_R0, flag_R1, flag_volume, flag_weight, fType, mass, MomSpread, Pa, ParticleName, Phi, PhiMode, PhiSpread, pidMode, PM_hist, PM_hist_filename, PM_hist_histname, PositionMode, PosLimit2, Px, Py, Pz, RandMode, root_filename, root_index, root_num, root_treename, t, Theta, ThetaMode, ThetaSpread, TimeMode, UP_SubDet, UP_Type, UP_Volume, UseRoot, x, xSpread, y, ySpread, z, Z, and zSpread.

Referenced by ReadCard().

01190                                   {
01191         fType = "simple";
01192         RandMode = "none";
01193         EnergyMode = "none";
01194         PositionMode = "none";
01195         TimeMode = "none";
01196         pidMode = "none";
01197         DirectionMode = "none";
01198         PhiMode = "none";
01199         ThetaMode = "none";
01200         ParticleName = "chargedgeantino";
01201         EM_hist_filename = "";
01202         EM_hist_histname = "";
01203         DM_hist_filename = "";
01204         DM_hist_histname = "";
01205         PM_hist_filename = "";
01206         PM_hist_histname = "";
01207         root_filename = "";
01208         root_treename = "";
01209         UP_SubDet = "";
01210         UP_Volume = "";
01211         UP_Type = "";
01212         EnergyType = 1;
01213         Z = 1;
01214         A = 1;
01215         C = 0;
01216         E = 0;
01217         Pa = 0;
01218         Ekin = 0;
01219         mass = 0;
01220         Px = 0;
01221         Py = 0;
01222         Pz = 0;
01223         Theta = 0;
01224         Phi = 0;
01225         x = 0;
01226         y = 0;
01227         z = 0;
01228         t = 0;
01229         xSpread = 0;
01230         ySpread = 0;
01231         zSpread = 0;
01232         PosLimit2 = 0;
01233         MomSpread = 0;
01234         EkinSpread = 0;
01235         ThetaSpread = 0;
01236         PhiSpread = 0;
01237         Ephi = 0;
01238         Etheta = 0;
01239         Epsi = 0;
01240         EM_hist = 0;
01241         DM_hist = 0;
01242         PM_hist = 0;
01243         root_num = 0;
01244         root_index = 0;
01245         UseRoot = false;
01246         flag_weight = false;
01247         flag_ox = false;
01248         flag_oy = false;
01249         flag_oz = false;
01250         flag_opx = false;
01251         flag_opy = false;
01252         flag_opz = false;
01253         flag_ipx = false;
01254         flag_ipy = false;
01255         flag_ipz = false;
01256         flag_ot = false;
01257         flag_process = false;
01258         flag_volume = false;
01259         flag_R0 = false;
01260         flag_R1 = false;
01261         flag_ppid = false;
01262         flag_ptid = false;
01263 }

void PrimaryGeneratorAction::ResetGen ( G4String  file_name  ) 

Definition at line 985 of file PrimaryGeneratorAction.cc.

References Initialize(), and ReadCard().

Referenced by PrimaryGeneratorMessenger::SetNewValue().

00985                                                        {
00986         ReadCard(file_name);
00987         Initialize();
00988 }

void PrimaryGeneratorAction::root_build (  ) 

Definition at line 913 of file PrimaryGeneratorAction.cc.

References EnergyMode, m_TChain, pidMode, PositionMode, RandMode, root_filename, root_num, root_set_Energy(), root_set_extra(), root_set_pid(), root_set_Position(), root_set_Rand(), root_set_Time(), TimeMode, and UseRoot.

Referenced by Initialize(), and PrimaryGeneratorMessenger::SetNewValue().

00913                                        {
00914         G4String dir_name = getenv("CONFIGUREDATAROOT");
00915         if (dir_name[dir_name.size()-1] != '/') dir_name.append("/");
00916         std::string m_TFile_name = dir_name + root_filename;
00917         if (root_filename[0] == '/')
00918                 m_TFile_name = root_filename;
00919         //if (m_TChain) delete m_TChain;
00920         m_TChain = new TChain("t");
00921         m_TChain->Add(m_TFile_name.c_str());
00922         root_num = m_TChain->GetEntries();
00923         root_set_extra();
00924         if ( EnergyMode == "root" ){
00925                 UseRoot = true;
00926                 root_set_Energy();
00927         }
00928         if ( PositionMode == "root" ){
00929                 UseRoot = true;
00930                 root_set_Position();
00931         }
00932         if ( TimeMode == "root" ){
00933                 UseRoot = true;
00934                 root_set_Time();
00935         }
00936         if ( pidMode == "root" ){
00937                 UseRoot = true;
00938                 root_set_pid();
00939         }
00940         if ( RandMode == "root" ){
00941                 root_set_Rand();
00942         }
00943 }

void PrimaryGeneratorAction::root_get_para (  ) 

Definition at line 907 of file PrimaryGeneratorAction.cc.

References m_TChain, root_index, and root_num.

Referenced by GeneratePrimaries().

00907                                           {
00908         int iEvent = (int) fmod(root_index,root_num);
00909         m_TChain->GetEntry(iEvent);
00910         root_index++;
00911 }

void PrimaryGeneratorAction::root_set_Energy (  ) 

Definition at line 950 of file PrimaryGeneratorAction.cc.

References m_TChain, and root_double.

Referenced by root_build().

00950                                             {
00951         m_TChain->SetBranchAddress("px", &root_double[3]);
00952         m_TChain->SetBranchAddress("py", &root_double[4]);
00953         m_TChain->SetBranchAddress("pz", &root_double[5]);
00954 }

void PrimaryGeneratorAction::root_set_extra (  ) 

Definition at line 967 of file PrimaryGeneratorAction.cc.

References flag_ipx, flag_ipy, flag_ipz, flag_opx, flag_opy, flag_opz, flag_ot, flag_ox, flag_oy, flag_oz, flag_ppid, flag_process, flag_ptid, flag_volume, flag_weight, m_TChain, root_double, root_int, and root_str.

Referenced by root_build().

00967                                            {
00968         flag_weight=m_TChain->SetBranchAddress("weight", &root_double[9]);
00969         flag_ox=m_TChain->SetBranchAddress("ox", &root_double[10]);
00970         flag_oy=m_TChain->SetBranchAddress("oy", &root_double[11]);
00971         flag_oz=m_TChain->SetBranchAddress("oz", &root_double[12]);
00972         flag_opx=m_TChain->SetBranchAddress("opx", &root_double[13]);
00973         flag_opy=m_TChain->SetBranchAddress("opy", &root_double[14]);
00974         flag_opz=m_TChain->SetBranchAddress("opz", &root_double[15]);
00975         flag_ot=m_TChain->SetBranchAddress("ot", &root_double[16]);
00976         flag_ipx=m_TChain->SetBranchAddress("ipx", &root_double[17]);
00977         flag_ipy=m_TChain->SetBranchAddress("ipy", &root_double[18]);
00978         flag_ipz=m_TChain->SetBranchAddress("ipz", &root_double[19]);
00979         flag_process=m_TChain->SetBranchAddress("process",&root_str[0]);
00980         flag_volume=m_TChain->SetBranchAddress("volume",&root_str[1]);
00981         flag_ppid=m_TChain->SetBranchAddress("ppid",&root_int[1]);
00982         flag_ptid=m_TChain->SetBranchAddress("ptid",&root_int[2]);
00983 }

void PrimaryGeneratorAction::root_set_pid (  ) 

Definition at line 958 of file PrimaryGeneratorAction.cc.

References m_TChain, and root_int.

Referenced by root_build().

00958                                          {
00959         m_TChain->SetBranchAddress("pid", &root_int[0]);
00960 }

void PrimaryGeneratorAction::root_set_Position (  ) 

Definition at line 945 of file PrimaryGeneratorAction.cc.

References m_TChain, and root_double.

Referenced by root_build().

00945                                               {
00946         m_TChain->SetBranchAddress("x", &root_double[0]);
00947         m_TChain->SetBranchAddress("y", &root_double[1]);
00948         m_TChain->SetBranchAddress("z", &root_double[2]);
00949 }

void PrimaryGeneratorAction::root_set_Rand (  ) 

Definition at line 961 of file PrimaryGeneratorAction.cc.

References flag_R0, flag_R1, m_TChain, and root_int.

Referenced by root_build().

00961                                           {
00962 //      flag_R0 = m_TChain->SetBranchAddress("R0", &root_double[7]);
00963 //      flag_R1 = m_TChain->SetBranchAddress("R1", &root_double[8]);
00964         flag_R0 = m_TChain->SetBranchAddress("R0", &root_int[3]);
00965         flag_R1 = m_TChain->SetBranchAddress("R1", &root_int[4]);
00966 }

void PrimaryGeneratorAction::root_set_Time (  ) 

Definition at line 955 of file PrimaryGeneratorAction.cc.

References m_TChain, and root_double.

Referenced by root_build().

00955                                           {
00956         m_TChain->SetBranchAddress("t", &root_double[6]);
00957 }

void PrimaryGeneratorAction::set_DirectionMode ( G4String  val  )  [inline]

Definition at line 55 of file PrimaryGeneratorAction.hh.

References DirectionMode.

Referenced by PrimaryGeneratorMessenger::SetNewValue().

00055 { DirectionMode= val; }

void PrimaryGeneratorAction::set_DM_hist_filename ( G4String  val  )  [inline]

Definition at line 61 of file PrimaryGeneratorAction.hh.

References DM_hist_filename.

Referenced by PrimaryGeneratorMessenger::SetNewValue().

00061 { DM_hist_filename= val; }

void PrimaryGeneratorAction::set_DM_hist_histname ( G4String  val  )  [inline]

Definition at line 62 of file PrimaryGeneratorAction.hh.

References DM_hist_histname.

Referenced by PrimaryGeneratorMessenger::SetNewValue().

00062 { DM_hist_histname= val; }

void PrimaryGeneratorAction::set_EM_hist_filename ( G4String  val  )  [inline]

Definition at line 59 of file PrimaryGeneratorAction.hh.

References EM_hist_filename.

Referenced by PrimaryGeneratorMessenger::SetNewValue().

00059 { EM_hist_filename= val; }

void PrimaryGeneratorAction::set_EM_hist_histname ( G4String  val  )  [inline]

Definition at line 60 of file PrimaryGeneratorAction.hh.

References EM_hist_histname.

Referenced by PrimaryGeneratorMessenger::SetNewValue().

00060 { EM_hist_histname= val; }

void PrimaryGeneratorAction::set_EnergyMode ( G4String  val  )  [inline]

Definition at line 54 of file PrimaryGeneratorAction.hh.

References EnergyMode.

Referenced by PrimaryGeneratorMessenger::SetNewValue().

00054 { EnergyMode= val; }

void PrimaryGeneratorAction::set_pidMode ( G4String  val  )  [inline]

Definition at line 58 of file PrimaryGeneratorAction.hh.

References pidMode.

00058 { pidMode= val; }

void PrimaryGeneratorAction::set_PM_hist_filename ( G4String  val  )  [inline]

Definition at line 63 of file PrimaryGeneratorAction.hh.

References PM_hist_filename.

00063 { PM_hist_filename= val; }

void PrimaryGeneratorAction::set_PM_hist_histname ( G4String  val  )  [inline]

Definition at line 64 of file PrimaryGeneratorAction.hh.

References PM_hist_histname.

00064 { PM_hist_histname= val; }

void PrimaryGeneratorAction::set_PositionMode ( G4String  val  )  [inline]

Definition at line 56 of file PrimaryGeneratorAction.hh.

References PositionMode.

Referenced by PrimaryGeneratorMessenger::SetNewValue().

00056 { PositionMode= val; }

void PrimaryGeneratorAction::set_root_filename ( G4String  val  )  [inline]

Definition at line 65 of file PrimaryGeneratorAction.hh.

References root_filename.

Referenced by PrimaryGeneratorMessenger::SetNewValue().

00065 { root_filename= val; }

void PrimaryGeneratorAction::set_root_index ( int  val  )  [inline]

Definition at line 67 of file PrimaryGeneratorAction.hh.

References root_index.

Referenced by PrimaryGeneratorMessenger::SetNewValue().

00067 {root_index=val;}

void PrimaryGeneratorAction::set_root_treename ( G4String  val  )  [inline]

Definition at line 66 of file PrimaryGeneratorAction.hh.

References root_treename.

00066 { root_treename= val; }

void PrimaryGeneratorAction::set_TimeMode ( G4String  val  )  [inline]

Definition at line 57 of file PrimaryGeneratorAction.hh.

References TimeMode.

00057 { TimeMode= val; }

void PrimaryGeneratorAction::SetRandomDirection (  ) 

Definition at line 657 of file PrimaryGeneratorAction.cc.

References Ephi, Epsi, Etheta, particleGun, Phi, PhiMode, PhiSpread, Theta, ThetaMode, and ThetaSpread.

Referenced by GeneratePrimaries().

00657                                                {
00658         G4double dPhi=0;
00659         G4double dTheta=0;
00660         if(PhiMode=="gRand"){
00661                 if (PhiSpread) dPhi=G4RandGauss::shoot(Phi,PhiSpread);
00662         }
00663         else if (PhiMode=="uRand"){
00664                 if (PhiSpread) {dPhi=(G4UniformRand()-0.5)*PhiSpread;} 
00665         }
00666         if(ThetaMode=="gRand"){
00667                 if (ThetaSpread) dTheta=G4RandGauss::shoot(Theta,ThetaSpread);
00668         }
00669         else if (ThetaMode=="uRand"){
00670                 if (ThetaSpread) {dTheta=(G4UniformRand()-0.5)*ThetaSpread;} 
00671         }
00672         G4ThreeVector dir(1,1,1);
00673         dir.setTheta(Theta+dTheta);
00674         dir.setPhi(Phi+dPhi);
00675         G4RotationMatrix rot(Ephi,Etheta,Epsi);
00676         dir = rot*dir;
00677         particleGun->SetParticleMomentumDirection(dir.unit());
00678 }

void PrimaryGeneratorAction::SetRandomEnergy (  ) 

Definition at line 633 of file PrimaryGeneratorAction.cc.

References Ekin, EkinSpread, EnergyMode, EnergyType, mass, MomSpread, Pa, and particleGun.

Referenced by GeneratePrimaries().

00633                                             {
00634         if (EnergyType == 1){
00635                 G4double dE=0;
00636                 if(EnergyMode=="gRand"){
00637                         dE=G4RandGauss::shoot(0,EkinSpread);
00638                 }
00639                 else if(EnergyMode=="uRand"){
00640                         dE=(G4UniformRand()-0.5)*EkinSpread;
00641                 }
00642                 particleGun->SetParticleEnergy(Ekin+dE);
00643         }
00644         else if (EnergyType == 0 ){
00645                 G4double dMom=0;
00646                 if(EnergyMode=="gRand"){
00647                         dMom=G4RandGauss::shoot(0,MomSpread);
00648                 }
00649                 else if(EnergyMode=="uRand"){
00650                         dMom=(G4UniformRand()-0.5)*MomSpread;
00651                 }
00652                 G4double ekin = sqrt((Pa+dMom)*(Pa+dMom)+mass*mass)-mass;
00653                 particleGun->SetParticleEnergy(ekin);
00654         }
00655 }

void PrimaryGeneratorAction::SetRandomPosition (  ) 

Definition at line 680 of file PrimaryGeneratorAction.cc.

References particleGun, PositionMode, PosLimit2, x, xSpread, y, ySpread, z, and zSpread.

Referenced by GeneratePrimaries().

00680                                               {
00681         G4double dx=0;
00682         G4double dy=0;
00683         G4double dz=0;
00684         G4double dx2=0;
00685         G4double dy2=0;
00686         G4double dz2=0;
00687         bool gotit=false;
00688         if(PositionMode=="gRand"){
00689                 do {
00690                         dx=G4RandGauss::shoot(0,xSpread);
00691                         dy=G4RandGauss::shoot(0,ySpread);
00692                         dz=G4RandGauss::shoot(0,zSpread);
00693                         if (dx2+dy2+dz2<=PosLimit2) gotit = true;
00694                 } while (!gotit);
00695         }
00696         else if (PositionMode=="sRand"){
00697                 do {
00698                         if (xSpread) {dx=2.*(G4UniformRand()-0.5);dx2 = dx*dx;dx*=xSpread;} 
00699                         if (ySpread) {dy=2.*(G4UniformRand()-0.5);dy2 = dy*dy;dy*=ySpread;} 
00700                         if (zSpread) {dz=2.*(G4UniformRand()-0.5);dz2 = dz*dz;dz*=zSpread;} 
00701                         if (dx2+dy2+dz2<=1.) gotit = true;
00702                 } while (!gotit);
00703         }
00704         else if (PositionMode=="bRand"){
00705                 if (xSpread) dx=2.*(G4UniformRand()-0.5)*xSpread;
00706                 if (ySpread) dy=2.*(G4UniformRand()-0.5)*ySpread;
00707                 if (zSpread) dz=2.*(G4UniformRand()-0.5)*zSpread;
00708         }
00709         else if (PositionMode=="source" || PositionMode=="target"){
00710           // Make sure that the random position chosen is within the Target volume
00711           G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
00712 
00713           // Get a random position based on the spread (copied code from gRand)
00714           do {
00715                         //dx=G4RandGauss::shoot(0,xSpread);
00716                         //dy=G4RandGauss::shoot(0,ySpread);
00717                         //dz=G4RandGauss::shoot(0,zSpread);
00718             dx=G4RandFlat::shoot(-xSpread,xSpread);
00719             dy=G4RandFlat::shoot(-ySpread,ySpread);
00720             dz=G4RandFlat::shoot(-xSpread,zSpread);
00721 
00722             G4ThreeVector position(x+dx, y+dy, z+dz);
00723             CLHEP::HepEulerAngles rotation(45*deg, 90*deg, 0*deg);
00724             G4ThreeVector new_position = position.rotate(rotation);
00725             G4VPhysicalVolume* phys_volume = theNavigator->LocateGlobalPointAndSetup(new_position);
00726 
00727             if (!phys_volume) {
00728               continue; // if theNavigator didn't return a physical volume
00729             }
00730 
00731             if ( (PositionMode=="source" && phys_volume->GetName() == "Source") ||
00732                  (PositionMode=="target" && phys_volume->GetName() == "Target") ) {
00733               gotit = true;
00734             }
00735           } while (!gotit);
00736         }
00737 
00738   G4ThreeVector position(x+dx, y+dy, z+dz);
00739   if (PositionMode == "source" || PositionMode == "target") {
00740     CLHEP::HepEulerAngles rotation(45*deg, 90*deg, 0*deg);
00741     position = position.rotate(rotation);
00742   }
00743   particleGun->SetParticlePosition(position);
00744 }

void PrimaryGeneratorAction::SetUniformDirection (  ) 

Definition at line 620 of file PrimaryGeneratorAction.cc.

References particleGun.

Referenced by GeneratePrimaries().

00620                                                 {
00621         G4double dir_x = 0., dir_y = 0., dir_z = 0.;
00622         G4bool dir_OK = false;
00623         while( !dir_OK ){
00624                 dir_x=G4UniformRand()-0.5;
00625                 dir_y=G4UniformRand()-0.5;
00626                 dir_z=G4UniformRand()-0.5;
00627                 if ( dir_x*dir_x + dir_y*dir_y + dir_z*dir_z <= 0.025 && dir_x*dir_x + dir_y*dir_y + dir_z*dir_z != 0) dir_OK = true;
00628         }
00629         G4ThreeVector dir_3Vec(dir_x, dir_y, dir_z);
00630         particleGun->SetParticleMomentumDirection(dir_3Vec);
00631 }

void PrimaryGeneratorAction::SetUniformPosition (  ) 

Definition at line 746 of file PrimaryGeneratorAction.cc.

References MyVGeometrySvc::get_GeometryParameter(), SimpleGeometryParameter::get_MotherName(), SimpleGeometryParameter::get_PosX(), SimpleGeometryParameter::get_PosY(), SimpleGeometryParameter::get_PosZ(), SimpleGeometryParameter::get_RepNo(), SimpleGeometryParameter::get_SolidIndex(), SimpleGeometryParameter::get_SolidType(), SimpleGeometryParameter::get_Tubs_Length(), SimpleGeometryParameter::get_Tubs_RMax(), SimpleGeometryParameter::get_Tubs_RMin(), SimpleGeometryParameter::get_Tubs_SpanAng(), SimpleGeometryParameter::get_Tubs_StartAng(), SimpleGeometryParameter::get_VolIndex(), MyDetectorManager::GetMyDetectorManager(), MyDetectorManager::GetParaFromVolume(), MyDetectorManager::GetSvc(), particleGun, UP_SubDet, UP_Type, and UP_Volume.

Referenced by GeneratePrimaries().

00746                                                {
00747         MyVGeometryParameter* pMyVGeometryParameter = MyDetectorManager::GetMyDetectorManager()->GetSvc(UP_SubDet)->get_GeometryParameter();
00748         if (!pMyVGeometryParameter){
00749                 std::cout<<"ERROR: in PrimaryGeneratorAction::SetUniformPosition cannot find : "<<UP_SubDet<<"!!!"<<std::endl;
00750                 G4Exception("PrimaryGeneratorAction::SetUniformPosition()",
00751                                 "InvalidInput", FatalException,
00752                                 "cannot ");
00753         }
00754         if ( UP_Type == "Simple" ){
00755                 SimpleGeometryParameter* pSimpleGeometryParameter = dynamic_cast<SimpleGeometryParameter*> (pMyVGeometryParameter);
00756                 if (!pSimpleGeometryParameter){
00757                         std::cout<<"ERROR: in PrimaryGeneratorAction::SetUniformPosition cannot convert : "<<UP_SubDet<<" from MyVGeometryParameter to SimpleGeometryParameter!!!"<<std::endl;
00758                         G4Exception("PrimaryGeneratorAction::SetUniformPosition()",
00759                                         "InvalidInput", FatalException,
00760                                         "cannot convert from MyVGeometryParameter to SimpleGeometryParameter");
00761                 }
00762                 int index = pSimpleGeometryParameter->get_VolIndex(UP_Volume);
00763                 if ( index == -1 ){
00764                         std::cout<<"ERROR: in PrimaryGeneratorAction::SetUniformPosition cannot find : "<<UP_Volume<<"!!!"<<std::endl;
00765                         G4Exception("PrimaryGeneratorAction::SetUniformPosition()",
00766                                         "InvalidInput", FatalException,
00767                                         "cannot convert volume");
00768                 }
00769                 G4String sol_type = pSimpleGeometryParameter->get_SolidType(index);
00770                 G4ThreeVector pos(1,0,0);
00771                 G4int n = pSimpleGeometryParameter->get_RepNo(index);
00772                 G4int ivol = G4UniformRand()*n;
00773                 if ( sol_type == "Tubs" ){
00774                         G4double RMax,RMin,length,StartPhi,SpanPhi;
00775                         G4int iTubs = pSimpleGeometryParameter->get_SolidIndex(index);
00776                         RMax = pSimpleGeometryParameter->get_Tubs_RMax(iTubs,ivol);
00777                         RMin = pSimpleGeometryParameter->get_Tubs_RMin(iTubs,ivol);
00778                         length = pSimpleGeometryParameter->get_Tubs_Length(iTubs,ivol);
00779                         StartPhi = pSimpleGeometryParameter->get_Tubs_StartAng(iTubs,ivol);
00780                         SpanPhi = pSimpleGeometryParameter->get_Tubs_SpanAng(iTubs,ivol);
00781 
00782                         G4double iz, iphi, ir;
00783                         iz = G4UniformRand()*length -length/2;
00784                         iphi = G4UniformRand()*SpanPhi + StartPhi;
00785                         ir = G4UniformRand()*(RMax*RMax-RMin*RMin)+RMin*RMin;
00786                         ir = sqrt(ir);
00787                         pos.setPhi(iphi);
00788                         pos.setRho(ir);
00789                         pos.setZ(iz);
00790                 }
00791                 else{
00792                         std::cout<<"ERROR: in PrimaryGeneratorAction::SetUniformPosition unsupported solid type: "<<sol_type<<"!!!"<<std::endl;
00793                         G4Exception("PrimaryGeneratorAction::SetUniformPosition()",
00794                                         "InvalidInput", FatalException,
00795                                         "unsupported solid type");
00796                 }
00797                 G4double xp,yp,zp;
00798                 xp = pSimpleGeometryParameter->get_PosX(index,ivol);
00799                 yp = pSimpleGeometryParameter->get_PosY(index,ivol);
00800                 zp = pSimpleGeometryParameter->get_PosZ(index,ivol);
00801                 pos += G4ThreeVector(xp,yp,zp);
00802                 G4String mot_volume = pSimpleGeometryParameter->get_MotherName(index);
00803                 SimpleGeometryParameter * pmotSimpleGeometryParameter = 0;
00804                 int temp_index = index;
00805                 int mot_index = -1;
00806                 while (mot_volume!="None"){
00807                         pmotSimpleGeometryParameter = MyDetectorManager::GetMyDetectorManager()->GetParaFromVolume(mot_volume);
00808                         int mot_index = pmotSimpleGeometryParameter->get_VolIndex(mot_volume);
00809                         G4double mot_xp = pmotSimpleGeometryParameter->get_PosX(mot_index);
00810                         G4double mot_yp = pmotSimpleGeometryParameter->get_PosY(mot_index);
00811                         G4double mot_zp = pmotSimpleGeometryParameter->get_PosZ(mot_index);
00812                         pos += G4ThreeVector(mot_xp,mot_yp,mot_zp);
00813                         temp_index = mot_index;
00814                         mot_volume = pmotSimpleGeometryParameter->get_MotherName(temp_index);
00815                 }
00816                 particleGun->SetParticlePosition(pos);
00817         }
00818         else{
00819                 std::cout<<"ERROR: in PrimaryGeneratorAction::SetUniformPosition unsopported parameter class type: "<<UP_Type<<"!!!"<<std::endl;
00820                 G4Exception("PrimaryGeneratorAction::SetUniformPosition()",
00821                                 "InvalidInput", FatalException,
00822                                 "unsopported parameter class type");
00823         }
00824 }


Member Data Documentation

G4int PrimaryGeneratorAction::A [private]

Definition at line 104 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), GeneratePrimaries(), ReadCard(), and Reset().

G4int PrimaryGeneratorAction::C [private]

Definition at line 104 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), GeneratePrimaries(), ReadCard(), and Reset().

G4double PrimaryGeneratorAction::E [private]

Definition at line 105 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), GeneratePrimaries(), ReadCard(), and Reset().

G4double PrimaryGeneratorAction::Ekin [private]

Definition at line 107 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), Initialize(), ReadCard(), Reset(), and SetRandomEnergy().

Definition at line 116 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), and SetRandomEnergy().

Definition at line 109 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), Initialize(), ReadCard(), Reset(), and SetRandomEnergy().

G4double PrimaryGeneratorAction::Ephi [private]

Definition at line 126 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), and SetRandomDirection().

G4double PrimaryGeneratorAction::Epsi [private]

Definition at line 128 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), and SetRandomDirection().

G4double PrimaryGeneratorAction::Etheta [private]

Definition at line 127 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), and SetRandomDirection().

Definition at line 195 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries(), and PrimaryGeneratorAction().

Definition at line 194 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries(), and PrimaryGeneratorAction().

Definition at line 196 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries(), and PrimaryGeneratorAction().

Definition at line 199 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries().

Definition at line 191 of file PrimaryGeneratorAction.hh.

Definition at line 168 of file PrimaryGeneratorAction.hh.

Referenced by Reset(), and root_set_extra().

Definition at line 169 of file PrimaryGeneratorAction.hh.

Referenced by Reset(), and root_set_extra().

Definition at line 170 of file PrimaryGeneratorAction.hh.

Referenced by Reset(), and root_set_extra().

Definition at line 165 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 166 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 167 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 171 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 162 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 163 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 164 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 176 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 172 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 177 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 174 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_Rand().

Definition at line 175 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_Rand().

Definition at line 173 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 161 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Reset(), and root_set_extra().

Definition at line 188 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries(), and PrimaryGeneratorAction().

Definition at line 190 of file PrimaryGeneratorAction.hh.

TFile* PrimaryGeneratorAction::fp [private]

Definition at line 158 of file PrimaryGeneratorAction.hh.

Referenced by BuildHistoFromFile().

G4ParticleDefinition* PrimaryGeneratorAction::fParticle [private]

Definition at line 97 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries().

Definition at line 99 of file PrimaryGeneratorAction.hh.

Referenced by GetPrimaryGeneratorAction(), and PrimaryGeneratorAction().

G4String PrimaryGeneratorAction::fType [private]

Definition at line 102 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), GeneratePrimaries(), Initialize(), ReadCard(), and Reset().

Definition at line 181 of file PrimaryGeneratorAction.hh.

Referenced by PrimaryGeneratorAction().

Definition at line 182 of file PrimaryGeneratorAction.hh.

Referenced by PrimaryGeneratorAction().

Definition at line 180 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries(), and PrimaryGeneratorAction().

Definition at line 185 of file PrimaryGeneratorAction.hh.

Referenced by PrimaryGeneratorAction().

Definition at line 186 of file PrimaryGeneratorAction.hh.

Referenced by PrimaryGeneratorAction().

Definition at line 184 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries(), and PrimaryGeneratorAction().

Definition at line 96 of file PrimaryGeneratorAction.hh.

Referenced by PrimaryGeneratorAction(), and ~PrimaryGeneratorAction().

std::vector< G4String > MyConfigure::knownValueNames [static, inherited]
std::vector< G4String > MyConfigure::knownValues [static, inherited]
G4double PrimaryGeneratorAction::mass [private]

Definition at line 108 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries(), Initialize(), Reset(), and SetRandomEnergy().

Definition at line 115 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), GeneratePrimaries(), ReadCard(), Reset(), and SetRandomEnergy().

G4double PrimaryGeneratorAction::Pa [private]
G4ParticleGun* PrimaryGeneratorAction::particleGun [private]

Definition at line 103 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), Initialize(), ReadCard(), and Reset().

G4double PrimaryGeneratorAction::Phi [private]

Definition at line 111 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), Initialize(), ReadCard(), Reset(), and SetRandomDirection().

G4String PrimaryGeneratorAction::PhiMode [private]

Definition at line 125 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), and SetRandomDirection().

G4String PrimaryGeneratorAction::pidMode [private]

Definition at line 138 of file PrimaryGeneratorAction.hh.

Referenced by BuildHistoFromFile(), and GeneratePrimaries().

Definition at line 114 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), and SetRandomPosition().

G4double PrimaryGeneratorAction::Px [private]

Definition at line 110 of file PrimaryGeneratorAction.hh.

Referenced by Reset().

G4double PrimaryGeneratorAction::Py [private]

Definition at line 110 of file PrimaryGeneratorAction.hh.

Referenced by Reset().

G4double PrimaryGeneratorAction::Pz [private]

Definition at line 110 of file PrimaryGeneratorAction.hh.

Referenced by Reset().

Definition at line 117 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries(), Initialize(), ReadCard(), Reset(), and root_build().

Definition at line 153 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), root_build(), and set_root_filename().

Definition at line 152 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries(), Reset(), root_get_para(), and set_root_index().

Definition at line 151 of file PrimaryGeneratorAction.hh.

Referenced by Reset(), root_build(), and root_get_para().

std::string* PrimaryGeneratorAction::root_str[2] [private]

Definition at line 157 of file PrimaryGeneratorAction.hh.

Referenced by get_extra(), Initialize(), and root_set_extra().

Definition at line 154 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), and set_root_treename().

G4double PrimaryGeneratorAction::t [private]

Definition at line 112 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), Initialize(), ReadCard(), and Reset().

G4double PrimaryGeneratorAction::Theta [private]

Definition at line 111 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), Initialize(), ReadCard(), Reset(), and SetRandomDirection().

Definition at line 125 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), and SetRandomDirection().

Definition at line 143 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), and SetUniformPosition().

G4String PrimaryGeneratorAction::UP_Type [private]

Definition at line 145 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), and SetUniformPosition().

Definition at line 144 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), ReadCard(), Reset(), and SetUniformPosition().

Definition at line 149 of file PrimaryGeneratorAction.hh.

Referenced by GeneratePrimaries(), Initialize(), Reset(), and root_build().

G4double PrimaryGeneratorAction::x [private]
G4double PrimaryGeneratorAction::xSpread [private]
G4double PrimaryGeneratorAction::y [private]
G4double PrimaryGeneratorAction::ySpread [private]
G4double PrimaryGeneratorAction::z [private]
G4int PrimaryGeneratorAction::Z [private]

Definition at line 104 of file PrimaryGeneratorAction.hh.

Referenced by Dump(), GeneratePrimaries(), ReadCard(), and Reset().

G4double PrimaryGeneratorAction::zSpread [private]

The documentation for this class was generated from the following files:

Generated on 15 Jun 2016 for g4sim by  doxygen 1.6.1