306{
308
310
311
312
315 {
316 Double_t bparam=0.;
319 cout <<
"Info NuageGenerator: MaterialBudget " <<
start[2] <<
" - "<<
end[2] << endl;
320 cout << "Info NuageGenerator: MaterialBudget " << bparam << endl;
321 cout <<
"Info NuageGenerator: MaterialBudget 0 " <<
mparam[0] << endl;
322 cout <<
"Info NuageGenerator: MaterialBudget 1 " <<
mparam[1] << endl;
323 cout <<
"Info NuageGenerator: MaterialBudget 2 " <<
mparam[2] << endl;
324 cout <<
"Info NuageGenerator: MaterialBudget 3 " <<
mparam[3] << endl;
325 cout <<
"Info NuageGenerator: MaterialBudget 4 " <<
mparam[4] << endl;
326 cout <<
"Info NuageGenerator: MaterialBudget 5 " <<
mparam[5] << endl;
327 cout <<
"Info NuageGenerator: MaterialBudget 6 " <<
mparam[6] << endl;
328 cout <<
"Info NuageGenerator: MaterialBudget " <<
mparam[0]*
mparam[4] << endl;
329
331 }
332
333
334
336 {
337 LOG(WARNING) << "End of input file. Rewind.";
338 }
342 {
343 cout <<
"Info NuageGenerator: neutrino event-nr "<<
fn << endl;
344 }
345
346
347 Double_t zMean = (
start[2]+
end[2])/2;
348
349 Double_t zBD = zMean -
ztarget;
350
351
352 Double_t ThetaXMax =
startX/zBD;
353 Double_t ThetaXMin =
endX/zBD;
354 Double_t ThetaYMax =
startY/zBD;
355 Double_t ThetaYMin =
endY/zBD;
356
357
358
359
360
361
362 Double_t bparam=0.;
364 Double_t pout[3] ;
365 Double_t txnu=0;
366 Double_t tynu=0;
367
368
369 while (bparam<1.e-10)
370 {
371 txnu = gRandom->Uniform(ThetaXMax,ThetaXMin);
372 tynu = gRandom->Uniform(ThetaYMax,ThetaYMin);
373
374 pout[2] =
pzv*
pzv/(1+txnu*txnu+tynu*tynu);
375
376 if (pout[2]>0.)
377 {
378 pout[2]=TMath::Sqrt(pout[2]);
379 pout[0] = pout[2]*txnu;
380 pout[1] = pout[2]*tynu;
381
382
383
384
387
388
391
392
393
395
396 }
397 else bparam = 1.e-10;
398 }
399
400
401 Double_t prob2int = 0.;
405
406
407
408 while (prob2int<gRandom->Uniform(0.,1.))
409 {
410 z=gRandom->Uniform(start[2],end[2]);
411
414
415
416
417 TGeoNode *
node = gGeoManager->FindNode(x,y,z);
418 TGeoMaterial *mat = 0;
419 if (node && !gGeoManager->IsOutside()) mat =
node->GetVolume()->GetMaterial();
420
421
422
423 prob2int= mat->GetDensity()/
mparam[7];
424
425 if (prob2int>1.)
426 cout <<
"***WARNING*** NuageGenerator: prob2int > Maximum density????" << prob2int <<
" maxrho:" <<
mparam[7] <<
" material: " << mat->GetName() << endl;
427
428 }
429
430
431
432
434 Double_t tof=TMath::Sqrt(x*x+y*y+zrelative*zrelative)/2.99792458e+6;
435 cpg->AddTrack(
neu,pout[0],pout[1],pout[2],x,y,z,-1,
false,TMath::Sqrt(pout[0]*pout[0]+pout[1]*pout[1]+pout[2]*pout[2]),tof,mparam[0]*mparam[4]);
437 {
438
440 Int_t oLPdgCode =
neu;
441 Int_t nAddTrk=0;
443 {
444 oLPdgCode = copysign(TMath::Abs(
neu)-1,
neu);
445 }
446 if(TMath::Abs(oLPdgCode)!=15)
447 {
448 cpg->AddTrack(oLPdgCode,pp[0],pp[1],pp[2],x,y,z,0,true,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof,mparam[0]*mparam[4]);
449 nAddTrk++;
450 }
451
452 if(TMath::Abs(oLPdgCode)==15)
453 {
455 {
456 cpg->AddTrack(oLPdgCode,pp[0],pp[1],pp[2],x,y,z,0,false,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof,mparam[0]*mparam[4]);
457 nAddTrk++;
459 {
460
461 Double_t x2=0., y2=0., z2=0.;
465 Double_t zrelative2 = z2-
z;
466 Double_t tof2=TMath::Sqrt(x2*x2+y2*y2+zrelative2*zrelative2)/2.99792458e+6;
467 for(
int j=0;
j<
nf2;
j++)
468 {
470 cpg->AddTrack(
pdgf2[j],pp[0],pp[1],pp[2],x2,y2,z2,nAddTrk,
true,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof2,mparam[0]*mparam[4]);
471
472 }
474 }
475
477 {
478
479 Double_t x3=0., y3=0., z3=0.;
483 Double_t zrelative3 = z3-
z;
484 Double_t tof3=TMath::Sqrt(x3*x3+y3*y3+zrelative3*zrelative3)/2.99792458e+6;
485 for(
int j=0;
j<
nf3;
j++)
486 {
488 cpg->AddTrack(
pdgf3[j],pp[0],pp[1],pp[2],x3,y3,z3,nAddTrk,
true,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof3,mparam[0]*mparam[4]);
489 }
491 }
493 {
494
495 Double_t x4=0., y4=0.,
z4=0.;
499 Double_t zrelative4 =
z4-
z;
500 Double_t tof4=TMath::Sqrt(x4*x4+y4*y4+zrelative4*zrelative4)/2.99792458e+6;
501 for(
int j=0;
j<
nf4;
j++)
502 {
504 cpg->AddTrack(
pdgf4[j],pp[0],pp[1],pp[2],x4,y4,z4,nAddTrk,
true,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof4,mparam[0]*mparam[4]);
505 }
507 }
508 }
509 else
510 cpg->AddTrack(oLPdgCode,pp[0],pp[1],pp[2],x,y,z,0,true,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof,mparam[0]*mparam[4]);
511 }
512
513
514
515 for(
int i=0;
i<
nf;
i++)
516 {
518 if(Abs(
pdgf[i])!= 411&&Abs(
pdgf[i])!=421&&Abs(
pdgf[i])!=431&&Abs(
pdgf[i])!=4122)
519 {
520 cpg->AddTrack(
pdgf[i],pp[0],pp[1],pp[2],x,y,z,0,
true,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof,mparam[0]*mparam[4]);
521 nAddTrk++;
522 }
523
524 if(Abs(
pdgf[i]) == 411 || Abs(
pdgf[i])==421 || Abs(
pdgf[i])==431||Abs(
pdgf[i])==4122)
525 cout << "charm particle " << endl;
526 {
528 {
529
530 cpg->AddTrack(
pdgf[i],pp[0],pp[1],pp[2],x,y,z,0,
false,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof,mparam[0]*mparam[4]);
531 nAddTrk++;
533 {
534
535 Double_t x2=0., y2=0., z2=0.;
539 Double_t zrelative2 = z2-
z;
540 Double_t tof2=TMath::Sqrt(x2*x2+y2*y2+zrelative2*zrelative2)/2.99792458e+6;
541 for(
int j=0;
j<
nf2;
j++)
542 {
544 cpg->AddTrack(
pdgf2[j],pp[0],pp[1],pp[2],x2,y2,z2,nAddTrk,
true,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof2,mparam[0]*mparam[4]);
545
546 }
548 }
549
551 {
552
553 Double_t x3=0., y3=0., z3=0.;
557 Double_t zrelative3 = z3-
z;
558 Double_t tof3=TMath::Sqrt(x3*x3+y3*y3+zrelative3*zrelative3)/2.99792458e+6;
559 for(
int j=0;
j<
nf3;
j++)
560 {
562 cpg->AddTrack(
pdgf3[j],pp[0],pp[1],pp[2],x3,y3,z3,nAddTrk,
true,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof3,mparam[0]*mparam[4]);
563 }
565 }
567 {
568
569 Double_t x4=0., y4=0.,
z4=0.;
573 Double_t zrelative4 =
z4-
z;
574 Double_t tof4=TMath::Sqrt(x4*x4+y4*y4+zrelative4*zrelative4)/2.99792458e+6;
575 for(
int j=0;
j<
nf4;
j++)
576 {
578 cpg->AddTrack(
pdgf4[j],pp[0],pp[1],pp[2],x4,y4,z4,nAddTrk,
true,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof4,mparam[0]*mparam[4]);
579 }
581 }
582 }
583 else
584 cpg->AddTrack(
pdgf[i],pp[0],pp[1],pp[2],x,y,z,0,
true,TMath::Sqrt(pp[0]*pp[0]+pp[1]*pp[1]+pp[2]*pp[2]),tof,mparam[0]*mparam[4]);
585 }
586
587
588 }
589 }
590
591 return kTRUE;
592}
Double_t MeanMaterialBudget(const Double_t *start, const Double_t *end, Double_t *mparam)
std::vector< double > Rotate(Double_t x, Double_t y, Double_t z, Double_t px, Double_t py, Double_t pz)