00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GENERATORMODULESEVTDECAY_H
00019 #define GENERATORMODULESEVTDECAY_H
00020
00021 #include "HepMC/GenEvent.h"
00022 #include "HepMC/GenParticle.h"
00023
00024 #include "EvtGenBase/EvtParticle.hh"
00025 #include "EvtGenBase/EvtDecayBase.hh"
00026 #include "EvtGenBase/EvtDecayTable.hh"
00027 #include "EvtGen.hh"
00028 #include "EvtGenBase/EvtRandomEngine.hh"
00029
00030 #include "GaudiKernel/Algorithm.h"
00031 #include "GaudiKernel/ISvcLocator.h"
00032 #include "GaudiKernel/NTuple.h"
00033
00034 #include "CLHEP/Random/Ranlux64Engine.h"
00035 #include <stdio.h>
00036 #include <vector>
00037 #include "EvtGenBase/EvtRandom.hh"
00038 #include "EvtGenBase/EvtHis2F.hh"
00039 #include "EvtGenBase/EvtId.hh"
00040
00041 #include "DataInfoSvc/IDataInfoSvc.h"
00042 #include "DataInfoSvc/DataInfoSvc.h"
00043
00044
00045
00046
00047
00048 class IBesRndmGenSvc;
00049
00050 using namespace std;
00051 using namespace CLHEP;
00052
00053 class EvtBesRandom : public EvtRandomEngine
00054 {
00055 public:
00056 EvtBesRandom(HepRandomEngine* engine);
00057 double random();
00058 virtual ~EvtBesRandom();
00059
00060
00061 private:
00062 HepRandomEngine* m_engine;
00063 };
00064
00065 class EvtDecay:public Algorithm
00066 {
00067 public:
00068 EvtDecay(const string& name, ISvcLocator* pSvcLocator);
00069
00070 StatusCode initialize();
00071 StatusCode execute();
00072 StatusCode finalize();
00073
00074 IDataInfoSvc *tmpInfoSvc;
00075 DataInfoSvc* dataInfoSvc;
00076
00077 double ampsLenu(vector<double> Vexp,std::vector<double> vpars);
00078 double ampsLbenu(vector<double> Vexp,std::vector<double> vpars);
00079 double HV(double i,double j,vector<double> Vexp, std::vector<double> vpars);
00080 double HA(double i,double j,vector<double> Vexp, std::vector<double> vpars);
00081 double getObsXsection(double mhds,int mode);
00082
00083 private:
00084 StatusCode callEvtGen( HepMC::GenEvent* hepMCevt );
00085 StatusCode callBesEvtGen( HepMC::GenEvent* hepMCevt );
00086 StatusCode makeHepMC(EvtParticle*, HepMC::GenEvent*, HepMC::GenParticle*);
00087
00088 double CalAmpsMax( EvtParticle* part );
00089 double CalAmpsMDIY(EvtParticle* part );
00090
00091 void MeVToGeV(HepMC::GenEvent* hepMCevt);
00092 void GeVToMeV(HepMC::GenEvent* hepMCevt);
00093
00094 void ReadTruth(EvtParticle* part,std::vector<std::vector<string> > mylist);
00095
00096 int m_targetID;
00097 int isNumber(double d);
00098 double m_SetMthr;
00099
00100 EvtGen* m_Gen;
00101 EvtBesRandom* m_RandomEngine;
00102
00103
00104 IBesRndmGenSvc* p_BesRndmGenSvc;
00105 vector<long int> m_seeds;
00106
00107
00108
00109 string m_DecayDec, m_PdtTable, userDecFileName,m_DecayTop,m_DecayRec, m_ParentPart;
00110
00111 std::ofstream outfile,outfile2,truth;
00112 std::vector<int> m_InSeeds;
00113
00114 bool _mDIY,m_RdMeasuredEcms;
00115 double dbEcms;
00116 bool m_ampscalflag;
00117 bool m_Ncharge,m_NtupleFile, m_Psi4040OpenCharm, m_Psi2openCharm, m_statDecays;
00118 int m_numberEvent;
00119 int AllTrk_index,Trk_index[500];
00120 double px_trk[500];
00121 double py_trk[500];
00122 double pz_trk[500];
00123 double en_trk[500];
00124
00125 void SuperBody3decay_make(EvtId ppid, EvtVector4R p_init);
00126 bool SuperBody3decay_judge(EvtParticle* part);
00127 string m_SB3File, m_SB3HT;
00128 EvtHis2F SuperBody3decay;
00129 bool first;
00130 int parentPDGcode;
00131 double parentMass;
00132
00133 int pdg0,pdg1,pdg2,pdg,multi;
00134 EvtVector4R son0,son1,son2,son;
00135 void FinalState_make(EvtId ppid, EvtVector4R p_init);
00136 void FinalState_sort(EvtParticle* part);
00137 void assign_momentum(int pdx, EvtVector4R pv4);
00138 void assign_momentum2(int pdx, EvtVector4R pv4);
00139 bool identical_flag;
00140 string m_FDPparticle;
00141 EvtVector4R FDP_init;
00142 EvtId FDP_id;
00143 EvtParticle* FDP_part;
00144 void findPart(EvtParticle* part);
00145 void countChannel(EvtParticle* part);
00146 int br[500],vbr[500];
00147 int totalChannels;
00148 bool isCharmonium(EvtId xid);
00149 bool isCharm(EvtId xid);
00150 bool isRadecay(EvtParticle* par);
00151 string m_outputp4;
00152 int decayType(EvtParticle *par);
00153 std::string getModel(EvtParticle* par, int mode);
00154 std::string getModel(EvtParticle* par);
00155 bool m_tagLundModel;
00156
00157 std::vector<std::string> m_mystring;
00158 std::vector<double> m_wind0,m_wind1,m_wind2;
00159 std::vector<int> m_cluster0,m_cluster1,m_cluster2;
00160 static int m_runNo;
00161 std::vector<std::vector<std::string> > m_ReadTruth;
00162
00163 double m_eBeamPolarization;
00164 int writeFlag;
00165 EvtId m_KKMCRes;
00166 std::vector<double> m_polarization;
00167 std::string m_truthFile,m_truthPart;
00168
00169 NTuple::Tuple* m_tuple;
00170 NTuple::Item<int> TotNumTrk;
00171 NTuple::Item<int> m_nchr;
00172 NTuple::Item<int> m_nchr_e;
00173 NTuple::Item<int> m_nchr_mu;
00174 NTuple::Item<int> m_nchr_pi;
00175 NTuple::Item<int> m_nchr_k;
00176 NTuple::Item<int> m_nchr_p;
00177 NTuple::Item<int> m_gamma;
00178 NTuple::Item<int> m_gammaFSR;
00179 NTuple::Item<int> m_flag1;
00180
00181 NTuple::Array<int> m_Trk_index;
00182 NTuple::Array<int> m_fst;
00183 NTuple::Array<double> m_px_trk;
00184 NTuple::Array<double> m_py_trk;
00185 NTuple::Array<double> m_pz_trk;
00186 NTuple::Array<double> m_en_trk;
00187
00188 NTuple::Tuple* mass_tuple;
00189 NTuple::Item<double> m_m12;
00190 NTuple::Item<double> m_m13;
00191 NTuple::Item<double> m_m23;
00192 NTuple::Item<double> m_m1;
00193 NTuple::Item<double> m_m2;
00194 NTuple::Item<double> m_m3;
00195 NTuple::Item<double> m_cos1;
00196 NTuple::Item<double> m_cos2;
00197 NTuple::Item<double> m_cos3;
00198 NTuple::Item<int> m_ich;
00199 NTuple::Tuple* massgen_tuple;
00200 NTuple::Item<double> _m12;
00201 NTuple::Item<double> _m13;
00202 NTuple::Item<double> _m23;
00203 NTuple::Item<double> _m1;
00204 NTuple::Item<double> _m2;
00205 NTuple::Item<double> _m3;
00206 NTuple::Item<double> _cos1;
00207 NTuple::Item<double> _cos2;
00208 NTuple::Item<double> _cos3;
00209 NTuple::Item<int> _ich;
00211 };
00212
00213 #endif