CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
fastsim::NuclearInteraction Class Reference

Implementation of nuclear interactions of hadrons in the tracker layers (based on fully simulated interactions). More...

Inheritance diagram for fastsim::NuclearInteraction:
fastsim::InteractionModel

Public Member Functions

void interact (fastsim::Particle &particle, const SimplifiedGeometry &layer, std::vector< std::unique_ptr< fastsim::Particle > > &secondaries, const RandomEngineAndDistribution &random) override
 Perform the interaction. More...
 
 NuclearInteraction (const std::string &name, const edm::ParameterSet &cfg)
 Constructor. More...
 
 ~NuclearInteraction () override
 Default destructor. More...
 
- Public Member Functions inherited from fastsim::InteractionModel
const std::string getName ()
 Return (unique) name of this interaction. More...
 
 InteractionModel (std::string name)
 Constructor. More...
 
virtual void registerProducts (edm::ProducerBase &producer) const
 In case interaction produces and stores content in the event (e.g. TrackerSimHits). More...
 
virtual void storeProducts (edm::Event &iEvent)
 In case interaction produces and stores content in the event (e.g. TrackerSimHits). More...
 
virtual ~InteractionModel ()
 Default destructor. More...
 

Private Member Functions

unsigned index (int thePid)
 Return a hashed index for a given particle ID. More...
 
XYZVector orthogonal (const XYZVector &aVector) const
 Return an orthogonal vector. More...
 
bool read (std::string inputFile)
 Read the nuclear interactions from a file, so you can reproduce the events (e.g. in case of a crash). More...
 
void save ()
 Save the nuclear interactions to a file, so you can reproduce the events (e.g. in case of a crash). More...
 

Private Attributes

const std::vector< int > antineutronsID = {-2112, -3122, -3112, -3312, -3322}
 PdgID of anti-neutrons. More...
 
const std::vector< int > antiprotonsID = {-2212, -3222}
 PdgID of anti-protons. More...
 
bool currentValuesWereSet
 Read data from file that was created in a previous run. More...
 
unsigned ien4
 Find the index for which EN = 4. More...
 
std::string inputFile
 Directory/Name of input file in case you want to read interactions from file. More...
 
const std::vector< int > K0LsID = {130, 310}
 PdgID of K0. More...
 
const std::vector< int > KminussesID = {-321}
 PdgID of K-. More...
 
const std::vector< int > KplussesID = {321}
 PdgID of K+. More...
 
unsigned myOutputBuffer
 Needed to save interactions to file. More...
 
std::ofstream myOutputFile
 Output file to save interactions. More...
 
const std::vector< int > neutronsID = {2112, 3122, 3112, 3312, 3322, 3334, -3334}
 PdgID of neutrons. More...
 
const std::vector< int > PiminussesID = {-211}
 PdgID of pi-. More...
 
const std::vector< int > PiplussesID = {211}
 PdgID of pt+. More...
 
const std::vector< int > protonsID = {2212, 3222, -101, -102, -103, -104}
 PdgID of protons. More...
 
std::vector< std::vector< TBranch * > > theBranches
 Necessary to read the FullSim interactions. More...
 
std::vector< std::vector< unsigned > > theCurrentEntry
 Necessary to read the FullSim interactions. More...
 
std::vector< std::vector< unsigned > > theCurrentInteraction
 Necessary to read the FullSim interactions. More...
 
double theDistCut
 Cut on deltaR for the FastSim Tracking (ClosestChargedDaughter algorithm) More...
 
TFile * theFile = 0
 Necessary to read the FullSim interactions. More...
 
std::vector< std::vector< std::string > > theFileNames
 Necessary to read the FullSim interactions. More...
 
std::vector< std::vector< double > > theHadronCM
 Necessary to read the FullSim interactions. More...
 
const std::vector< double > theHadronEN = {1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 12.0, 15.0, 20.0, 30.0, 50.0, 100.0, 200.0, 300.0, 500.0, 700.0, 1000.0}
 Filled into 'theRatiosMap' (evolution of the interaction lengths with energy) More...
 
double theHadronEnergy
 Minimum energy for nuclear interaction. More...
 
const std::vector< int > theHadronID = {211, -211, 130, 321, -321, 2212, -2212, 2112, -2112}
 ID of the hadrons. More...
 
const std::vector< double > theHadronMA = {0.13957, 0.13957, 0.497648, 0.493677, 0.493677, 0.93827, 0.93827, 0.939565, 0.939565}
 Masses of the hadrons. More...
 
const std::vector< std::string > theHadronNA = {"piplus", "piminus", "K0L", "Kplus", "Kminus", "p", "pbar", "n", "nbar"}
 Names of the hadrons. More...
 
const std::vector< double > theHadronPMin = {0.7, 0.0, 1.0, 1.0, 0.0, 1.1, 0.0, 1.1, 0.0}
 Smallest momentum for inelastic interactions. More...
 
const std::vector< double > theLengthRatio
 Inelastic interaction length at p(Hadron) = 5 GeV/c (relativ to radionLength of material) More...
 
std::vector< std::vector< NUEvent * > > theNUEvents
 Necessary to read the FullSim interactions. More...
 
std::vector< std::vector< unsigned > > theNumberOfEntries
 Necessary to read the FullSim interactions. More...
 
std::vector< std::vector< unsigned > > theNumberOfInteractions
 Necessary to read the FullSim interactions. More...
 
const std::vector< double > theRatios
 Filled into 'theRatiosMap' (evolution of the interaction lengths with energy) More...
 
std::vector< std::vector< TTree * > > theTrees
 Necessary to read the FullSim interactions. More...
 

Static Private Attributes

static std::map< int, int > theIDMap
 Build the ID map (i.e., what is to be considered as a proton, etc...) More...
 
static std::vector< std::vector< double > > theRatiosMap
 The evolution of the interaction lengths with energy. More...
 

Detailed Description

Implementation of nuclear interactions of hadrons in the tracker layers (based on fully simulated interactions).

Computes the probability for hadrons to interact with a nucleon of the tracker material (inelastically) and then reads a nuclear interaction randomly from multiple fully simulated files. Also, another implementation of nuclear interactions can be used that is based on G4 (NuclearInteractionFTF).

Definition at line 59 of file NuclearInteraction.cc.

Constructor & Destructor Documentation

fastsim::NuclearInteraction::NuclearInteraction ( const std::string &  name,
const edm::ParameterSet cfg 
)

Constructor.

Definition at line 208 of file NuclearInteraction.cc.

References antineutronsID, antiprotonsID, gather_cfg::cout, currentValuesWereSet, Exception, corrVsCorr::filename, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, triggerObjects_cff::id, ien4, inputFile, K0LsID, KminussesID, KplussesID, myOutputBuffer, myOutputFile, neutronsID, PiminussesID, PiplussesID, protonsID, read(), TrajectoryFactories_cff::Reference, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, theBranches, theCurrentEntry, theCurrentInteraction, theDistCut, theFile, theFileNames, theHadronCM, theHadronEN, theHadronEnergy, theHadronID, theHadronMA, theHadronNA, theIDMap, theNUEvents, theNumberOfEntries, theNumberOfInteractions, theRatios, theRatiosMap, and theTrees.

210  , currentValuesWereSet(false)
211 {
212  // Full path to FullSim root file
213  std::string fullPath;
214 
215  // Read from config file
216  theDistCut = cfg.getParameter<double>("distCut");
217  theHadronEnergy = cfg.getParameter<double>("hadronEnergy");
218  inputFile = cfg.getUntrackedParameter<std::string>("inputFile","");
219 
220  // The evolution of the interaction lengths with energy
221  theRatiosMap.resize(theHadronID.size());
222  for(unsigned i=0; i<theHadronID.size(); ++i){
223  for(unsigned j=0; j<theHadronEN.size(); ++j){
224  theRatiosMap[i].push_back(theRatios[i*theHadronEN.size() + j]);
225  }
226  }
227 
228  // Build the ID map (i.e., what is to be considered as a proton, etc...)
229  // Protons
230  for(const auto & id : protonsID) theIDMap[id] = 2212;
231  // Anti-Protons
232  for(const auto & id : antiprotonsID) theIDMap[id] = -2212;
233  // Neutrons
234  for(const auto & id : neutronsID) theIDMap[id] = 2112;
235  // Anti-Neutrons
236  for(const auto & id : antineutronsID) theIDMap[id] = -2112;
237  // K0L's
238  for(const auto & id : K0LsID) theIDMap[id] = 130;
239  // K+'s
240  for(const auto & id : KplussesID) theIDMap[id] = 321;
241  // K-'s
242  for(const auto & id : KminussesID) theIDMap[id] = -321;
243  // pi+'s
244  for(const auto & id : PiplussesID) theIDMap[id] = 211;
245  // pi-'s
246  for(const auto & id : PiminussesID) theIDMap[id] = -211;
247 
248  // Prepare the map of files
249  // Loop over the particle names
250  TFile* aVFile=nullptr;
251  std::vector<TTree*> aVTree(theHadronEN.size());
252  std::vector<TBranch*> aVBranch(theHadronEN.size());
253  std::vector<NUEvent*> aVNUEvents(theHadronEN.size());
254  std::vector<unsigned> aVCurrentEntry(theHadronEN.size());
255  std::vector<unsigned> aVCurrentInteraction(theHadronEN.size());
256  std::vector<unsigned> aVNumberOfEntries(theHadronEN.size());
257  std::vector<unsigned> aVNumberOfInteractions(theHadronEN.size());
258  std::vector<std::string> aVFileName(theHadronEN.size());
259  std::vector<double> aVHadronCM(theHadronEN.size());
260  theTrees.resize(theHadronNA.size());
261  theBranches.resize(theHadronNA.size());
262  theNUEvents.resize(theHadronNA.size());
263  theCurrentEntry.resize(theHadronNA.size());
264  theCurrentInteraction.resize(theHadronNA.size());
265  theNumberOfEntries.resize(theHadronNA.size());
266  theNumberOfInteractions.resize(theHadronNA.size());
267  theFileNames.resize(theHadronNA.size());
268  theHadronCM.resize(theHadronNA.size());
269  theFile = aVFile;
270  for(unsigned iname=0; iname<theHadronNA.size(); ++iname){
271  theTrees[iname] = aVTree;
272  theBranches[iname] = aVBranch;
273  theNUEvents[iname] = aVNUEvents;
274  theCurrentEntry[iname] = aVCurrentEntry;
275  theCurrentInteraction[iname] = aVCurrentInteraction;
276  theNumberOfEntries[iname] = aVNumberOfEntries;
277  theNumberOfInteractions[iname] = aVNumberOfInteractions;
278  theFileNames[iname] = aVFileName;
279  theHadronCM[iname] = aVHadronCM;
280  }
281 
282  // Read the information from a previous run (to keep reproducibility)
283  currentValuesWereSet = this->read(inputFile);
285  std::cout << "***WARNING*** You are reading nuclear-interaction information from the file "
286  << inputFile << " created in an earlier run."
287  << std::endl;
288 
289  // Open the file for saving the information of the current run
290  myOutputFile.open("NuclearInteractionOutputFile.txt");
291  myOutputBuffer = 0;
292 
293  // Open the root file
294  edm::FileInPath myDataFile("FastSimulation/MaterialEffects/data/NuclearInteractions.root");
295  fullPath = myDataFile.fullPath();
296  theFile = TFile::Open(fullPath.c_str());
297 
298  // Open the trees
299  unsigned fileNb = 0;
300  for(unsigned iname=0; iname<theHadronNA.size(); ++iname){
301  for(unsigned iene=0; iene<theHadronEN.size(); ++iene){
302  std::ostringstream filename;
303  double theEne = theHadronEN[iene];
304  filename << "NuclearInteractionsVal_" << theHadronNA[iname] << "_E"<< theEne << ".root";
305  theFileNames[iname][iene] = filename.str();
306 
307  ++fileNb;
308  std::string treeName="NuclearInteractions_"+theHadronNA[iname]+"_E"+std::to_string(int(theEne));
309  theTrees[iname][iene] = (TTree*) theFile->Get(treeName.c_str());
310 
311  if ( !theTrees[iname][iene] ) throw cms::Exception("FastSimulation/MaterialEffects")
312  << "Tree with name " << treeName << " not found ";
313  theBranches[iname][iene] = theTrees[iname][iene]->GetBranch("nuEvent");
314  if ( !theBranches[iname][iene] ) throw cms::Exception("FastSimulation/MaterialEffects")
315  << "Branch with name nuEvent not found in " << theFileNames[iname][iene];
316 
317  theNUEvents[iname][iene] = new NUEvent();
318  theBranches[iname][iene]->SetAddress(&theNUEvents[iname][iene]);
319  theNumberOfEntries[iname][iene] = theTrees[iname][iene]->GetEntries();
320 
322  theTrees[iname][iene]->GetEntry(theCurrentEntry[iname][iene]);
323  unsigned NInteractions = theNUEvents[iname][iene]->nInteractions();
324  theNumberOfInteractions[iname][iene] = NInteractions;
325  }
326 
327  // Compute the corresponding cm energies of the nuclear interactions
328  XYZTLorentzVector Proton(0.,0.,0.,0.986);
330  0.,
331  std::sqrt(theHadronEN[iene]*theHadronEN[iene]-theHadronMA[iname]*theHadronMA[iname]),
332  theHadronEN[iene]);
333  theHadronCM[iname][iene] = (Reference+Proton).M();
334  }
335  }
336 
337  // Find the index for which EN = 4. (or thereabout)
338  ien4 = 0;
339  while(theHadronEN[ien4] < 4.0) ++ien4;
340 
341  gROOT->cd();
342 }
const std::vector< int > antineutronsID
PdgID of anti-neutrons.
const std::vector< int > PiplussesID
PdgID of pt+.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double theDistCut
Cut on deltaR for the FastSim Tracking (ClosestChargedDaughter algorithm)
const std::vector< int > KminussesID
PdgID of K-.
std::vector< std::vector< TTree * > > theTrees
Necessary to read the FullSim interactions.
bool currentValuesWereSet
Read data from file that was created in a previous run.
std::vector< std::vector< unsigned > > theNumberOfEntries
Necessary to read the FullSim interactions.
const std::vector< int > KplussesID
PdgID of K+.
TFile * theFile
Necessary to read the FullSim interactions.
static std::vector< std::vector< double > > theRatiosMap
The evolution of the interaction lengths with energy.
std::vector< std::vector< NUEvent * > > theNUEvents
Necessary to read the FullSim interactions.
const std::vector< int > protonsID
PdgID of protons.
Base class for any interaction model between a particle and a tracker layer.
const std::vector< double > theRatios
Filled into &#39;theRatiosMap&#39; (evolution of the interaction lengths with energy)
const std::vector< int > K0LsID
PdgID of K0.
Definition: NUEvent.h:6
std::vector< std::vector< std::string > > theFileNames
Necessary to read the FullSim interactions.
const std::vector< int > antiprotonsID
PdgID of anti-protons.
static std::map< int, int > theIDMap
Build the ID map (i.e., what is to be considered as a proton, etc...)
std::vector< std::vector< unsigned > > theNumberOfInteractions
Necessary to read the FullSim interactions.
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< std::vector< unsigned > > theCurrentInteraction
Necessary to read the FullSim interactions.
std::ofstream myOutputFile
Output file to save interactions.
const std::vector< int > neutronsID
PdgID of neutrons.
std::vector< std::vector< double > > theHadronCM
Necessary to read the FullSim interactions.
double theHadronEnergy
Minimum energy for nuclear interaction.
std::vector< std::vector< unsigned > > theCurrentEntry
Necessary to read the FullSim interactions.
std::vector< std::vector< TBranch * > > theBranches
Necessary to read the FullSim interactions.
bool read(std::string inputFile)
Read the nuclear interactions from a file, so you can reproduce the events (e.g. in case of a crash)...
unsigned ien4
Find the index for which EN = 4.
const std::vector< double > theHadronMA
Masses of the hadrons.
const std::vector< int > PiminussesID
PdgID of pi-.
const std::vector< double > theHadronEN
Filled into &#39;theRatiosMap&#39; (evolution of the interaction lengths with energy)
const std::vector< int > theHadronID
ID of the hadrons.
std::string inputFile
Directory/Name of input file in case you want to read interactions from file.
const std::vector< std::string > theHadronNA
Names of the hadrons.
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15
unsigned myOutputBuffer
Needed to save interactions to file.
fastsim::NuclearInteraction::~NuclearInteraction ( )
override

Default destructor.

Definition at line 344 of file NuclearInteraction.cc.

References myOutputFile, save(), theFile, and theNUEvents.

344  {
345  // Close all local files
346  // Among other things, this allows the TROOT destructor to end up
347  // without crashing, while trying to close these files from outside
348  theFile->Close();
349  delete theFile;
350 
351  for(auto& vEvents: theNUEvents){
352  for(auto evtPtr: vEvents){
353  delete evtPtr;
354  }
355  }
356 
357  // Save data
358  save();
359  // Close the output file
360  myOutputFile.close();
361 }
TFile * theFile
Necessary to read the FullSim interactions.
std::vector< std::vector< NUEvent * > > theNUEvents
Necessary to read the FullSim interactions.
std::ofstream myOutputFile
Output file to save interactions.
void save()
Save the nuclear interactions to a file, so you can reproduce the events (e.g. in case of a crash)...

Member Function Documentation

unsigned fastsim::NuclearInteraction::index ( int  thePid)
private

Return a hashed index for a given particle ID.

Definition at line 765 of file NuclearInteraction.cc.

References theHadronID.

Referenced by BeautifulSoup.PageElement::insert(), and interact().

766 {
767  // Find hashed particle ID
768  unsigned myIndex=0;
769  while(thePid != theHadronID[myIndex]) ++myIndex;
770  return myIndex;
771 }
const std::vector< int > theHadronID
ID of the hadrons.
void fastsim::NuclearInteraction::interact ( fastsim::Particle particle,
const SimplifiedGeometry layer,
std::vector< std::unique_ptr< fastsim::Particle > > &  secondaries,
const RandomEngineAndDistribution random 
)
overridevirtual

Perform the interaction.

Parameters
particleThe particle that interacts with the matter.
layerThe detector layer that interacts with the particle.
secondariesParticles that are produced in the interaction (if any).
randomThe Random Engine.

Implements fastsim::InteractionModel.

Definition at line 364 of file NuclearInteraction.cc.

References patCaloMETCorrections_cff::A, funct::abs(), fastsim::Particle::charge(), currentValuesWereSet, JetChargeProducer_cfi::exp, NUEvent::NUInteraction::first, RandomEngineAndDistribution::flatShoot(), fastsim::SimplifiedGeometry::getNuclearInteractionThicknessFactor(), fastsim::SimplifiedGeometry::getThickness(), NUEvent::NUParticle::id, ien4, index(), NUEvent::NUInteraction::last, cmsBatch::log, M_PI, NUEvent::NUParticle::mass, fastsim::Particle::momentum(), orthogonal(), common_cff::pdgId, fastsim::Particle::pdgId(), ALCARECOTkAlMinBias_cff::pMin, fastsim::Particle::position(), funct::pow(), NUEvent::NUParticle::px, NUEvent::NUParticle::py, NUEvent::NUParticle::pz, fastsim::Particle::simTrackIndex(), funct::sin(), slope, mathSSE::sqrt(), theCurrentEntry, theCurrentInteraction, theDistCut, theHadronCM, theHadronEN, theHadronEnergy, theHadronNA, theHadronPMin, theIDMap, theLengthRatio, theNUEvents, theNumberOfEntries, theNumberOfInteractions, theRatiosMap, theta(), theTrees, and MetAnalyzer::zAxis.

365 {
366  int pdgId = particle.pdgId();
367  //
368  // no valid PDGid
369  //
370  if(abs(pdgId) <= 100 || abs(pdgId) >= 1000000)
371  {
372  return;
373  }
374 
375  double radLengths = layer.getThickness(particle.position(),particle.momentum());
376  // TEC layers have some fudge factor for nuclear interactions
377  radLengths *= layer.getNuclearInteractionThicknessFactor();
378  //
379  // no material
380  //
381  if(radLengths < 1E-10)
382  {
383  return;
384  }
385 
386  // In case the events are not read from (old) saved file, then pick a random event from FullSim file
387  if(!currentValuesWereSet) {
388  currentValuesWereSet = true;
389  for ( unsigned iname=0; iname<theHadronNA.size(); ++iname ) {
390  for ( unsigned iene=0; iene<theHadronEN.size(); ++iene ) {
391  theCurrentEntry[iname][iene] = (unsigned) (theNumberOfEntries[iname][iene] * random.flatShoot());
392 
393  theTrees[iname][iene]->GetEntry(theCurrentEntry[iname][iene]);
394  unsigned NInteractions = theNUEvents[iname][iene]->nInteractions();
395  theNumberOfInteractions[iname][iene] = NInteractions;
396 
397  theCurrentInteraction[iname][iene] = (unsigned) (theNumberOfInteractions[iname][iene] * random.flatShoot());
398  }
399  }
400  }
401 
402  // Momentum of interacting hadron
403  double pHadron = std::sqrt(particle.momentum().Vect().Mag2());
404 
405  //
406  // The hadron has not enough momentum to create some relevant final state
407  //
408  if(pHadron < theHadronEnergy){
409  return;
410  }
411 
412  // The particle type
413  std::map<int,int>::const_iterator thePit = theIDMap.find(pdgId);
414  // Use map for unique ID (e.g. proton = {2212, 3222, -101, -102, -103, -104})
415  int thePid = (thePit != theIDMap.end() ? thePit->second : pdgId);
416 
417  // Is this particle type foreseen?
418  unsigned fPid = abs(thePid);
419  if(fPid != 211 && fPid != 130 && fPid != 321 && fPid != 2112 && fPid != 2212)
420  {
421  return;
422  }
423 
424  // The hashed ID
425  unsigned thePidIndex = index(thePid);
426  // The inelastic interaction length at p(Hadron) = 5 GeV/c
427  double theInelasticLength = radLengths * theLengthRatio[thePidIndex];
428 
429  // The elastic interaction length
430  // The baroque parameterization is a fit to Fig. 40.13 of the PDG
431  double ee = pHadron > 0.6 ? exp(-std::sqrt((pHadron-0.6)/1.122)) : exp(std::sqrt((0.6-pHadron)/1.122));
432  double theElasticLength = (0.8753 * ee + 0.15) * theInelasticLength;
433 
434  // The total interaction length
435  double theTotalInteractionLength = theInelasticLength + theElasticLength;
436 
437  //
438  // Probability to interact is dl/L0 (maximum for 4 GeV Hadron)
439  //
440  double aNuclInteraction = -std::log(random.flatShoot());
441  if(aNuclInteraction > theTotalInteractionLength)
442  {
443  return;
444  }
445 
446  // The elastic part
447  double elastic = random.flatShoot();
448  if(elastic < theElasticLength/theTotalInteractionLength){
449  // Characteristic scattering angle for the elastic part
450  // A of silicon
451  double A = 28.0855;
452  double theta0 = std::sqrt(3.)/ std::pow(A,1./3.) * particle.momentum().mass()/pHadron;
453 
454  // Draw an angle with theta/theta0*exp[(-theta/2theta0)**2] shape
455  double theta = theta0 * std::sqrt(-2.*std::log(random.flatShoot()));
456  double phi = 2. * M_PI * random.flatShoot();
457 
458  // Rotate the particle accordingly
459  ROOT::Math::AxisAngle rotation1(orthogonal(particle.momentum().Vect()),theta);
460  ROOT::Math::AxisAngle rotation2(particle.momentum().Vect(),phi);
461  // Rotate!
462  XYZVector rotated = rotation2((rotation1(particle.momentum().Vect())));
463 
464  // Create a daughter if the kink is large enough
465  if (std::sin(theta) > theDistCut) {
466  secondaries.emplace_back(new fastsim::Particle(pdgId
467  ,particle.position()
468  ,XYZTLorentzVector(rotated.X(),
469  rotated.Y(),
470  rotated.Z(),
471  particle.momentum().E())));
472 
473  // Set the ClosestCharged Daughter thing for tracking
474  if(particle.charge() != 0){
475  secondaries.back()->setMotherDeltaR(particle.momentum());
476  secondaries.back()->setMotherPdgId(pdgId);
477  secondaries.back()->setMotherSimTrackIndex(particle.simTrackIndex());
478  }
479 
480  // The particle is destroyed
481  particle.momentum().SetXYZT(0., 0., 0., 0.);
482  }else{
483  // If kink is small enough just rotate particle
484  particle.momentum().SetXYZT(rotated.X(),
485  rotated.Y(),
486  rotated.Z(),
487  particle.momentum().E());
488  }
489  // The inelastic part
490  }else{
491  // Avoid multiple map access
492  const std::vector<double>& aHadronCM = theHadronCM[thePidIndex];
493  const std::vector<double>& aRatios = theRatiosMap[thePidIndex];
494  // Find the file with the closest c.m energy
495  // The target nucleon
496  XYZTLorentzVector Proton(0.,0.,0.,0.939);
497  // The current particle
498  const XYZTLorentzVector& Hadron = (const XYZTLorentzVector&)particle.momentum();
499  // The smallest momentum for inelastic interactions
500  double pMin = theHadronPMin[thePidIndex];
501  // The corresponding smallest four vector
502  XYZTLorentzVector Hadron0(0.,
503  0.,
504  pMin,
505  std::sqrt(pMin*pMin+particle.momentum().M2()));
506 
507  // The current centre-of-mass energy
508  double ecm = (Proton+Hadron).M();
509 
510  // Get the files of interest (closest c.m. energies)
511  unsigned ene1=0;
512  unsigned ene2=0;
513  // The smallest centre-of-mass energy
514  double ecm1= (Proton+Hadron0).M();
515 
516  double ecm2=aHadronCM[0];
517  double ratio1=0.;
518  double ratio2=aRatios[0];
519  if(ecm > aHadronCM[0] && ecm < aHadronCM[aHadronCM.size()-1]){
520  for(unsigned ene=1; ene < aHadronCM.size() && ecm > aHadronCM[ene-1]; ++ene){
521  if(ecm < aHadronCM[ene]){
522  ene2 = ene;
523  ene1 = ene2-1;
524  ecm1 = aHadronCM[ene1];
525  ecm2 = aHadronCM[ene2];
526  ratio1 = aRatios[ene1];
527  ratio2 = aRatios[ene2];
528  }
529  }
530  }else if(ecm > aHadronCM[aHadronCM.size()-1]){
531  ene1 = aHadronCM.size()-1;
532  ene2 = aHadronCM.size()-2;
533  ecm1 = aHadronCM[ene1];
534  ecm2 = aHadronCM[ene2];
535  ratio1 = aRatios[ene2];
536  ratio2 = aRatios[ene2];
537  }
538 
539  // The inelastic part of the cross section depends cm energy
540  double slope = (std::log10(ecm) - std::log10(ecm1)) / (std::log10(ecm2) - std::log10(ecm1));
541  double inelastic = ratio1 + (ratio2 - ratio1) * slope;
542  double inelastic4 = pHadron < 4. ? aRatios[ien4] : 1.;
543 
544  // Simulate an inelastic interaction
545  if(elastic > 1.- (inelastic*theInelasticLength) / theTotalInteractionLength){
546  // Avoid mutliple map access
547  std::vector<unsigned>& aCurrentInteraction = theCurrentInteraction[thePidIndex];
548  std::vector<unsigned>& aNumberOfInteractions = theNumberOfInteractions[thePidIndex];
549  std::vector<NUEvent*>& aNUEvents = theNUEvents[thePidIndex];
550 
551  // Choice of the file to read according the the log10(ecm) distance
552  // and protection against low momentum proton and neutron that never interacts
553  // (i.e., empty files)
554  unsigned ene;
555  if(random.flatShoot() < slope || aNumberOfInteractions[ene1] == 0){
556  ene = ene2;
557  }else{
558  ene = ene1;
559  }
560 
561  // The boost characteristics
562  XYZTLorentzVector theBoost = Proton + Hadron;
563  theBoost /= theBoost.e();
564 
565  // Check we are not either at the end of an interaction bunch
566  // or at the end of a file
567  if(aCurrentInteraction[ene] == aNumberOfInteractions[ene]){
568  std::vector<unsigned>& aCurrentEntry = theCurrentEntry[thePidIndex];
569  std::vector<unsigned>& aNumberOfEntries = theNumberOfEntries[thePidIndex];
570  std::vector<TTree*>& aTrees = theTrees[thePidIndex];
571  ++aCurrentEntry[ene];
572 
573  aCurrentInteraction[ene] = 0;
574  if(aCurrentEntry[ene] == aNumberOfEntries[ene]){
575  aCurrentEntry[ene] = 0;
576  }
577 
578  unsigned myEntry = aCurrentEntry[ene];
579  aTrees[ene]->GetEntry(myEntry);
580  aNumberOfInteractions[ene] = aNUEvents[ene]->nInteractions();
581  }
582 
583  // Read the interaction
584  NUEvent::NUInteraction anInteraction = aNUEvents[ene]->theNUInteractions()[aCurrentInteraction[ene]];
585 
586  unsigned firstTrack = anInteraction.first;
587  unsigned lastTrack = anInteraction.last;
588 
589  // Some rotation around the boost axis, for more randomness
590  XYZVector theAxis = theBoost.Vect().Unit();
591  double theAngle = random.flatShoot() * 2. * M_PI;
592  ROOT::Math::AxisAngle axisRotation(theAxis,theAngle);
593  ROOT::Math::Boost axisBoost(theBoost.x(),theBoost.y(),theBoost.z());
594 
595  // A rotation to bring the particles back to the Hadron direction
596  XYZVector zAxis(0.,0.,1.);
597  XYZVector orthAxis = (zAxis.Cross(theBoost.Vect())).Unit();
598  double orthAngle = acos(theBoost.Vect().Unit().Z());
599  ROOT::Math::AxisAngle orthRotation(orthAxis,orthAngle);
600 
601  // Loop on the nuclear interaction products
602  for(unsigned iTrack=firstTrack; iTrack<=lastTrack; ++iTrack){
603  NUEvent::NUParticle aParticle = aNUEvents[ene]->theNUParticles()[iTrack];
604 
605  // Add a RawParticle with the proper energy in the c.m. frame of
606  // the nuclear interaction
607  double energy = std::sqrt(aParticle.px*aParticle.px
608  + aParticle.py*aParticle.py
609  + aParticle.pz*aParticle.pz
610  + aParticle.mass*aParticle.mass / (ecm * ecm));
611 
612  XYZTLorentzVector daugtherMomentum(aParticle.px*ecm, aParticle.py*ecm, aParticle.pz*ecm, energy*ecm);
613 
614  // Rotate to the collision axis
615  XYZVector rotated = orthRotation(daugtherMomentum.Vect());
616  // Rotate around the boost axis for more randomness
617  rotated = axisRotation(rotated);
618 
619  // Rotated the daughter
620  daugtherMomentum.SetXYZT(rotated.X(), rotated.Y(), rotated.Z(), daugtherMomentum.E());
621 
622  // Boost it in the lab frame
623  daugtherMomentum = axisBoost(daugtherMomentum);
624 
625  // Create secondary
626  secondaries.emplace_back(new fastsim::Particle(aParticle.id, particle.position(), daugtherMomentum));
627 
628  // The closestCharged Daughter thing for tracking
629  // BUT: 'aParticle' also has to be charged, only then the mother should be set
630  // Unfortunately, NUEvent::NUParticle does not contain any info about the charge
631  // Did some tests and effect is absolutely negligible!
632  if(particle.charge() != 0){
633  secondaries.back()->setMotherDeltaR(particle.momentum());
634  secondaries.back()->setMotherPdgId(pdgId);
635  secondaries.back()->setMotherSimTrackIndex(particle.simTrackIndex());
636  }
637  }
638 
639  // The particle is destroyed
640  particle.momentum().SetXYZT(0., 0., 0., 0.);
641 
642  // This is a note from previous version of code but I don't understand it:
643  // ERROR The way this loops through the events breaks
644  // replay. Which events are retrieved depends on
645  // which previous events were processed.
646 
647  // Increment for next time
648  ++aCurrentInteraction[ene];
649 
650  // Simulate a stopping hadron (low momentum)
651  }else if(pHadron < 4. && elastic > 1.- (inelastic4*theInelasticLength) / theTotalInteractionLength){
652  // The particle is destroyed
653  particle.momentum().SetXYZT(0., 0., 0., 0.);
654  }
655  }
656 }
const math::XYZTLorentzVector & position() const
Return position of the particle.
Definition: Particle.h:142
double theDistCut
Cut on deltaR for the FastSim Tracking (ClosestChargedDaughter algorithm)
double flatShoot(double xmin=0.0, double xmax=1.0) const
std::vector< std::vector< TTree * > > theTrees
Necessary to read the FullSim interactions.
static const double slope[3]
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
bool currentValuesWereSet
Read data from file that was created in a previous run.
std::vector< std::vector< unsigned > > theNumberOfEntries
Necessary to read the FullSim interactions.
int pdgId() const
Return pdgId of the particle.
Definition: Particle.h:136
static std::vector< std::vector< double > > theRatiosMap
The evolution of the interaction lengths with energy.
std::vector< std::vector< NUEvent * > > theNUEvents
Necessary to read the FullSim interactions.
const std::vector< double > theLengthRatio
Inelastic interaction length at p(Hadron) = 5 GeV/c (relativ to radionLength of material) ...
math::XYZVector XYZVector
static std::map< int, int > theIDMap
Build the ID map (i.e., what is to be considered as a proton, etc...)
std::vector< std::vector< unsigned > > theNumberOfInteractions
Necessary to read the FullSim interactions.
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< std::vector< unsigned > > theCurrentInteraction
Necessary to read the FullSim interactions.
unsigned index(int thePid)
Return a hashed index for a given particle ID.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
XYZVector orthogonal(const XYZVector &aVector) const
Return an orthogonal vector.
math::XYZTLorentzVector XYZTLorentzVector
int simTrackIndex() const
Return index of the SimTrack.
Definition: Particle.h:155
#define M_PI
std::vector< std::vector< double > > theHadronCM
Necessary to read the FullSim interactions.
double theHadronEnergy
Minimum energy for nuclear interaction.
std::vector< std::vector< unsigned > > theCurrentEntry
Necessary to read the FullSim interactions.
const std::vector< double > theHadronPMin
Smallest momentum for inelastic interactions.
double charge() const
Return charge of the particle.
Definition: Particle.h:139
unsigned ien4
Find the index for which EN = 4.
const std::vector< double > theHadronEN
Filled into &#39;theRatiosMap&#39; (evolution of the interaction lengths with energy)
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
Definition: Particle.h:145
Definition of a generic FastSim Particle which can be propagated through the detector (formerly Parti...
Definition: Particle.h:19
const std::vector< std::string > theHadronNA
Names of the hadrons.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15
XYZVector fastsim::NuclearInteraction::orthogonal ( const XYZVector aVector) const
private

Return an orthogonal vector.

Definition at line 774 of file NuclearInteraction.cc.

References DEFINE_EDM_PLUGIN, x, y, and z.

Referenced by interact().

775 {
776  double x = fabs(aVector.X());
777  double y = fabs(aVector.Y());
778  double z = fabs(aVector.Z());
779 
780  if (x < y)
781  return x < z ?
782  XYZVector(0.,aVector.Z(),-aVector.Y()) :
783  XYZVector(aVector.Y(),-aVector.X(),0.);
784  else
785  return y < z ?
786  XYZVector(-aVector.Z(),0.,aVector.X()) :
787  XYZVector(aVector.Y(),-aVector.X(),0.);
788 }
float float float z
math::XYZVector XYZVector
bool fastsim::NuclearInteraction::read ( std::string  inputFile)
private

Read the nuclear interactions from a file, so you can reproduce the events (e.g. in case of a crash).

Definition at line 706 of file NuclearInteraction.cc.

References mps_update::results, findQualityFiles::size, trackingPlots::stat, theCurrentEntry, and theCurrentInteraction.

Referenced by edmIntegrityCheck.PublishToFileSystem::get(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), NuclearInteraction(), and Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches().

707 {
708  std::ifstream myInputFile;
709  struct stat results;
710  //
711  unsigned size1 = theCurrentEntry.size() * theCurrentEntry.begin()->size();
712  std::vector<unsigned> theCurrentEntries;
713  theCurrentEntries.resize(size1);
714  size1*=sizeof(unsigned);
715  //
716  unsigned size2 = theCurrentInteraction.size() * theCurrentInteraction.begin()->size();
717  std::vector<unsigned> theCurrentInteractions;
718  theCurrentInteractions.resize(size2);
719  size2 *= sizeof(unsigned);
720  //
721  unsigned size = 0;
722 
723 
724  // Open the file (if any), otherwise return false
725  myInputFile.open (inputFile.c_str());
726  if(myInputFile.is_open()){
727 
728  // Get the size of the file
729  if(stat(inputFile.c_str(), &results) == 0) size = results.st_size;
730  else return false; // Something is wrong with that file !
731 
732  // Position the pointer just before the last record
733  myInputFile.seekg(size-size1-size2);
734  myInputFile.read((char*)(&theCurrentEntries.front()),size1);
735  myInputFile.read((char*)(&theCurrentInteractions.front()),size2);
736  myInputFile.close();
737 
738  // Read the current entries
739  std::vector< std::vector<unsigned> >::iterator aCurrentEntry = theCurrentEntry.begin();
740  std::vector< std::vector<unsigned> >::iterator lastCurrentEntry = theCurrentEntry.end();
741  unsigned allEntries=0;
742  for(; aCurrentEntry!=lastCurrentEntry; ++aCurrentEntry){
743  unsigned size = aCurrentEntry->size();
744  for(unsigned iene=0; iene<size; ++iene)
745  (*aCurrentEntry)[iene] = theCurrentEntries[allEntries++];
746  }
747 
748  // Read the current interactions
749  std::vector< std::vector<unsigned> >::iterator aCurrentInteraction = theCurrentInteraction.begin();
750  std::vector< std::vector<unsigned> >::iterator lastCurrentInteraction = theCurrentInteraction.end();
751  unsigned allInteractions=0;
752  for(; aCurrentInteraction!=lastCurrentInteraction; ++aCurrentInteraction){
753  unsigned size = aCurrentInteraction->size();
754  for(unsigned iene=0; iene<size; ++iene)
755  (*aCurrentInteraction)[iene] = theCurrentInteractions[allInteractions++];
756  }
757 
758  return true;
759  }
760 
761  return false;
762 }
size
Write out results.
std::vector< std::vector< unsigned > > theCurrentInteraction
Necessary to read the FullSim interactions.
std::vector< std::vector< unsigned > > theCurrentEntry
Necessary to read the FullSim interactions.
std::string inputFile
Directory/Name of input file in case you want to read interactions from file.
void fastsim::NuclearInteraction::save ( )
private

Save the nuclear interactions to a file, so you can reproduce the events (e.g. in case of a crash).

Definition at line 659 of file NuclearInteraction.cc.

References myOutputBuffer, myOutputFile, findQualityFiles::size, theCurrentEntry, and theCurrentInteraction.

Referenced by Vispa.Main.TabController.TabController::allowClose(), Vispa.Main.TabController.TabController::checkModificationTimestamp(), and ~NuclearInteraction().

660 {
661  // Size of buffer
662  ++myOutputBuffer;
663 
664  // Periodically close the current file and open a new one
665  if(myOutputBuffer/1000*1000 == myOutputBuffer){
666  myOutputFile.close();
667  myOutputFile.open ("NuclearInteractionOutputFile.txt");
668  }
669  //
670  unsigned size1 = theCurrentEntry.size() * theCurrentEntry.begin()->size();
671  std::vector<unsigned> theCurrentEntries;
672  theCurrentEntries.resize(size1);
673  size1*=sizeof(unsigned);
674  //
675  unsigned size2 = theCurrentInteraction.size() * theCurrentInteraction.begin()->size();
676  std::vector<unsigned> theCurrentInteractions;
677  theCurrentInteractions.resize(size2);
678  size2 *= sizeof(unsigned);
679 
680  // Save the current entries
681  std::vector< std::vector<unsigned> >::const_iterator aCurrentEntry = theCurrentEntry.begin();
682  std::vector< std::vector<unsigned> >::const_iterator lastCurrentEntry = theCurrentEntry.end();
683  unsigned allEntries=0;
684  for(; aCurrentEntry!=lastCurrentEntry; ++aCurrentEntry){
685  unsigned size = aCurrentEntry->size();
686  for(unsigned iene=0; iene<size; ++iene)
687  theCurrentEntries[allEntries++] = (*aCurrentEntry)[iene];
688  }
689 
690  // Save the current interactions
691  std::vector< std::vector<unsigned> >::const_iterator aCurrentInteraction = theCurrentInteraction.begin();
692  std::vector< std::vector<unsigned> >::const_iterator lastCurrentInteraction = theCurrentInteraction.end();
693  unsigned allInteractions=0;
694  for (; aCurrentInteraction!=lastCurrentInteraction; ++aCurrentInteraction){
695  unsigned size = aCurrentInteraction->size();
696  for(unsigned iene=0; iene<size; ++iene)
697  theCurrentInteractions[allInteractions++] = (*aCurrentInteraction)[iene];
698  }
699  // Write to file
700  myOutputFile.write((const char*)(&theCurrentEntries.front()), size1);
701  myOutputFile.write((const char*)(&theCurrentInteractions.front()), size2);
702  myOutputFile.flush();
703 }
size
Write out results.
std::vector< std::vector< unsigned > > theCurrentInteraction
Necessary to read the FullSim interactions.
std::ofstream myOutputFile
Output file to save interactions.
std::vector< std::vector< unsigned > > theCurrentEntry
Necessary to read the FullSim interactions.
unsigned myOutputBuffer
Needed to save interactions to file.

Member Data Documentation

const std::vector<int> fastsim::NuclearInteraction::antineutronsID = {-2112, -3122, -3112, -3312, -3322}
private

PdgID of anti-neutrons.

Definition at line 192 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

const std::vector<int> fastsim::NuclearInteraction::antiprotonsID = {-2212, -3222}
private

PdgID of anti-protons.

Definition at line 190 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

bool fastsim::NuclearInteraction::currentValuesWereSet
private

Read data from file that was created in a previous run.

Definition at line 115 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().

unsigned fastsim::NuclearInteraction::ien4
private

Find the index for which EN = 4.

Definition at line 110 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().

std::string fastsim::NuclearInteraction::inputFile
private

Directory/Name of input file in case you want to read interactions from file.

Definition at line 92 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

const std::vector<int> fastsim::NuclearInteraction::K0LsID = {130, 310}
private

PdgID of K0.

Definition at line 193 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

const std::vector<int> fastsim::NuclearInteraction::KminussesID = {-321}
private

PdgID of K-.

Definition at line 195 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

const std::vector<int> fastsim::NuclearInteraction::KplussesID = {321}
private

PdgID of K+.

Definition at line 194 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

unsigned fastsim::NuclearInteraction::myOutputBuffer
private

Needed to save interactions to file.

Definition at line 113 of file NuclearInteraction.cc.

Referenced by NuclearInteraction(), and save().

std::ofstream fastsim::NuclearInteraction::myOutputFile
private

Output file to save interactions.

Definition at line 112 of file NuclearInteraction.cc.

Referenced by NuclearInteraction(), save(), and ~NuclearInteraction().

const std::vector<int> fastsim::NuclearInteraction::neutronsID = {2112, 3122, 3112, 3312, 3322, 3334, -3334}
private

PdgID of neutrons.

Definition at line 191 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

const std::vector<int> fastsim::NuclearInteraction::PiminussesID = {-211}
private

PdgID of pi-.

Definition at line 197 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

const std::vector<int> fastsim::NuclearInteraction::PiplussesID = {211}
private

PdgID of pt+.

Definition at line 196 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

const std::vector<int> fastsim::NuclearInteraction::protonsID = {2212, 3222, -101, -102, -103, -104}
private

PdgID of protons.

Definition at line 189 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

std::vector< std::vector<TBranch*> > fastsim::NuclearInteraction::theBranches
private

Necessary to read the FullSim interactions.

Definition at line 101 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

std::vector< std::vector<unsigned> > fastsim::NuclearInteraction::theCurrentEntry
private

Necessary to read the FullSim interactions.

Definition at line 103 of file NuclearInteraction.cc.

Referenced by interact(), NuclearInteraction(), read(), and save().

std::vector< std::vector<unsigned> > fastsim::NuclearInteraction::theCurrentInteraction
private

Necessary to read the FullSim interactions.

Definition at line 104 of file NuclearInteraction.cc.

Referenced by interact(), NuclearInteraction(), read(), and save().

double fastsim::NuclearInteraction::theDistCut
private

Cut on deltaR for the FastSim Tracking (ClosestChargedDaughter algorithm)

Definition at line 90 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().

TFile* fastsim::NuclearInteraction::theFile = 0
private

Necessary to read the FullSim interactions.

Definition at line 99 of file NuclearInteraction.cc.

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

std::vector< std::vector<std::string> > fastsim::NuclearInteraction::theFileNames
private

Necessary to read the FullSim interactions.

Definition at line 107 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

std::vector< std::vector<double> > fastsim::NuclearInteraction::theHadronCM
private

Necessary to read the FullSim interactions.

Definition at line 108 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().

const std::vector<double> fastsim::NuclearInteraction::theHadronEN = {1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 12.0, 15.0, 20.0, 30.0, 50.0, 100.0, 200.0, 300.0, 500.0, 700.0, 1000.0}
private

Filled into 'theRatiosMap' (evolution of the interaction lengths with energy)

Definition at line 127 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().

double fastsim::NuclearInteraction::theHadronEnergy
private

Minimum energy for nuclear interaction.

Definition at line 91 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().

const std::vector<int> fastsim::NuclearInteraction::theHadronID = {211, -211, 130, 321, -321, 2212, -2212, 2112, -2112}
private

ID of the hadrons.

Definition at line 132 of file NuclearInteraction.cc.

Referenced by index(), and NuclearInteraction().

const std::vector<double> fastsim::NuclearInteraction::theHadronMA = {0.13957, 0.13957, 0.497648, 0.493677, 0.493677, 0.93827, 0.93827, 0.939565, 0.939565}
private

Masses of the hadrons.

Definition at line 136 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

const std::vector<std::string> fastsim::NuclearInteraction::theHadronNA = {"piplus", "piminus", "K0L", "Kplus", "Kminus", "p", "pbar", "n", "nbar"}
private

Names of the hadrons.

Definition at line 134 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().

const std::vector<double> fastsim::NuclearInteraction::theHadronPMin = {0.7, 0.0, 1.0, 1.0, 0.0, 1.1, 0.0, 1.1, 0.0}
private

Smallest momentum for inelastic interactions.

Definition at line 138 of file NuclearInteraction.cc.

Referenced by interact().

std::map< int, int > fastsim::NuclearInteraction::theIDMap
staticprivate

Build the ID map (i.e., what is to be considered as a proton, etc...)

Definition at line 124 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().

const std::vector<double> fastsim::NuclearInteraction::theLengthRatio
private
Initial value:
=
{
0.2257, 0.2294, 0.3042, 0.2591, 0.2854, 0.3101, 0.5216, 0.3668, 0.4898
}

Inelastic interaction length at p(Hadron) = 5 GeV/c (relativ to radionLength of material)

Definition at line 140 of file NuclearInteraction.cc.

Referenced by interact().

std::vector< std::vector<NUEvent*> > fastsim::NuclearInteraction::theNUEvents
private

Necessary to read the FullSim interactions.

Definition at line 102 of file NuclearInteraction.cc.

Referenced by interact(), NuclearInteraction(), and ~NuclearInteraction().

std::vector< std::vector<unsigned> > fastsim::NuclearInteraction::theNumberOfEntries
private

Necessary to read the FullSim interactions.

Definition at line 105 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().

std::vector< std::vector<unsigned> > fastsim::NuclearInteraction::theNumberOfInteractions
private

Necessary to read the FullSim interactions.

Definition at line 106 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().

const std::vector<double> fastsim::NuclearInteraction::theRatios
private

Filled into 'theRatiosMap' (evolution of the interaction lengths with energy)

Definition at line 146 of file NuclearInteraction.cc.

Referenced by NuclearInteraction().

std::vector< std::vector< double > > fastsim::NuclearInteraction::theRatiosMap
staticprivate

The evolution of the interaction lengths with energy.

Definition at line 122 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().

std::vector< std::vector<TTree*> > fastsim::NuclearInteraction::theTrees
private

Necessary to read the FullSim interactions.

Definition at line 100 of file NuclearInteraction.cc.

Referenced by interact(), and NuclearInteraction().