/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

MuonProphet.h
Go to the documentation of this file.
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 // random
00038 #include "GaudiKernel/RndmGenerators.h"
00039 #include "GaudiKernel/IRndmGenSvc.h"
00040 
00041 // root
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   // HepMCEventMutator interface
00062   virtual StatusCode mutate(HepMC::GenEvent& event);
00063   
00064  private:
00065   // Predict the fate of a muon, alter the status of the muon track.
00066   // At this moment, fast simulation is enforced to all muon track.
00068   MpMuonFate predictMuonFate(HepMC::GenEvent& event);
00069   // get all geometry related parameters
00070   StatusCode geometryCalculationInit();
00071   StatusCode geometryCalculation(HepMC::GenParticle * pMuon);
00072 
00073   // Triggered by RPC?
00074   MpTriggerStat triggeredByRpc(HepMC::GenParticle * pMuon);
00075   // Triggered by water pool?
00076   MpTriggerStat triggeredByWaterPool(HepMC::GenParticle * pMuon);
00077   // to do: I need a more complicate function to show the 
00078   // relation between a muon track and water pool.
00079   // path length in water pool
00080   // double pathLengthInWaterPool();
00081 
00082   // For a given muon track, add spallation products, return number of tracks added,
00083   // and negtive for failure.
00087   int spallationProducts(HepMC::GenEvent& event, int idx);
00091   bool generateOneBkg(int idx,  /* used to find the property of one background */
00092                       HepMC::ThreeVector& bkgPoint);
00093 
00096   StatusCode spallationNeutronsInit();
00098   int spallationNeutrons(HepMC::GenEvent& event);
00100   int generateNeutrons(HepMC::GenEvent *bkgEvt,
00101                        ISolid::Tick tickBegin, // In fact it is a double, indicate the first intersection with the volume
00102                        ISolid::Tick tickEnd,   // Indecate the last intersection with the volume. See m_point, m_vec and m_unit
00103                        double multiplicity);
00104 
00105   StatusCode printout(HepMC::GenEvent& event); // printout all vertex and particle info
00107   // Put a spallation background to position
00108   void setPosition(HepMC::GenEvent& event, HepMC::ThreeVector& position);
00109   // Set a spallation background to right time
00110   void setTime(HepMC::GenEvent& event, double t0, double lifetime);
00111 
00112 
00113   // A switch to turn on or off the whole module
00114   bool m_active;
00115 
00116   // My muon track
00117   HepMC::GenParticle * m_muon;
00118 
00121   // name of them
00122   vector<std::string>         m_genToolNames;
00123   // id for them. An ID for each of them for easier and faster operation
00124   vector<int>                 m_genId;
00125   // the genTool (generator)
00126   vector<IHepMCEventMutator*> m_genTools;
00127   /*
00128    *  About spallation background yield, I take the convention from KamLAND.
00129    *  arXiv:0907.0066
00130    *  The first set of parameters are also from it.
00131    *
00132    *  Yield = N_bkg / (Muon_Rate * Detector_Live_Time * LS_density * Track_length)  
00133    *  [Yield] = 1/[g/cm^2]
00134    *
00135    *  The yield is also assumed to obey a power-law function of muon energy.
00136    *  (E_mu)^alpha
00137    *  alpha = 0.77 in the first version
00138    *  
00139    *  15 Oct. 2009
00140    */
00141   // Spallation background yield
00142   vector<double>              m_genYields;
00143   // The energy at which the yield is measured
00144   vector<double>              m_genYieldMeasuredAt;
00145   // Lifetime for each background
00146   vector<double>              m_genLifetimes;
00147 
00148 
00149   // turn on or off neutron production
00150   bool m_actNeutron;
00151   // Neutron must have its own generator. 
00152   // Neutron is special. They should be generated everywhere and with initial momentum.
00153   
00154   // Neutron yield. Normally it will pick a NeutronYield function.
00155   // However sometimes it is very convinient to set this manually.
00156   // <0:  use Neutron Yield function (default)
00157   // >=0: use the value of this parameter.
00158   double m_neutronYield;
00159 
00160 
00161   // Site
00162   // See Conventions/Site.h for conventions
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   // m_point primary vertex
00199   // m_vec   momentum vector
00200   // m_unit  unit vector of momentum direction
00201   Gaudi::XYZPoint   m_point;
00202   Gaudi::XYZVector  m_vec;
00203   Gaudi::XYZVector  m_unit;
00204 
00205 
00207   bool m_crossWater;
00208   /*  Not in use
00210   HepGeom::Point3D<double> m_crossWaterA;
00211   HepGeom::Point3D<double> m_crossWaterB;
00212   */  
00213 
00214   // Track length in water
00215   double m_trkLengthInWater;
00216   // The value of t when muon track intersects with water pool. 
00217   // See m_point for conventions.
00218   ISolid::Tick  m_tickWaterMin;
00219   ISolid::Tick  m_tickWaterMax;
00220 
00221   // Longer than that will be considered to have high trigger rate
00222   // For example 20cm.
00223   double m_trkLengthInWaterThres;
00224 
00225   /*
00226   // Trigger efficiency in the high trigger rate
00227   // Even a track length is longer than 20 cm, there is still a chance
00228   // it will miss trigger. Like travel through some dead material,
00229   // or it is scattered before it enters water pool
00230   // to do: However the inefficiency is correlated with other system, not in use.
00231   */
00232   double m_waterPoolTriggerEff;
00233 
00235   RpcPlane * m_rpcPlane;                       
00236   // does a track intersect with rpc and if yes, where it is?
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_
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:21:29 for MuonProphet by doxygen 1.7.4