CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
NuclearInteractionSimulator.h
Go to the documentation of this file.
1 #ifndef FastSimulation_MaterialEffects_NuclearInteractionSimulator_H
2 #define FastSimulation_MaterialEffects_NuclearInteractionSimulator_H
3 
17 
18 #include <vector>
19 #include <map>
20 #include <string>
21 #include <fstream>
22 
23 class TFile;
24 class TTree;
25 class TBranch;
26 class NUEvent;
27 
28 class ParticlePropagator;
29 class RandomEngine;
30 //class DaqMonitorBEInterface;
31 //class MonitorElement;
32 
34 {
35  public:
36 
38  NuclearInteractionSimulator(std::vector<double>& pionEnergies,
39  std::vector<int>& pionTypes,
40  std::vector<std::string>& pionNames,
41  std::vector<double>& pionMasses,
42  std::vector<double>& pionPMin,
43  double pionEnergy,
44  std::vector<double>& lengthRatio,
45  std::vector< std::vector<double> >& ratios,
46  std::map<int,int >& idMap,
48  unsigned int distAlgo,
49  double distCut,
50  const RandomEngine* engine);
51 
54 
56  void save();
57 
59  bool read(std::string inputFile);
60 
61  private:
62 
64  void compute(ParticlePropagator& Particle);
65 
67  double distanceToPrimary(const RawParticle& Particle,
68  const RawParticle& aDaughter) const;
69 
71  unsigned index(int thePid);
72 
73  std::vector<double> thePionEN;
74  std::vector<int> thePionID;
75  std::vector<std::string> thePionNA;
76  std::vector<double> thePionMA;
77  std::vector<double> thePionPMin;
78  double thePionEnergy;
79  std::vector<double> theLengthRatio;
80  std::vector< std::vector<double> > theRatios;
81 
82  std::vector< std::vector<TFile*> > theFiles;
83  std::vector< std::vector<TTree*> > theTrees;
84  std::vector< std::vector<TBranch*> > theBranches;
85  std::vector< std::vector<NUEvent*> > theNUEvents;
86  std::vector< std::vector<unsigned> > theCurrentEntry;
87  std::vector< std::vector<unsigned> > theCurrentInteraction;
88  std::vector< std::vector<unsigned> > theNumberOfEntries;
89  std::vector< std::vector<unsigned> > theNumberOfInteractions;
90  std::vector< std::vector<std::string> > theFileNames;
91  std::vector< std::vector<double> > thePionCM;
92 
93  std::map< int, int > theIDMap;
94  unsigned ien4;
95  unsigned theDistAlgo;
96  double theDistCut;
97 
98  std::ofstream myOutputFile;
99  unsigned myOutputBuffer;
100 
101  // DaqMonitorBEInterface * dbe;
102  // MonitorElement* hAfter;
103  // MonitorElement* hAfter2;
104  // MonitorElement* hAfter3;
105  // MonitorElement* htot;
106  // MonitorElement* helas;
107  // MonitorElement* hinel;
108  // MonitorElement* hscatter;
109  // MonitorElement* hscatter2;
110 
111 };
112 #endif
void compute(ParticlePropagator &Particle)
Generate a nuclear interaction according to the probability that it happens.
dictionary ratios
Definition: plotFactory.py:68
std::vector< std::vector< TFile * > > theFiles
std::vector< std::vector< unsigned > > theNumberOfInteractions
std::vector< std::vector< TTree * > > theTrees
std::vector< std::vector< unsigned > > theCurrentEntry
std::vector< std::vector< std::string > > theFileNames
Definition: NUEvent.h:6
std::vector< std::vector< unsigned > > theNumberOfEntries
std::vector< std::vector< double > > thePionCM
bool read(std::string inputFile)
Read former nuclear interaction (from previous run)
unsigned index(int thePid)
Return a hashed index for a given pid.
std::vector< std::string > thePionNA
std::vector< std::vector< TBranch * > > theBranches
std::vector< std::vector< unsigned > > theCurrentInteraction
std::vector< std::vector< double > > theRatios
~NuclearInteractionSimulator()
Default Destructor.
NuclearInteractionSimulator(std::vector< double > &pionEnergies, std::vector< int > &pionTypes, std::vector< std::string > &pionNames, std::vector< double > &pionMasses, std::vector< double > &pionPMin, double pionEnergy, std::vector< double > &lengthRatio, std::vector< std::vector< double > > &ratios, std::map< int, int > &idMap, std::string inputFile, unsigned int distAlgo, double distCut, const RandomEngine *engine)
Constructor.
std::vector< std::vector< NUEvent * > > theNUEvents
void save()
Save current nuclear interaction (for later use)
double distanceToPrimary(const RawParticle &Particle, const RawParticle &aDaughter) const
Compute distance between secondary and primary.