File indexing completed on 2024-04-06 12:13:27
0001 #ifndef CosmicMuonGenerator_h
0002 #define CosmicMuonGenerator_h
0003
0004
0005
0006
0007
0008
0009
0010 #include <CLHEP/Random/RandomEngine.h>
0011 #include <CLHEP/Random/JamesRandom.h>
0012
0013 namespace CLHEP {
0014 class HepRandomEngine;
0015 }
0016
0017 #include <iostream>
0018 #include <string>
0019 #include <vector>
0020 #include "TFile.h"
0021 #include "TTree.h"
0022
0023 #include "GeneratorInterface/CosmicMuonGenerator/interface/sim.h"
0024
0025 #include "GeneratorInterface/CosmicMuonGenerator/interface/CMSCGENnorm.h"
0026 #include "GeneratorInterface/CosmicMuonGenerator/interface/CMSCGEN.h"
0027 #include "GeneratorInterface/CosmicMuonGenerator/interface/CosmicMuonParameters.h"
0028 #include "GeneratorInterface/CosmicMuonGenerator/interface/SingleParticleEvent.h"
0029
0030
0031 class CosmicMuonGenerator {
0032 public:
0033
0034 CosmicMuonGenerator() : delRanGen(false) {
0035
0036 Norm = new CMSCGENnorm();
0037
0038 Cosmics = new CMSCGEN();
0039
0040 NumberOfEvents = 100;
0041 RanSeed = 135799468;
0042 MinP = 3.;
0043 MinP_CMS = MinP;
0044 MaxP = 3000.;
0045 MinTheta = 0. * Deg2Rad;
0046
0047 MaxTheta = 89.0 * Deg2Rad;
0048 MinPhi = 0. * Deg2Rad;
0049 MaxPhi = 360. * Deg2Rad;
0050 MinT0 = -12.5;
0051 MaxT0 = 12.5;
0052 ElossScaleFactor = 1.0;
0053 RadiusOfTarget = 8000.;
0054 ZDistOfTarget = 15000.;
0055 ZCentrOfTarget = 0.;
0056 TrackerOnly = false;
0057 MultiMuon = false;
0058 MultiMuonFileName = "dummy.root";
0059 MultiMuonFileFirstEvent = 0;
0060 MultiMuonNmin = 2;
0061 TIFOnly_constant = false;
0062 TIFOnly_linear = false;
0063 MTCCHalf = false;
0064 EventRate = 0.;
0065 rateErr_stat = 0.;
0066 rateErr_syst = 0.;
0067
0068 SumIntegrals = 0.;
0069 Ngen = 0.;
0070 Nsel = 0.;
0071 Ndiced = 0.;
0072 NotInitialized = true;
0073 Target3dRadius = 0.;
0074 SurfaceRadius = 0.;
0075
0076 PlugVx = PlugOnShaftVx;
0077 PlugVz = PlugOnShaftVz;
0078
0079 RhoAir = 0.001214;
0080 RhoWall = 2.5;
0081 RhoRock = 2.5;
0082 RhoClay = 2.3;
0083 RhoPlug = 2.5;
0084 ClayWidth = 50000;
0085
0086 std::cout << std::endl;
0087 std::cout << "*********************************************************" << std::endl;
0088 std::cout << "*********************************************************" << std::endl;
0089 std::cout << "*** ***" << std::endl;
0090 std::cout << "*** C O S M I C M U O N G E N E R A T O R (vC++) ***" << std::endl;
0091 std::cout << "*** ***" << std::endl;
0092 std::cout << "*********************************************************" << std::endl;
0093 std::cout << "*********************************************************" << std::endl;
0094 std::cout << std::endl;
0095 }
0096
0097
0098 ~CosmicMuonGenerator() {
0099 if (delRanGen)
0100 delete RanGen;
0101 delete Norm;
0102 delete Cosmics;
0103 }
0104
0105
0106
0107 SingleParticleEvent OneMuoEvt;
0108
0109 double EventWeight;
0110 double Trials;
0111
0112 int Id_at;
0113 double Px_at;
0114 double Py_at;
0115 double Pz_at;
0116 double E_at;
0117
0118 double Vx_at;
0119 double Vy_at;
0120 double Vz_at;
0121 double T0_at;
0122 double Theta_at;
0123
0124 std::vector<double> Px_mu;
0125 std::vector<double> Py_mu;
0126 std::vector<double> Pz_mu;
0127 std::vector<double> P_mu;
0128 std::vector<double> Vx_mu;
0129 std::vector<double> Vy_mu;
0130 std::vector<double> Vz_mu;
0131 double Vxz_mu;
0132 std::vector<double> Theta_mu;
0133
0134 std::vector<int> Id_sf;
0135 std::vector<double> Px_sf;
0136 std::vector<double> Py_sf;
0137 std::vector<double> Pz_sf;
0138 std::vector<double> E_sf;
0139
0140 std::vector<double> Vx_sf;
0141 std::vector<double> Vy_sf;
0142 std::vector<double> Vz_sf;
0143 std::vector<double> T0_sf;
0144
0145 std::vector<int> Id_ug;
0146 std::vector<double> Px_ug;
0147 std::vector<double> Py_ug;
0148 std::vector<double> Pz_ug;
0149 std::vector<double> E_ug;
0150
0151 std::vector<double> Vx_ug;
0152 std::vector<double> Vy_ug;
0153 std::vector<double> Vz_ug;
0154 std::vector<double> T0_ug;
0155
0156 private:
0157 TFile* MultiIn;
0158 TTree* MultiTree;
0159 sim* SimTree;
0160 ULong64_t SimTreeEntries;
0161 ULong64_t SimTree_jentry;
0162 int NcloseMultiMuonEvents;
0163 int NskippedMultiMuonEvents;
0164
0165
0166 CMSCGENnorm* Norm;
0167
0168 CMSCGEN* Cosmics;
0169
0170 unsigned int NumberOfEvents;
0171 int RanSeed;
0172 double MinP;
0173 double MinP_CMS;
0174 double MaxP;
0175 double MinTheta;
0176 double MaxTheta;
0177 double MinPhi;
0178 double MaxPhi;
0179 double MinT0;
0180 double MaxT0;
0181 double ElossScaleFactor;
0182 double RadiusOfTarget;
0183 double ZDistOfTarget;
0184 double
0185 ZCentrOfTarget;
0186 bool TrackerOnly;
0187 bool MultiMuon;
0188 std::string MultiMuonFileName;
0189 int MultiMuonFileFirstEvent;
0190 int MultiMuonNmin;
0191 bool TIFOnly_constant;
0192 bool TIFOnly_linear;
0193 bool MTCCHalf;
0194
0195 double EventRate;
0196 double rateErr_stat;
0197 double rateErr_syst;
0198
0199 double SumIntegrals;
0200 double Ngen;
0201 double Nsel;
0202 double Ndiced;
0203 double Target3dRadius;
0204 double SurfaceRadius;
0205 double PlugVx;
0206 double PlugVz;
0207
0208
0209 double RhoAir;
0210 double RhoWall;
0211 double RhoRock;
0212 double RhoClay;
0213 double RhoPlug;
0214 double ClayWidth;
0215
0216
0217 double MinEnu;
0218 double MaxEnu;
0219 double NuProdAlt;
0220
0221 bool AcptAllMu;
0222
0223
0224 CLHEP::HepRandomEngine* RanGen;
0225 bool delRanGen;
0226
0227 bool NotInitialized;
0228 void checkIn();
0229
0230 bool goodOrientation();
0231
0232 void initEvDis();
0233 void displayEv();
0234
0235 public:
0236
0237 void setNumberOfEvents(unsigned int N);
0238 void setRanSeed(int N);
0239 void setMinP(double P);
0240 void setMinP_CMS(double P);
0241 void setMaxP(double P);
0242 void setMinTheta(double Theta);
0243 void setMaxTheta(double Theta);
0244 void setMinPhi(double Phi);
0245 void setMaxPhi(double Phi);
0246 void setMinT0(double T0);
0247 void setMaxT0(double T0);
0248 void setElossScaleFactor(double ElossScaleFact);
0249 void setRadiusOfTarget(double R);
0250 void setZDistOfTarget(double Z);
0251 void setZCentrOfTarget(double Z);
0252 void setTrackerOnly(bool Tracker);
0253 void setMultiMuon(bool MultiMu);
0254 void setMultiMuonFileName(std::string MultiMuonFileName);
0255 void setMultiMuonFileFirstEvent(int MultiMuFile1stEvt);
0256 void setMultiMuonNmin(int MultiMuNmin);
0257 void setTIFOnly_constant(bool TIF);
0258 void setTIFOnly_linear(bool TIF);
0259 void setMTCCHalf(bool MTCC);
0260 void setPlugVx(double PlugVtx);
0261 void setPlugVz(double PlugVtz);
0262 void setRhoAir(double VarRhoAir);
0263 void setRhoWall(double VarRhoSWall);
0264 void setRhoRock(double VarRhoRock);
0265 void setRhoClay(double VarRhoClay);
0266 void setRhoPlug(double VarRhoPlug);
0267 void setClayWidth(double ClayLaeyrWidth);
0268
0269 void setMinEnu(double MinEn);
0270 void setMaxEnu(double MaxEn);
0271 void setNuProdAlt(double NuPrdAlt);
0272 void setAcptAllMu(bool AllMu);
0273
0274
0275 void setRandomEngine(CLHEP::HepRandomEngine* v);
0276 void initialize(CLHEP::HepRandomEngine* rng = nullptr);
0277
0278 void terminate();
0279
0280 void runCMG();
0281
0282 double getRate();
0283
0284 void nextEvent();
0285
0286 bool nextMultiEvent();
0287 };
0288 #endif