253 {
254
255 Double_t start[3] = {0., 0.,
startZ};
256 Double_t end[3] = {0., 0.,
endZ};
257 char ts[20];
258
259
260 Int_t idbase = 1200;
262 Double_t bparam = 0.;
263 Double_t mparam[10];
265 cout << "Info GenieGenerator: MaterialBudget " << start[2] << " - "
266 << end[2] << endl;
267 cout << "Info GenieGenerator: MaterialBudget " << bparam << endl;
268 cout << "Info GenieGenerator: MaterialBudget 0 " << mparam[0] << endl;
269 cout << "Info GenieGenerator: MaterialBudget 1 " << mparam[1] << endl;
270 cout << "Info GenieGenerator: MaterialBudget 2 " << mparam[2] << endl;
271 cout << "Info GenieGenerator: MaterialBudget 3 " << mparam[3] << endl;
272 cout << "Info GenieGenerator: MaterialBudget 4 " << mparam[4] << endl;
273 cout << "Info GenieGenerator: MaterialBudget 5 " << mparam[5] << endl;
274 cout << "Info GenieGenerator: MaterialBudget 6 " << mparam[6] << endl;
275 cout << "Info GenieGenerator: MaterialBudget " << mparam[0] * mparam[4]
276 << endl;
277
278
279 printf("Reading (log10(p),log10(pt)) Hists from file: %s\n",
281 for (Int_t idnu = 12; idnu < 17; idnu += 2) {
282 for (Int_t idadd = -1;
idadd < 2;
idadd += 2) {
283 Int_t
idhnu =
static_cast<int>(idbase + idnu);
284 if (idadd < 0)
idhnu += 1000;
285 sprintf(ts, "%d", idhnu);
286
288 TH2* h2tmp =
dynamic_cast<TH2*
>(
fInputFile->Get(ts));
289 printf("HISTID=%d, Title:%s\n", idhnu, h2tmp->GetTitle());
290 sprintf(ts, "px_%d", idhnu);
291
292
294 Int_t nbinx = h2tmp->GetNbinsX();
295
296
297 for (Int_t k = 1;
k < nbinx + 1;
k += 1) {
298 sprintf(ts, "h%d%d", idhnu, k);
299
301 }
302 }
303 }
304 }
306 }
307
309 LOG(warning) << "End of input file. Rewind.";
310 }
314 cout <<
"Info GenieGenerator: neutrino event-nr " <<
fn << endl;
315 }
316
317
318
319
320 Double_t mparam[10];
321 Double_t pout[3] = {0., 0., -1.};
322 Double_t txnu = 0;
323 Double_t tynu = 0;
324
325
326 while (pout[2] < 0.) {
327
328
329
330
331
332
333
334 Int_t
idhnu = TMath::Abs(
neu) + idbase;
337 Double_t pl10 = log10(
pzv);
339
340
341 if (nbx < 1) nbx = 1;
342 if (nbx > nbinmx) nbx = nbinmx;
344
345 Double_t
pt = pow(10., ptlog10) - 0.01;
346
347 Double_t
phi = gRandom->Uniform(0., 2 * TMath::Pi());
348 pout[0] = cos(phi) *
pt;
349 pout[1] = sin(phi) *
pt;
351
352
353
354 if (pout[2] >= 0.) {
355 pout[2] = TMath::Sqrt(pout[2]);
356 if (gRandom->Uniform(-1., 1.) < 0.) pout[0] = -pout[0];
357 if (gRandom->Uniform(-1., 1.) < 0.) pout[1] = -pout[1];
358
359
360
361 start[0] = (pout[0] / pout[2]) * (start[2] -
ztarget);
362 start[1] = (pout[1] / pout[2]) * (start[2] -
ztarget);
363
364
365 txnu = pout[0] / pout[2];
366 tynu = pout[1] / pout[2];
367 end[0] = txnu * (end[2] -
ztarget);
368 end[1] = tynu * (end[2] -
ztarget);
369
370
371
373
374 }
375 }
376
377 Double_t prob2int = -1.;
381 while (prob2int < gRandom->Uniform(0., 1.)) {
382
383 z = gRandom->Uniform(start[2], end[2]);
386 if (mparam[6] < 0.5) {
387
388
389 prob2int = 2.;
390 } else {
391
392
393 TGeoNode* node = gGeoManager->FindNode(x, y, z);
394 TGeoMaterial* mat = nullptr;
395 if (node && !gGeoManager->IsOutside()) {
396 mat = node->GetVolume()->GetMaterial();
397
398
399
400 prob2int = mat->GetDensity() / mparam[7];
401 if (prob2int > 1.)
402 cout << "***WARNING*** GenieGenerator: prob2int > Maximum density????"
403 << prob2int << " maxrho:" << mparam[7]
404 << " material: " << mat->GetName() << endl;
405 } else {
406 prob2int = 0.;
407 }
408 }
409 }
410
411
412
414 Double_t tof = TMath::Sqrt(x * x + y * y + zrelative * zrelative) /
415 2.99792458e+10;
416 cpg->AddTrack(
417 neu, pout[0], pout[1], pout[2], x, y, z, -1,
false,
418 TMath::Sqrt(pout[0] * pout[0] + pout[1] * pout[1] + pout[2] * pout[2]),
419 tof, mparam[0] * mparam[4]);
421
423 Int_t oLPdgCode =
neu;
425 oLPdgCode = copysign(TMath::Abs(
neu) - 1,
neu);
426 }
428 oLPdgCode = 11;
429 }
430 cpg->AddTrack(oLPdgCode, pp[0], pp[1], pp[2], x, y, z, 0,
true,
El, tof,
431 mparam[0] * mparam[4]);
432
433 for (
int i = 0;
i <
nf;
i++) {
435 cpg->AddTrack(
pdgf[i], pp[0], pp[1], pp[2], x, y, z, 0,
true,
Ef[i], tof,
436 mparam[0] * mparam[4]);
437
438 }
439
440 }
441 return kTRUE;
442}
TH1D * pyslice[3000][100]
double MeanMaterialBudget(std::span< const double, 3 > start, std::span< const double, 3 > end, std::span< double, 10 > mparam)