CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
NuclearInteractionFTFSimulator Class Reference

#include <NuclearInteractionFTFSimulator.h>

Inheritance diagram for NuclearInteractionFTFSimulator:
MaterialEffectsSimulator

Public Member Functions

 NuclearInteractionFTFSimulator (unsigned int distAlgo, double distCut)
 Constructor. More...
 
 ~NuclearInteractionFTFSimulator ()
 Default Destructor. More...
 
- Public Member Functions inherited from MaterialEffectsSimulator
RHEP_const_iter beginDaughters () const
 Returns const iterator to the beginning of the daughters list. More...
 
int closestDaughterId ()
 The id of the closest charged daughter (filled for nuclear interactions only) More...
 
double eMass () const
 Electron mass in GeV/c2. More...
 
RHEP_const_iter endDaughters () const
 Returns const iterator to the end of the daughters list. More...
 
double excitE () const
 Mean excitation energy (in GeV) More...
 
 MaterialEffectsSimulator (double A=28.0855, double Z=14.0000, double density=2.329, double radLen=9.360)
 
unsigned nDaughters () const
 Returns the number of daughters. More...
 
XYZVector orthogonal (const XYZVector &) const
 A vector orthogonal to another one (because it's not in XYZTLorentzVector) More...
 
double radLenIncm () const
 One radiation length in cm. More...
 
double rho () const
 Density in g/cm3. More...
 
virtual void save ()
 Used by NuclearInteractionSimulator to save last sampled event. More...
 
void setNormalVector (const GlobalVector &normal)
 Sets the vector normal to the surface traversed. More...
 
double theA () const
 A. More...
 
double theZ () const
 Z. More...
 
void updateState (ParticlePropagator &myTrack, double radlen, RandomEngineAndDistribution const *)
 Compute the material effect (calls the sub class) More...
 
virtual ~MaterialEffectsSimulator ()
 

Private Member Functions

void compute (ParticlePropagator &Particle, RandomEngineAndDistribution const *)
 Generate a nuclear interaction according to the probability that it happens. More...
 
double distanceToPrimary (const RawParticle &Particle, const RawParticle &aDaughter) const
 
void saveDaughter (ParticlePropagator &Particle, const G4LorentzVector &lv, int pdgid)
 

Private Attributes

G4LorentzVector curr4Mom
 
int currIdx
 
const G4ParticleDefinition * currParticle
 
G4Track * currTrack
 
double distMin
 
G4Step * dummyStep
 
int numHadrons
 
G4Nucleus targetNucleus
 
G4ThreeVector theBoost
 
G4GeneratorPrecompoundInterface * theCascade
 
unsigned int theDistAlgo
 
double theDistCut
 
double theEnergyLimit
 
std::vector< const
G4ParticleDefinition * > 
theG4Hadron
 
G4TheoFSGenerator * theHadronicModel
 
std::vector< int > theId
 
G4LundStringFragmentation * theLund
 
std::vector< double > theNuclIntLength
 
G4HadProjectile theProjectile
 
G4ExcitedStringDecay * theStringDecay
 
G4FTFModel * theStringModel
 
G4ThreeVector vectProj
 

Additional Inherited Members

- Public Types inherited from MaterialEffectsSimulator
typedef std::vector
< RawParticle >
::const_iterator 
RHEP_const_iter
 
- Protected Attributes inherited from MaterialEffectsSimulator
std::vector< RawParticle_theUpdatedState
 
double A
 
double density
 
double radLen
 
double radLengths
 
int theClosestChargedDaughterId
 
GlobalVector theNormalVector
 
double Z
 

Detailed Description

Definition at line 36 of file NuclearInteractionFTFSimulator.h.

Constructor & Destructor Documentation

NuclearInteractionFTFSimulator::NuclearInteractionFTFSimulator ( unsigned int  distAlgo,
double  distCut 
)

Constructor.

Definition at line 63 of file NuclearInteractionFTFSimulator.cc.

References currIdx, currParticle, currTrack, dummyStep, GeV, i, numHadrons, targetNucleus, theBoost, theEnergyLimit, theG4Hadron, theHadronicModel, theId, theLund, theNuclIntLength, theStringDecay, theStringModel, and vectProj.

65  :
67  distMin(1E99),
68  theDistAlgo(distAlgo)
69 {
71  currIdx = 0;
72 
73  // FTF model
74  theHadronicModel = new G4TheoFSGenerator("FTF");
75  theStringModel = new G4FTFModel();
76  G4GeneratorPrecompoundInterface* cascade
77  = new G4GeneratorPrecompoundInterface(new CMSDummyDeexcitation());
78  theLund = new G4LundStringFragmentation();
79  theStringDecay = new G4ExcitedStringDecay(theLund);
80  theStringModel->SetFragmentationModel(theStringDecay);
81 
82  theHadronicModel->SetTransport(cascade);
83  theHadronicModel->SetHighEnergyGenerator(theStringModel);
84  theHadronicModel->SetMinEnergy(theEnergyLimit);
85 
86  // Geant4 particles
87  numHadrons = 30;
88  theG4Hadron.resize(numHadrons,0);
89  theG4Hadron[0] = G4Proton::Proton();
90  theG4Hadron[1] = G4Neutron::Neutron();
91  theG4Hadron[2] = G4PionPlus::PionPlus();
92  theG4Hadron[3] = G4PionMinus::PionMinus();
93  theG4Hadron[4] = G4AntiProton::AntiProton();
94  theG4Hadron[5] = G4KaonPlus::KaonPlus();
95  theG4Hadron[6] = G4KaonMinus::KaonMinus();
96  theG4Hadron[7] = G4KaonZeroLong::KaonZeroLong();
97  theG4Hadron[8] = G4KaonZeroShort::KaonZeroShort();
98  theG4Hadron[9] = G4KaonZero::KaonZero();
99  theG4Hadron[10]= G4AntiKaonZero::AntiKaonZero();
100  theG4Hadron[11]= G4Lambda::Lambda();
101  theG4Hadron[12]= G4OmegaMinus::OmegaMinus();
102  theG4Hadron[13]= G4SigmaMinus::SigmaMinus();
103  theG4Hadron[14]= G4SigmaPlus::SigmaPlus();
104  theG4Hadron[15]= G4SigmaZero::SigmaZero();
105  theG4Hadron[16]= G4XiMinus::XiMinus();
106  theG4Hadron[17]= G4XiZero::XiZero();
107  theG4Hadron[18]= G4AntiNeutron::AntiNeutron();
108  theG4Hadron[19]= G4AntiLambda::AntiLambda();
109  theG4Hadron[20]= G4AntiOmegaMinus::AntiOmegaMinus();
110  theG4Hadron[21]= G4AntiSigmaMinus::AntiSigmaMinus();
111  theG4Hadron[22]= G4AntiSigmaPlus::AntiSigmaPlus();
112  theG4Hadron[23]= G4AntiSigmaZero::AntiSigmaZero();
113  theG4Hadron[24]= G4AntiXiMinus::AntiXiMinus();
114  theG4Hadron[25]= G4AntiXiZero::AntiXiZero();
115  theG4Hadron[26]= G4AntiAlpha::AntiAlpha();
116  theG4Hadron[27]= G4AntiDeuteron::AntiDeuteron();
117  theG4Hadron[28]= G4AntiTriton::AntiTriton();
118  theG4Hadron[29]= G4AntiHe3::AntiHe3();
119 
120  G4GenericIon::GenericIon();
121  G4DecayPhysics decays;
122  decays.ConstructParticle();
123  G4ParticleTable* partTable = G4ParticleTable::GetParticleTable();
124  partTable->SetReadiness();
125 
126  // interaction length in units of radiation length
127  // computed for 5 GeV projectile energy, default value for K0_L
128  theNuclIntLength.resize(numHadrons,6.46);
129  theNuclIntLength[0] = 4.528;
130  theNuclIntLength[1] = 4.524;
131  theNuclIntLength[2] = 4.493;
132  theNuclIntLength[3] = 4.493;
133  theNuclIntLength[4] = 3.593;
134  theNuclIntLength[5] = 7.154;
135  theNuclIntLength[6] = 5.889;
136  theNuclIntLength[11]= 4.986;
137  theNuclIntLength[12]= 4.983;
138  theNuclIntLength[13]= 4.986;
139  theNuclIntLength[14]= 4.986;
140  theNuclIntLength[15]= 4.986;
141  theNuclIntLength[16]= 4.986;
142  theNuclIntLength[17]= 4.986;
143  theNuclIntLength[18]= 3.597;
144  theNuclIntLength[19]= 3.608;
145  theNuclIntLength[20]= 3.639;
146  theNuclIntLength[21]= 3.613;
147  theNuclIntLength[22]= 3.613;
148  theNuclIntLength[23]= 3.613;
149  theNuclIntLength[24]= 3.62;
150  theNuclIntLength[25]= 3.62;
151  theNuclIntLength[26]= 1.971;
152  theNuclIntLength[27]= 2.301;
153  theNuclIntLength[28]= 1.997;
154  theNuclIntLength[29]= 1.997;
155 
156  // list of PDG codes
157  theId.resize(numHadrons,0);
158 
159  // local objects
160  currIdx = 0;
161  currTrack = 0;
163  vectProj.set(0.0,0.0,1.0);
164  theBoost.set(0.0,0.0,1.0);
165 
166  // fill projectile particle definitions
167  dummyStep = new G4Step();
168  dummyStep->SetPreStepPoint(new G4StepPoint());
169  for(int i=0; i<numHadrons; ++i) {
170  theId[i] = theG4Hadron[i]->GetPDGEncoding();
171  }
172 
173  // target is always Silicon
174  targetNucleus.SetParameters(28, 14);
175 }
int i
Definition: DBlmapReader.cc:9
const double GeV
Definition: MathUtil.h:16
std::vector< const G4ParticleDefinition * > theG4Hadron
const G4ParticleDefinition * currParticle
NuclearInteractionFTFSimulator::~NuclearInteractionFTFSimulator ( )

Default Destructor.

Definition at line 177 of file NuclearInteractionFTFSimulator.cc.

References theLund, theStringDecay, and theStringModel.

177  {
178 
179  delete theStringDecay;
180  delete theStringModel;
181  delete theLund;
182 }

Member Function Documentation

void NuclearInteractionFTFSimulator::compute ( ParticlePropagator Particle,
RandomEngineAndDistribution const *  random 
)
privatevirtual

Generate a nuclear interaction according to the probability that it happens.

Implements MaterialEffectsSimulator.

Definition at line 184 of file NuclearInteractionFTFSimulator.cc.

References MaterialEffectsSimulator::_theUpdatedState, funct::cos(), curr4Mom, currIdx, currParticle, currTrack, dir, distMin, dummyStep, alignCSCRings::e, RandomEngineAndDistribution::flatShoot(), GeV, j, RawParticle::momentum(), numHadrons, phi, RawParticle::pid(), MaterialEffectsSimulator::radLengths, query::result, saveDaughter(), funct::sin(), mathSSE::sqrt(), targetNucleus, theBoost, MaterialEffectsSimulator::theClosestChargedDaughterId, theEnergyLimit, theG4Hadron, theHadronicModel, theId, theNuclIntLength, theProjectile, and vectProj.

186 {
187  //std::cout << "#### Primary " << Particle.pid() << " E(GeV)= "
188  // << Particle.momentum().e() << std::endl;
189 
190  int thePid = Particle.pid();
191  if(thePid != theId[currIdx]) {
192  currParticle = 0;
193  currIdx = 0;
194  for(; currIdx<numHadrons; ++currIdx) {
195  if(theId[currIdx] == thePid) {
197  // neutral kaons
198  if(7 == currIdx || 8 == currIdx) {
200  if(random->flatShoot() > 0.5) { currParticle = theG4Hadron[10]; }
201  }
202  break;
203  }
204  }
205  }
206  if(!currParticle) { return; }
207 
208  // fill projectile for Geant4
209  double e = CLHEP::GeV*Particle.momentum().e();
210  double mass = currParticle->GetPDGMass();
211  /*
212  std::cout << " Primary " << currParticle->GetParticleName()
213  << " E(GeV)= " << e*fact << std::endl;
214  */
215  if(e <= theEnergyLimit + mass) { return; }
216 
217  double currInteractionLength = -G4Log(random->flatShoot())*theNuclIntLength[currIdx];
218  /*
219  std::cout << "*NuclearInteractionFTFSimulator::compute: R(X0)= " << radLengths
220  << " Rnuc(X0)= " << theNuclIntLength[currIdx] << " IntLength(X0)= "
221  << currInteractionLength << std::endl;
222  */
223  // Check position of nuclear interaction
224  if (currInteractionLength > radLengths) { return; }
225 
226  // fill projectile for Geant4
227  double px = Particle.momentum().px();
228  double py = Particle.momentum().py();
229  double pz = Particle.momentum().pz();
230  double norm = 1.0/sqrt(px*px + py*py + pz*pz);
231  G4ThreeVector dir(px*norm, py*norm, pz*norm);
232  /*
233  std::cout << " Primary " << currParticle->GetParticleName()
234  << " E(GeV)= " << e*fact << " P(GeV/c)= ("
235  << px << " " << py << " " << pz << ")" << std::endl;
236  */
237 
238  G4DynamicParticle* dynParticle = new G4DynamicParticle(theG4Hadron[currIdx],dir,e-mass);
239  currTrack = new G4Track(dynParticle, 0.0, vectProj);
240  currTrack->SetStep(dummyStep);
241 
242  theProjectile.Initialise(*currTrack);
243  delete currTrack;
244 
245  G4HadFinalState* result = theHadronicModel->ApplyYourself(theProjectile, targetNucleus);
246 
247  if(result) {
248 
249  int nsec = result->GetNumberOfSecondaries();
250  if(0 < nsec) {
251 
252  result->SetTrafoToLab(theProjectile.GetTrafoToLab());
253  _theUpdatedState.clear();
254 
255  //std::cout << " " << nsec << " secondaries" << std::endl;
256  // Generate angle
257  double phi = random->flatShoot()*CLHEP::twopi;
259  distMin = 1e99;
260 
261  // rotate and store secondaries
262  for (int j=0; j<nsec; ++j) {
263 
264  const G4DynamicParticle* dp = result->GetSecondary(j)->GetParticle();
265  int thePid = dp->GetParticleDefinition()->GetPDGEncoding();
266 
267  // rotate around primary direction
268  curr4Mom = dp->Get4Momentum();
269  curr4Mom.rotate(phi, vectProj);
270  curr4Mom *= result->GetTrafoToLab();
271  /*
272  std::cout << j << ". " << dp->GetParticleDefinition()->GetParticleName()
273  << " " << thePid
274  << " " << curr4Mom*fact << std::endl;
275  */
276  // prompt 2-gamma decay for pi0, eta, eta'p
277  if(111 == thePid || 221 == thePid || 331 == thePid) {
278  theBoost = curr4Mom.boostVector();
279  double e = 0.5*dp->GetParticleDefinition()->GetPDGMass();
280  double fi = random->flatShoot()*CLHEP::twopi;
281  double cth = 2*random->flatShoot() - 1.0;
282  double sth = sqrt((1.0 - cth)*(1.0 + cth));
283  G4LorentzVector lv(e*sth*cos(fi),e*sth*sin(fi),e*cth,e);
284  lv.boost(theBoost);
285  saveDaughter(Particle, lv, 22);
286  curr4Mom -= lv;
287  saveDaughter(Particle, curr4Mom, 22);
288  } else {
289  saveDaughter(Particle, curr4Mom, thePid);
290  }
291  }
292  }
293  }
294 }
const double GeV
Definition: MathUtil.h:16
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int pid() const
get the HEP particle ID number
Definition: RawParticle.h:265
TRandom random
Definition: MVATrainer.cc:138
const XYZTLorentzVector & momentum() const
the momentum fourvector
Definition: RawParticle.h:286
void saveDaughter(ParticlePropagator &Particle, const G4LorentzVector &lv, int pdgid)
T sqrt(T t)
Definition: SSEVec.h:48
tuple result
Definition: query.py:137
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< const G4ParticleDefinition * > theG4Hadron
int j
Definition: DBlmapReader.cc:9
const G4ParticleDefinition * currParticle
std::vector< RawParticle > _theUpdatedState
dbl *** dir
Definition: mlp_gen.cc:35
Definition: DDAxes.h:10
double NuclearInteractionFTFSimulator::distanceToPrimary ( const RawParticle Particle,
const RawParticle aDaughter 
) const
private

Definition at line 315 of file NuclearInteractionFTFSimulator.cc.

References RawParticle::charge(), HLT_25ns14e33_v1_cff::distance, and theDistAlgo.

Referenced by saveDaughter().

317 {
318  double distance = 2E99;
319  // Compute the distance only for charged primaries
320  if ( fabs(Particle.charge()) > 1E-6 ) {
321 
322  // The secondary must have the same charge
323  double chargeDiff = fabs(aDaughter.charge()-Particle.charge());
324  if ( fabs(chargeDiff) < 1E-6 ) {
325 
326  // Here are two distance definitions * to be tuned *
327  switch ( theDistAlgo ) {
328 
329  case 1:
330  // sin(theta12)
331  distance = (aDaughter.Vect().Unit().Cross(Particle.Vect().Unit())).R();
332  break;
333 
334  case 2:
335  // sin(theta12) * p1/p2
336  distance = (aDaughter.Vect().Cross(Particle.Vect())).R()
337  /aDaughter.Vect().Mag2();
338  break;
339 
340  default:
341  // Should not happen
342  break;
343  }
344  }
345  }
346  return distance;
347 }
double charge() const
get the MEASURED charge
Definition: RawParticle.h:282
void NuclearInteractionFTFSimulator::saveDaughter ( ParticlePropagator Particle,
const G4LorentzVector &  lv,
int  pdgid 
)
private

Definition at line 296 of file NuclearInteractionFTFSimulator.cc.

References MaterialEffectsSimulator::_theUpdatedState, HLT_25ns14e33_v1_cff::distance, distanceToPrimary(), distMin, fact, customizeTrackingMonitorSeedNumber::idx, MaterialEffectsSimulator::theClosestChargedDaughterId, and theDistCut.

Referenced by compute().

298 {
299  unsigned int idx = _theUpdatedState.size();
300  _theUpdatedState.push_back(Particle);
301  _theUpdatedState[idx].SetXYZT(lv.px()*fact,lv.py()*fact,lv.pz()*fact,lv.e()*fact);
302  _theUpdatedState[idx].setID(pdgid);
303 
304  // Store the closest daughter index (for later tracking purposes, so charged particles only)
305  double distance = distanceToPrimary(Particle,_theUpdatedState[idx]);
306  // Find the closest daughter, if closer than a given upper limit.
307  if ( distance < distMin && distance < theDistCut ) {
308  distMin = distance;
310  }
311  // std::cout << _theUpdatedState[idx] << std::endl;
312 }
double distanceToPrimary(const RawParticle &Particle, const RawParticle &aDaughter) const
const double fact
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::vector< RawParticle > _theUpdatedState

Member Data Documentation

G4LorentzVector NuclearInteractionFTFSimulator::curr4Mom
private

Definition at line 72 of file NuclearInteractionFTFSimulator.h.

Referenced by compute().

int NuclearInteractionFTFSimulator::currIdx
private

Definition at line 82 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

const G4ParticleDefinition* NuclearInteractionFTFSimulator::currParticle
private

Definition at line 68 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

G4Track* NuclearInteractionFTFSimulator::currTrack
private

Definition at line 67 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

double NuclearInteractionFTFSimulator::distMin
private

Definition at line 79 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and saveDaughter().

G4Step* NuclearInteractionFTFSimulator::dummyStep
private

Definition at line 66 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

int NuclearInteractionFTFSimulator::numHadrons
private

Definition at line 81 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

G4Nucleus NuclearInteractionFTFSimulator::targetNucleus
private

Definition at line 70 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

G4ThreeVector NuclearInteractionFTFSimulator::theBoost
private

Definition at line 74 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

G4GeneratorPrecompoundInterface* NuclearInteractionFTFSimulator::theCascade
private

Definition at line 64 of file NuclearInteractionFTFSimulator.h.

unsigned int NuclearInteractionFTFSimulator::theDistAlgo
private

Definition at line 83 of file NuclearInteractionFTFSimulator.h.

Referenced by distanceToPrimary().

double NuclearInteractionFTFSimulator::theDistCut
private

Definition at line 78 of file NuclearInteractionFTFSimulator.h.

Referenced by saveDaughter().

double NuclearInteractionFTFSimulator::theEnergyLimit
private

Definition at line 76 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

std::vector<const G4ParticleDefinition*> NuclearInteractionFTFSimulator::theG4Hadron
private

Definition at line 56 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

G4TheoFSGenerator* NuclearInteractionFTFSimulator::theHadronicModel
private

Definition at line 60 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

std::vector<int> NuclearInteractionFTFSimulator::theId
private

Definition at line 58 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

G4LundStringFragmentation* NuclearInteractionFTFSimulator::theLund
private
std::vector<double> NuclearInteractionFTFSimulator::theNuclIntLength
private

Definition at line 57 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().

G4HadProjectile NuclearInteractionFTFSimulator::theProjectile
private

Definition at line 71 of file NuclearInteractionFTFSimulator.h.

Referenced by compute().

G4ExcitedStringDecay* NuclearInteractionFTFSimulator::theStringDecay
private
G4FTFModel* NuclearInteractionFTFSimulator::theStringModel
private
G4ThreeVector NuclearInteractionFTFSimulator::vectProj
private

Definition at line 73 of file NuclearInteractionFTFSimulator.h.

Referenced by compute(), and NuclearInteractionFTFSimulator().