00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef GENERATORMODULESCOSMICGEN_H
00018 #define GENERATORMODULESCOSMICGEN_H
00019
00020 #include "BesKernel/IBesRndmGenSvc.h"
00021
00022 #include "HepMC/GenEvent.h"
00023 #include "HepMC/GenParticle.h"
00024
00025 #include "GaudiKernel/Algorithm.h"
00026 #include "GaudiKernel/ISvcLocator.h"
00027 #include "GaudiKernel/AlgFactory.h"
00028 #include "GaudiKernel/NTuple.h"
00029
00030 #include "CLHEP/Vector/LorentzVector.h"
00031 #include "HepMC/Polarization.h"
00032 #include "CLHEP/Geometry/Point3D.h"
00033 #include "CLHEP/Geometry/Normal3D.h"
00034 #include <iostream>
00035 #include <fstream>
00036 #include <vector>
00037 #include <string>
00038
00039 using namespace std;
00040 using namespace CLHEP;
00041 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00042 typedef HepGeom::Point3D<double> HepPoint3D;
00043 typedef HepGeom::Normal3D<float> HepNormal3D;
00044 #endif
00045
00046 class StoreGateSvc;
00047 class ActiveStoreSvc;
00048
00049 class CosmicGun;
00050
00051 class CosmicGenerator:public Algorithm {
00052 public:
00053 CosmicGenerator(const std::string& name, ISvcLocator* pSvcLocator);
00054 ~CosmicGenerator();
00055 StatusCode initialize();
00056 StatusCode execute();
00057 StatusCode finalize();
00058
00059
00060 HepLorentzVector generateVertex(void);
00061
00062 static IBesRndmGenSvc* p_BesRndmGenSvc;
00063
00064 private:
00065
00066 StoreGateSvc* m_sgSvc;
00067 ActiveStoreSvc* m_activeStore;
00068 NTuple::Tuple* m_tuple;
00069 NTuple::Item<double> m_cosmicE;
00070 NTuple::Item<double> m_cosmicTheta;
00071 NTuple::Item<double> m_cosmicPhi;
00072 NTuple::Item<double> m_cosmicCharge;
00073 NTuple::Tuple* m_tuple1;
00074 NTuple::Item<double> mc_phi;
00075 NTuple::Item<double> mc_theta;
00076 NTuple::Item<double> mc_px;
00077 NTuple::Item<double> mc_py;
00078 NTuple::Item<double> mc_pz;
00079
00080
00081 long int m_events, m_rejected,m_accepted,m_tried;
00082 std::vector<int> m_pdgCode;
00083 float m_emin, m_emax;
00084 float m_ctcut;
00085 float m_xlow, m_xhig, m_zlow, m_zhig, m_yval, m_IPx, m_IPy, m_IPz;
00086 float m_radius, m_xpos, m_ypos, m_zpos;
00087
00088 float m_tmin, m_tmax,m_tcor;
00089 bool m_sphereOpt;
00090
00091 bool m_swapYZAxis;
00092 bool m_cubeProj;
00093 long int m_printEvent, m_printMod;
00094 long int m_selection ;
00095 int m_dumpMC;
00096 float m_thetamin, m_thetamax, m_phimin, m_phimax;
00097
00098 float m_GeV;
00099 float m_mm;
00100
00101
00102 bool m_readfile;
00103 std::string m_infile;
00104 std::ifstream m_ffile;
00105
00106
00107 std::vector<HepLorentzVector> m_fourPos;
00108 std::vector<HepLorentzVector> m_fourMom;
00109 Hep3Vector m_center;
00110 std::vector<HepMC::Polarization> m_polarization;
00111
00112
00113 IMessageSvc* p_msgSvc;
00114
00115
00116 bool exzCut(const Hep3Vector& pos,const HepLorentzVector& p);
00117
00118
00119 bool m_exzCut ;
00120
00121 float m_rmax ;
00122
00123 };
00124
00125 #endif