101 LOG(warning) <<
"End of input file. Rewind.";
106 LOG(info) <<
"Info MuDISGenerator: MuDIS event-nr " <<
fn;
109 int nf =
dPart->GetEntries();
110 LOG(
debug) <<
"*********************************************************";
111 LOG(
debug) <<
"muon DIS Generator debug " <<
iMuon->GetEntries() <<
" "
112 <<
iMuon->AddrAt(0) <<
" nf " << nf <<
" fn=" <<
fn;
115 Double_t start[3] = {0., 0.,
startZ};
116 Double_t end[3] = {0., 0.,
endZ};
121 TVectorD* mu =
dynamic_cast<TVectorD*
>(
iMuon->AddrAt(0));
122 LOG(
debug) <<
"muon DIS Generator in muon " << int((*mu)[0]);
123 Double_t x = (*mu)[5] * 100.;
124 Double_t y = (*mu)[6] * 100.;
125 Double_t z = (*mu)[7] * 100.;
128 Double_t cross_sec = (*mu)[10];
129 Double_t t_muon = (*mu)[11];
130 Double_t DIS_multiplicity = 1 / (*mu)[12];
135 Double_t txmu = (*mu)[1] / (*mu)[3];
136 Double_t tymu = (*mu)[2] / (*mu)[3];
137 start[0] = x - (z - start[2]) * txmu;
138 start[1] = y - (z - start[2]) * tymu;
139 end[0] = x - (z - end[2]) * txmu;
140 end[1] = y - (z - end[2]) * tymu;
141 LOG(
debug) <<
"MuDIS: mu xyz position " << x <<
", " << y <<
", " << z;
142 LOG(
debug) <<
"MuDIS: mu pxyz position " << (*mu)[1] <<
", " << (*mu)[2]
144 LOG(
debug) <<
"MuDIS: mu weight*DISmultiplicity " << w;
145 LOG(
debug) <<
"MuDIS: mu DIS cross section " << cross_sec;
146 LOG(
debug) <<
"MuDIS: start position " << start[0] <<
", " << start[1] <<
", "
148 LOG(
debug) <<
"MuDIS: end position " << end[0] <<
", " << end[1] <<
", "
155 Double_t prob2int = 0.;
160 LOG(
debug) <<
"Info MuDISGenerator Start prob2int while loop, bparam= "
161 << bparam <<
", " << bparam * 1.e8;
162 LOG(
debug) <<
"Info MuDISGenerator What was maximum density, mparam[7]= "
163 << mparam[7] <<
", " << mparam[7] * 1.e8;
165 while (prob2int < gRandom->Uniform(0., 1.)) {
167 zmu = gRandom->Uniform(start[2], end[2]);
168 xmu = x - (z - zmu) * txmu;
169 ymu = y - (z - zmu) * tymu;
171 TGeoNode* node = gGeoManager->FindNode(xmu, ymu, zmu);
172 TGeoMaterial* mat =
nullptr;
173 if (node && !gGeoManager->IsOutside()) {
174 mat = node->GetVolume()->GetMaterial();
175 LOG(
debug) <<
"Info MuDISGenerator: mat " << count <<
", "
176 << mat->GetName() <<
", " << mat->GetDensity();
179 prob2int = mat->GetDensity() / mparam[7];
181 LOG(warning) <<
"MuDISGenerator: prob2int > Maximum density????";
182 LOG(warning) <<
"prob2int: " << prob2int;
183 LOG(warning) <<
"maxrho: " << mparam[7];
184 LOG(warning) <<
"material: " << mat->GetName();
193 LOG(
debug) <<
"Info MuDISGenerator: prob2int " << prob2int <<
", " << count;
194 LOG(
debug) <<
"MuDIS: put position " << xmu <<
", " << ymu <<
", " << zmu;
197 TMath::Sqrt(TMath::Power((*mu)[1], 2) + TMath::Power((*mu)[2], 2) +
198 TMath::Power((*mu)[3], 2));
201 TMath::Sqrt(TMath::Power(x - xmu, 2) + TMath::Power(y - ymu, 2) +
202 TMath::Power(z - zmu, 2));
204 static const Double_t muon_mass =
205 TDatabasePDG::Instance()->GetParticle(13)->Mass();
208 TMath::Sqrt(TMath::Power(total_mom, 2) + TMath::Power(muon_mass, 2));
209 Double_t t_rmu = distance / v;
216 Double_t t_DIS = (t_muon + t_rmu) /
219 cpg->AddTrack(
static_cast<int>((*mu)[0]),
220 (*mu)[1], (*mu)[2], (*mu)[3], xmu, ymu, zmu, -1,
225 w * DIS_multiplicity);
231 w = mparam[0] * mparam[4];
234 for (
auto&& particle : *
dPart) {
235 TVectorD* Part =
dynamic_cast<TVectorD*
>(particle);
236 LOG(
debug) <<
"muon DIS Generator out part " << int((*Part)[0]);
237 LOG(
debug) <<
"muon DIS Generator out part mom " << (*Part)[1] <<
" "
238 << (*Part)[2] <<
" " << (*Part)[3] <<
" " << (*Part)[4];
239 LOG(
debug) <<
"muon DIS Generator out part pos " << xmu <<
" " << ymu <<
""
241 LOG(
debug) <<
"muon DIS Generator out part w " << w;
244 cpg->AddTrack(
static_cast<int>((*Part)[0]), (*Part)[1], (*Part)[2],
245 (*Part)[3], xmu, ymu, zmu, 0,
true, (*Part)[4], t_DIS,
248 cpg->AddTrack(
static_cast<int>((*Part)[0]), (*Part)[1], (*Part)[2],
249 (*Part)[3], xmu, ymu, zmu, 0,
true, (*Part)[4], t_DIS, w);
257 TVectorD* SoftPart =
dynamic_cast<TVectorD*
>(softParticle);
258 if ((*SoftPart)[7] > zmu) {
263 cpg->AddTrack(
static_cast<int>((*SoftPart)[0]), (*SoftPart)[1],
264 (*SoftPart)[2], (*SoftPart)[3], (*SoftPart)[5],
265 (*SoftPart)[6], (*SoftPart)[7], 0,
true, (*SoftPart)[4],