00001
00017 #ifndef _MUON_PROPHET_H_
00018 #define _MUON_PROPHET_H_ 1
00019
00020 #include "MuonProphet/MpMuonFate.h"
00021 #include "MuonProphet/MpTriggerStat.h"
00023 #include "RectangularBox.h"
00024 #include "RpcPlane.h"
00025 #include "DetDesc/Material.h"
00026 #include "DetDesc/ILVolume.h"
00027 #include "DetDesc/IDetectorElement.h"
00028 #include "DetDesc/IGeometryInfo.h"
00030
00031 #include "GaudiAlg/GaudiTool.h"
00032 #include "GenTools/IHepMCEventMutator.h"
00033 #include "HepMC/GenEvent.h"
00034 #include "Conventions/Site.h"
00035 #include "CLHEP/Units/SystemOfUnits.h"
00036
00037
00038 #include "GaudiKernel/RndmGenerators.h"
00039 #include "GaudiKernel/IRndmGenSvc.h"
00040
00041
00042 #include "TF1.h"
00043 #include "TRandom3.h"
00044
00045 using namespace std;
00046
00047 class MuonProphet : public GaudiTool,
00048 virtual public IHepMCEventMutator
00049 {
00050 public:
00051
00052 MuonProphet(const std::string& type,
00053 const std::string& name,
00054 const IInterface* parent);
00055 virtual ~MuonProphet();
00056
00057 virtual StatusCode initialize();
00058 virtual StatusCode finalize();
00059
00060
00062 virtual StatusCode mutate(HepMC::GenEvent& event);
00063
00064 private:
00065
00066
00068 MpMuonFate predictMuonFate(HepMC::GenEvent& event);
00069
00070 StatusCode geometryCalculationInit();
00071 StatusCode geometryCalculation(HepMC::GenParticle * pMuon);
00072
00073
00074 MpTriggerStat triggeredByRpc(HepMC::GenParticle * pMuon);
00075
00076 MpTriggerStat triggeredByWaterPool(HepMC::GenParticle * pMuon);
00077
00078
00079
00080
00081
00082
00083
00087 int spallationProducts(HepMC::GenEvent& event, int idx);
00091 bool generateOneBkg(int idx,
00092 HepMC::ThreeVector& bkgPoint);
00093
00096 StatusCode spallationNeutronsInit();
00098 int spallationNeutrons(HepMC::GenEvent& event);
00100 int generateNeutrons(HepMC::GenEvent *bkgEvt,
00101 ISolid::Tick tickBegin,
00102 ISolid::Tick tickEnd,
00103 double multiplicity);
00104
00105 StatusCode printout(HepMC::GenEvent& event);
00107
00108 void setPosition(HepMC::GenEvent& event, HepMC::ThreeVector& position);
00109
00110 void setTime(HepMC::GenEvent& event, double t0, double lifetime);
00111
00112
00113
00114 bool m_active;
00115
00116
00117 HepMC::GenParticle * m_muon;
00118
00121
00122 vector<std::string> m_genToolNames;
00123
00124 vector<int> m_genId;
00125
00126 vector<IHepMCEventMutator*> m_genTools;
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 vector<double> m_genYields;
00143
00144 vector<double> m_genYieldMeasuredAt;
00145
00146 vector<double> m_genLifetimes;
00147
00148
00149
00150 bool m_actNeutron;
00151
00152
00153
00154
00155
00156
00157
00158 double m_neutronYield;
00159
00160
00161
00162
00163 string m_siteName;
00164 Site::Site_t m_site;
00165
00167 TRandom3 m_rnd;
00168
00170 RectangularBox * m_waterPool;
00171
00174 string m_topDetectorElementName;
00176 IGeometryInfo * m_topGeoInfo;
00178 ILVolume * m_topLVolume;
00180 vector<IGeometryInfo *> m_ADs;
00181
00183 ILVolume::Intersections m_intersections;
00186 ILVolume::Intersections m_crucialSegments;
00187
00189 Material * m_mixGas;
00190 Material * m_owsWater;
00191 Material * m_iwsWater;
00192 Material * m_rock;
00193 Material * m_mineralOil;
00194
00198
00199
00200
00201 Gaudi::XYZPoint m_point;
00202 Gaudi::XYZVector m_vec;
00203 Gaudi::XYZVector m_unit;
00204
00205
00207 bool m_crossWater;
00208
00210
00211
00212
00213
00214
00215 double m_trkLengthInWater;
00216
00217
00218 ISolid::Tick m_tickWaterMin;
00219 ISolid::Tick m_tickWaterMax;
00220
00221
00222
00223 double m_trkLengthInWaterThres;
00224
00225
00226
00227
00228
00229
00230
00231
00232 double m_waterPoolTriggerEff;
00233
00235 RpcPlane * m_rpcPlane;
00236
00237 bool m_crossRpc;
00238 HepGeom::Point3D<double> m_rpcIntersect;
00239
00240
00241 MpTriggerStat m_poolTriggerStatus;
00242 MpTriggerStat m_rpcTriggerStatus;
00243
00244
00245
00250
00252 TF1* m_nEnergyPDF;
00254 TF1* m_nAnglePDF;
00257 TF1* m_nLateralPDF;
00258
00259 };
00260
00261
00262 #endif // _MUON_PROPHET_H_