CMS 3D CMS Logo

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;
30 //class DaqMonitorBEInterface;
31 //class MonitorElement;
32 
34 {
35  public:
36 
38  NuclearInteractionSimulator(std::vector<double>& hadronEnergies,
39  std::vector<int>& hadronTypes,
40  std::vector<std::string>& hadronNames,
41  std::vector<double>& hadronMasses,
42  std::vector<double>& hadronPMin,
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 
53 
55  void save();
56 
58  bool read(std::string inputFile);
59 
60  private:
61 
64 
66  double distanceToPrimary(const RawParticle& Particle,
67  const RawParticle& aDaughter) const;
68 
70  unsigned index(int thePid);
71 
72  std::vector<double> thePionEN;
73  std::vector<int> thePionID;
74  std::vector<std::string> thePionNA;
75  std::vector<double> thePionMA;
76  std::vector<double> thePionPMin;
77  double thePionEnergy;
78  std::vector<double> theLengthRatio;
79  std::vector< std::vector<double> > theRatios;
80 
81  std::vector< std::vector<TFile*> > theFiles;
82  std::vector< std::vector<TTree*> > theTrees;
83  std::vector< std::vector<TBranch*> > theBranches;
84  std::vector< std::vector<NUEvent*> > theNUEvents;
85  std::vector< std::vector<unsigned> > theCurrentEntry;
86  std::vector< std::vector<unsigned> > theCurrentInteraction;
87  std::vector< std::vector<unsigned> > theNumberOfEntries;
88  std::vector< std::vector<unsigned> > theNumberOfInteractions;
89  std::vector< std::vector<std::string> > theFileNames;
90  std::vector< std::vector<double> > thePionCM;
91 
92  std::map< int, int > theIDMap;
93  unsigned ien4;
94  unsigned theDistAlgo;
95  double theDistCut;
96 
97  std::ofstream myOutputFile;
98  unsigned myOutputBuffer;
99 
101 
102  // DaqMonitorBEInterface * dbe;
103  // MonitorElement* hAfter;
104  // MonitorElement* hAfter2;
105  // MonitorElement* hAfter3;
106  // MonitorElement* htot;
107  // MonitorElement* helas;
108  // MonitorElement* hinel;
109  // MonitorElement* hscatter;
110  // MonitorElement* hscatter2;
111 
112 };
113 #endif
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
void compute(ParticlePropagator &Particle, RandomEngineAndDistribution const *)
Generate a nuclear interaction according to the probability that it happens.
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 > &hadronEnergies, std::vector< int > &hadronTypes, std::vector< std::string > &hadronNames, std::vector< double > &hadronMasses, std::vector< double > &hadronPMin, 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)
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.