CMS 3D CMS Logo

CosmicMuonGenerator.h

Go to the documentation of this file.
00001 #ifndef CosmicMuonGenerator_h
00002 #define CosmicMuonGenerator_h
00003 //
00004 // CosmicMuonGenerator by droll (04/DEC/2005)
00005 // modified by P. Biallass 29.03.2006 to implement new cosmic generator (CMSCGEN.cc) 
00006 //
00007 
00008 // include files
00009 #include "GeneratorInterface/CosmicMuonGenerator/interface/CMSCGENnorm.h"
00010 #include "GeneratorInterface/CosmicMuonGenerator/interface/CMSCGEN.h"
00011 #include "GeneratorInterface/CosmicMuonGenerator/interface/CosmicMuonParameters.h"
00012 #include "GeneratorInterface/CosmicMuonGenerator/interface/SingleParticleEvent.h"
00013 #include <iostream>
00014 #include "TRandom2.h"
00015 
00016 
00017 
00018 // class definitions
00019 class CosmicMuonGenerator{
00020 public:
00021   // constructor
00022   CosmicMuonGenerator(){
00023     //initialize class which normalizes flux (added by P.Biallass 29.3.2006)
00024     Norm = new CMSCGENnorm();
00025     //initialize class which produces the cosmic muons  (modified by P.Biallass 29.3.2006)
00026     Cosmics = new CMSCGEN();
00027     // set default control parameters
00028     NumberOfEvents = 100;
00029     RanSeed = 135799468;
00030     MinP =     3.;
00031     MinP_CMS =     MinP;
00032     MaxP =   3000.;
00033     MinTheta =  0.*Deg2Rad;
00034     //MaxTheta = 84.26*Deg2Rad;
00035     MaxTheta = 89.0*Deg2Rad;
00036     MinPhi =    0.*Deg2Rad;
00037     MaxPhi =  360.*Deg2Rad;
00038     MinT0  = -12.5;
00039     MaxT0  =  12.5;
00040     ElossScaleFactor = 1.0;
00041     RadiusOfTarget = 8000.;
00042     ZDistOfTarget = 15000.;
00043     ZCentrOfTarget = 0.;
00044     TrackerOnly = false;
00045     TIFOnly_constant = false;
00046     TIFOnly_linear = false;
00047     MTCCHalf = false;
00048     EventRate = 0.;
00049     rateErr_stat = 0.;
00050     rateErr_syst = 0.;
00051 
00052     SumIntegrals = 0.;
00053     Ngen = 0.;
00054     Nsel = 0.;
00055     Ndiced = 0.;
00056     NotInitialized = true;
00057     Target3dRadius = 0.;
00058     SurfaceRadius = 0.;
00059     //set plug as default onto PX56 shaft
00060     PlugVx = PlugOnShaftVx;
00061     PlugVz = PlugOnShaftVz;
00062 
00063 
00064     std::cout << std::endl;
00065     std::cout << "*********************************************************" << std::endl;
00066     std::cout << "*********************************************************" << std::endl;
00067     std::cout << "***                                                   ***" << std::endl;
00068     std::cout << "***  C O S M I C  M U O N  G E N E R A T O R  (vC++)  ***" << std::endl;
00069     std::cout << "***                                                   ***" << std::endl;
00070     std::cout << "*********************************************************" << std::endl;
00071     std::cout << "*********************************************************" << std::endl;
00072     std::cout << std::endl;
00073   }
00074   // destructor
00075   ~CosmicMuonGenerator(){
00076     delete Norm; 
00077     delete Cosmics;
00078   }
00079   // event with one particle
00080   //SingleParticleEvent OneMuoEvt;
00081   SingleParticleEvent OneMuoEvt;
00082  
00083  
00084 
00085 private:
00086   //initialize class which normalizes flux (added by P.Biallass 29.3.2006)
00087   CMSCGENnorm*  Norm ;
00088   //initialize class which produces the cosmic muons  (modified by P.Biallass 29.3.2006)
00089   CMSCGEN* Cosmics ; 
00090   // default control parameters
00091   unsigned int NumberOfEvents; // number of events to be generated
00092   int    RanSeed; // seed of random number generator
00093   double MinP;     // min. E     [GeV]
00094   double MinP_CMS; // min. E at CMS surface    [GeV]; default is MinE_CMS=MinE, thus no bias from access-shaft
00095   double MaxP;     // max. E     [GeV]
00096   double MinTheta; // min. theta [rad]
00097   double MaxTheta; // max. theta [rad]
00098   double MinPhi;   // min. phi   [rad]
00099   double MaxPhi;   // max. phi   [rad]
00100   double MinT0;    // min. t0   [ns]
00101   double MaxT0;    // max. t0   [ns]
00102   double ElossScaleFactor; // scale factor for energy loss
00103   double RadiusOfTarget; // Radius of target-cylinder which cosmics HAVE to hit [mm], default is CMS-dimensions
00104   double ZDistOfTarget; // z-length of target-cylinder which cosmics HAVE to hit [mm], default is CMS-dimensions
00105   double ZCentrOfTarget; // z-position of centre of target-cylinder which cosmics HAVE to hit [mm], default is Nominal Interaction Point (=0)
00106   bool   TrackerOnly; //if set to "true" detector with tracker-only setup is used, so no material or B-field outside is considerd
00107   bool   TIFOnly_constant; //if set to "true" cosmics can also be generated below 2GeV with unphysical constant energy dependence
00108   bool   TIFOnly_linear; //if set to "true" cosmics can also be generated below 2GeV with unphysical linear energy dependence
00109   bool   MTCCHalf; //if set to "true" muons are sure to hit half of CMS important for MTCC, 
00110                    //still material and B-field of whole CMS is considered
00111   double EventRate; // number of muons per second [Hz]
00112   double rateErr_stat; // stat. error of number of muons per second [Hz]
00113   double rateErr_syst; // syst. error of number of muons per second [Hz] from error of known flux
00114   // other stuff needed
00115   double SumIntegrals; // sum of phase space integrals
00116   double Ngen; // number of generated events
00117   double Nsel; // number of selected events
00118   double Ndiced; // number of diced events
00119   double Target3dRadius; // radius of sphere around target (cylinder)
00120   double SurfaceRadius; // radius for area on surface that has to be considered (for event generation)
00121   double PlugVx; //Plug x position
00122   double PlugVz; //Plug z position
00123 
00124   // random number generator (periodicity > 10**14)
00125   TRandom2 RanGen; 
00126   // check user input
00127   bool NotInitialized;
00128   void checkIn();
00129   // check, if muon is pointing into target
00130   bool goodOrientation();
00131   // event display: initialize + display
00132   void initEvDis();
00133   void displayEv();
00134 
00135 public:
00136   // set parameters
00137   void setNumberOfEvents(unsigned int N);
00138   void setRanSeed(int N);
00139   void setMinP(double P);
00140   void setMinP_CMS(double P);
00141   void setMaxP(double P);
00142   void setMinTheta(double Theta);
00143   void setMaxTheta(double Theta);
00144   void setMinPhi(double Phi);
00145   void setMaxPhi(double Phi);
00146   void setMinT0(double T0);
00147   void setMaxT0(double T0);
00148   void setElossScaleFactor(double ElossScaleFact);
00149   void setRadiusOfTarget(double R);
00150   void setZDistOfTarget(double Z);
00151   void setZCentrOfTarget(double Z);
00152   void setTrackerOnly(bool Tracker);
00153   void setTIFOnly_constant(bool TIF);
00154   void setTIFOnly_linear(bool TIF);
00155   void setMTCCHalf(bool MTCC);
00156   void setPlugVx(double PlugVtx);
00157   void setPlugVz(double PlugVtz);
00158 
00159   // initialize the generator
00160   void initialize();
00161    // prints rate + statistics
00162   void terminate();
00163   // initialize, generate and terminate the Cosmic Muon Generator
00164   void runCMG();
00165   // returns event rate
00166   double getRate();
00167   // generate next event/muon
00168   void nextEvent();
00169 };
00170 #endif

Generated on Tue Jun 9 17:36:53 2009 for CMSSW by  doxygen 1.5.4