CMS 3D CMS Logo

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