1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
#ifndef CosmicMuonGenerator_h
#define CosmicMuonGenerator_h
//
// CosmicMuonGenerator by droll (04/DEC/2005)
// modified by P. Biallass 29.03.2006 to implement new cosmic generator (CMSCGEN.cc)
//
// include files
#include <CLHEP/Random/RandomEngine.h>
#include <CLHEP/Random/JamesRandom.h>
namespace CLHEP {
class HepRandomEngine;
}
#include <iostream>
#include <string>
#include <vector>
#include "TFile.h"
#include "TTree.h"
#include "GeneratorInterface/CosmicMuonGenerator/interface/sim.h"
#include "GeneratorInterface/CosmicMuonGenerator/interface/CMSCGENnorm.h"
#include "GeneratorInterface/CosmicMuonGenerator/interface/CMSCGEN.h"
#include "GeneratorInterface/CosmicMuonGenerator/interface/CosmicMuonParameters.h"
#include "GeneratorInterface/CosmicMuonGenerator/interface/SingleParticleEvent.h"
// class definitions
class CosmicMuonGenerator {
public:
// constructor
CosmicMuonGenerator() : delRanGen(false) {
//initialize class which normalizes flux (added by P.Biallass 29.3.2006)
Norm = new CMSCGENnorm();
//initialize class which produces the cosmic muons (modified by P.Biallass 29.3.2006)
Cosmics = new CMSCGEN();
// set default control parameters
NumberOfEvents = 100;
RanSeed = 135799468;
MinP = 3.;
MinP_CMS = MinP;
MaxP = 3000.;
MinTheta = 0. * Deg2Rad;
//MaxTheta = 84.26*Deg2Rad;
MaxTheta = 89.0 * Deg2Rad;
MinPhi = 0. * Deg2Rad;
MaxPhi = 360. * Deg2Rad;
MinT0 = -12.5;
MaxT0 = 12.5;
ElossScaleFactor = 1.0;
RadiusOfTarget = 8000.;
ZDistOfTarget = 15000.;
ZCentrOfTarget = 0.;
TrackerOnly = false;
MultiMuon = false;
MultiMuonFileName = "dummy.root";
MultiMuonFileFirstEvent = 0;
MultiMuonNmin = 2;
TIFOnly_constant = false;
TIFOnly_linear = false;
MTCCHalf = false;
EventRate = 0.;
rateErr_stat = 0.;
rateErr_syst = 0.;
SumIntegrals = 0.;
Ngen = 0.;
Nsel = 0.;
Ndiced = 0.;
NotInitialized = true;
Target3dRadius = 0.;
SurfaceRadius = 0.;
//set plug as default onto PX56 shaft
PlugVx = PlugOnShaftVx;
PlugVz = PlugOnShaftVz;
//material densities in g/cm^3
RhoAir = 0.001214;
RhoWall = 2.5;
RhoRock = 2.5;
RhoClay = 2.3;
RhoPlug = 2.5;
ClayWidth = 50000; //[mm]
std::cout << std::endl;
std::cout << "*********************************************************" << std::endl;
std::cout << "*********************************************************" << std::endl;
std::cout << "*** ***" << std::endl;
std::cout << "*** C O S M I C M U O N G E N E R A T O R (vC++) ***" << std::endl;
std::cout << "*** ***" << std::endl;
std::cout << "*********************************************************" << std::endl;
std::cout << "*********************************************************" << std::endl;
std::cout << std::endl;
}
// destructor
~CosmicMuonGenerator() {
if (delRanGen)
delete RanGen;
delete Norm;
delete Cosmics;
}
// event with one particle
//SingleParticleEvent OneMuoEvt;
SingleParticleEvent OneMuoEvt;
double EventWeight; //for multi muon events
double Trials; //for multi muon events
int Id_at;
double Px_at;
double Py_at;
double Pz_at;
double E_at;
//double M_at;
double Vx_at;
double Vy_at;
double Vz_at;
double T0_at;
double Theta_at;
std::vector<double> Px_mu;
std::vector<double> Py_mu;
std::vector<double> Pz_mu;
std::vector<double> P_mu;
std::vector<double> Vx_mu;
std::vector<double> Vy_mu;
std::vector<double> Vz_mu;
double Vxz_mu;
std::vector<double> Theta_mu;
std::vector<int> Id_sf;
std::vector<double> Px_sf;
std::vector<double> Py_sf;
std::vector<double> Pz_sf;
std::vector<double> E_sf;
//std::vector<double> M_sf;
std::vector<double> Vx_sf;
std::vector<double> Vy_sf;
std::vector<double> Vz_sf;
std::vector<double> T0_sf;
std::vector<int> Id_ug;
std::vector<double> Px_ug;
std::vector<double> Py_ug;
std::vector<double> Pz_ug;
std::vector<double> E_ug;
//std::vector<double> M_ug;
std::vector<double> Vx_ug;
std::vector<double> Vy_ug;
std::vector<double> Vz_ug;
std::vector<double> T0_ug;
private:
TFile* MultiIn; //file to be read in
TTree* MultiTree; //tree of file with multi muon events
sim* SimTree; //class to acces tree branches
ULong64_t SimTreeEntries;
ULong64_t SimTree_jentry;
int NcloseMultiMuonEvents;
int NskippedMultiMuonEvents;
//initialize class which normalizes flux (added by P.Biallass 29.3.2006)
CMSCGENnorm* Norm;
//initialize class which produces the cosmic muons (modified by P.Biallass 29.3.2006)
CMSCGEN* Cosmics;
// default control parameters
unsigned int NumberOfEvents; // number of events to be generated
int RanSeed; // seed of random number generator
double MinP; // min. E [GeV]
double MinP_CMS; // min. E at CMS surface [GeV]; default is MinE_CMS=MinE, thus no bias from access-shaft
double MaxP; // max. E [GeV]
double MinTheta; // min. theta [rad]
double MaxTheta; // max. theta [rad]
double MinPhi; // min. phi [rad]
double MaxPhi; // max. phi [rad]
double MinT0; // min. t0 [ns]
double MaxT0; // max. t0 [ns]
double ElossScaleFactor; // scale factor for energy loss
double RadiusOfTarget; // Radius of target-cylinder which cosmics HAVE to hit [mm], default is CMS-dimensions
double ZDistOfTarget; // z-length of target-cylinder which cosmics HAVE to hit [mm], default is CMS-dimensions
double
ZCentrOfTarget; // z-position of centre of target-cylinder which cosmics HAVE to hit [mm], default is Nominal Interaction Point (=0)
bool TrackerOnly; //if set to "true" detector with tracker-only setup is used, so no material or B-field outside is considerd
bool MultiMuon; //read in multi-muon events from file instead of generating single muon events
std::string MultiMuonFileName; //file containing multi muon events, to be read in
int MultiMuonFileFirstEvent; //first multi muon event, to be read in
int MultiMuonNmin; //minimal number of multi muons per event reaching the cylinder surrounding CMS
bool TIFOnly_constant; //if set to "true" cosmics can also be generated below 2GeV with unphysical constant energy dependence
bool TIFOnly_linear; //if set to "true" cosmics can also be generated below 2GeV with unphysical linear energy dependence
bool MTCCHalf; //if set to "true" muons are sure to hit half of CMS important for MTCC,
//still material and B-field of whole CMS is considered
double EventRate; // number of muons per second [Hz]
double rateErr_stat; // stat. error of number of muons per second [Hz]
double rateErr_syst; // syst. error of number of muons per second [Hz] from error of known flux
// other stuff needed
double SumIntegrals; // sum of phase space integrals
double Ngen; // number of generated events
double Nsel; // number of selected events
double Ndiced; // number of diced events
double Target3dRadius; // radius of sphere around target (cylinder)
double SurfaceRadius; // radius for area on surface that has to be considered (for event generation)
double PlugVx; //Plug x position
double PlugVz; //Plug z position
//material densities in g/cm^3
double RhoAir;
double RhoWall;
double RhoRock;
double RhoClay;
double RhoPlug;
double ClayWidth; //[mm]
//For upgoing muon generation: Neutrino energy limits
double MinEnu;
double MaxEnu;
double NuProdAlt;
bool AcptAllMu; //Accepting All Muons regardeless of direction
// random number generator
CLHEP::HepRandomEngine* RanGen;
bool delRanGen;
// check user input
bool NotInitialized;
void checkIn();
// check, if muon is pointing into target
bool goodOrientation();
// event display: initialize + display
void initEvDis();
void displayEv();
public:
// set parameters
void setNumberOfEvents(unsigned int N);
void setRanSeed(int N);
void setMinP(double P);
void setMinP_CMS(double P);
void setMaxP(double P);
void setMinTheta(double Theta);
void setMaxTheta(double Theta);
void setMinPhi(double Phi);
void setMaxPhi(double Phi);
void setMinT0(double T0);
void setMaxT0(double T0);
void setElossScaleFactor(double ElossScaleFact);
void setRadiusOfTarget(double R);
void setZDistOfTarget(double Z);
void setZCentrOfTarget(double Z);
void setTrackerOnly(bool Tracker);
void setMultiMuon(bool MultiMu);
void setMultiMuonFileName(std::string MultiMuonFileName);
void setMultiMuonFileFirstEvent(int MultiMuFile1stEvt);
void setMultiMuonNmin(int MultiMuNmin);
void setTIFOnly_constant(bool TIF);
void setTIFOnly_linear(bool TIF);
void setMTCCHalf(bool MTCC);
void setPlugVx(double PlugVtx);
void setPlugVz(double PlugVtz);
void setRhoAir(double VarRhoAir);
void setRhoWall(double VarRhoSWall);
void setRhoRock(double VarRhoRock);
void setRhoClay(double VarRhoClay);
void setRhoPlug(double VarRhoPlug);
void setClayWidth(double ClayLaeyrWidth);
void setMinEnu(double MinEn);
void setMaxEnu(double MaxEn);
void setNuProdAlt(double NuPrdAlt);
void setAcptAllMu(bool AllMu);
// initialize the generator
void setRandomEngine(CLHEP::HepRandomEngine* v);
void initialize(CLHEP::HepRandomEngine* rng = nullptr);
// prints rate + statistics
void terminate();
// initialize, generate and terminate the Cosmic Muon Generator
void runCMG();
// returns event rate
double getRate();
// generate next event/muon
void nextEvent();
// generate next multi muon event
bool nextMultiEvent();
};
#endif
|