MpdRainGenerator.cxx 1017 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "MpdRainGenerator.h"
  2. #include <TMath.h>
  3. #include "FairPrimaryGenerator.h"
  4. #include <iostream>
  5. MpdRainGenerator::MpdRainGenerator():
  6. _PDGType(-1), _N(0), _p(0), _theta(0), _phi(0), _d(-1), _height(0)
  7. {
  8. }
  9. MpdRainGenerator::MpdRainGenerator(Int_t pdgid, Double_t p, Double_t theta, Double_t phi,
  10. Double_t d, Double_t height, Int_t n):
  11. _PDGType(pdgid), _N(n), _p(p), _theta(theta), _phi(phi), _height(height), _d(d)
  12. {
  13. }
  14. Bool_t MpdRainGenerator::ReadEvent(FairPrimaryGenerator* primGen) {
  15. // Check for particle type
  16. if ( _PDGType == -1 )
  17. Fatal("MpdRainGenerator","PDG code not defined.");
  18. for(int i = -_N; i < _N; i++)
  19. for(int j = -_N; j < _N; j++)
  20. {
  21. TVector3 point(i*_d, j*_d, _height);
  22. point.RotateY(_theta);
  23. point.RotateZ(_phi);
  24. TVector3 m;
  25. m.SetMagThetaPhi(_p, _theta, _phi);
  26. m = -m;
  27. primGen->AddTrack(_PDGType, m.X(), m.Y(), m.Z(), point.X(), point.Y(), point.Z() );
  28. }
  29. return kTRUE;
  30. }
  31. ClassImp(MpdRainGenerator)