459{
460
462
463
464
465 if (
fTree->GetEntry(
fn) == 0 )
return kFALSE;
466
468 cout <<
"Info GenieGenerator: neutrino event-nr "<<
fn << endl;
469 }
470
472
473
477 -1,
478 false);
479
480
481 int outgoing_lepton_pdg =
neu;
482 if (
cc) outgoing_lepton_pdg = copysign(TMath::Abs(
neu)-1,
neu);
483 if (
nuel) outgoing_lepton_pdg = 11;
484
485 bool track_outgoing_lepton = (
cc ||
nuel) ?
true : false;
486 cpg->AddTrack(outgoing_lepton_pdg,
489 0,
490 track_outgoing_lepton);
491
492
493 for (
int i_hadron = 0; i_hadron <
nf; i_hadron++){
494 cpg->AddTrack(
pdgf[i_hadron],
495 pxf[i_hadron],
pyf[i_hadron],
pzf[i_hadron],
497 0,
498 true);
499 }
500
501
502 FairMCEventHeader*
header = cpg->GetEvent();
505
506 return kTRUE;
507
508 } else {
509
512 char ts[20];
513
514
515 Int_t idbase=1200;
517 Double_t bparam=0.;
520 cout <<
"Info GenieGenerator: MaterialBudget " <<
start[2] <<
" - "<<
end[2] << endl;
521 cout << "Info GenieGenerator: MaterialBudget " << bparam << endl;
522 cout <<
"Info GenieGenerator: MaterialBudget 0 " <<
mparam[0] << endl;
523 cout <<
"Info GenieGenerator: MaterialBudget 1 " <<
mparam[1] << endl;
524 cout <<
"Info GenieGenerator: MaterialBudget 2 " <<
mparam[2] << endl;
525 cout <<
"Info GenieGenerator: MaterialBudget 3 " <<
mparam[3] << endl;
526 cout <<
"Info GenieGenerator: MaterialBudget 4 " <<
mparam[4] << endl;
527 cout <<
"Info GenieGenerator: MaterialBudget 5 " <<
mparam[5] << endl;
528 cout <<
"Info GenieGenerator: MaterialBudget 6 " <<
mparam[6] << endl;
529 cout <<
"Info GenieGenerator: MaterialBudget " <<
mparam[0]*
mparam[4] << endl;
530
531
532 printf(
"Reading (log10(p),log10(pt)) Hists from file: %s\n",
fInputFile->GetName());
533 for (Int_t idnu=12;idnu<17;idnu+=2){
535 Int_t
idhnu=idbase+idnu;
536 if (idadd<0)
idhnu+=1000;
537 sprintf(ts,"%d",idhnu);
538
541 printf("HISTID=%d, Title:%s\n",idhnu,h2tmp->GetTitle());
542 sprintf(ts,"px_%d",idhnu);
543
545 Int_t nbinx=h2tmp->GetNbinsX();
546
547
548 for (Int_t k=1;
k<nbinx+1;
k+=1){
549 sprintf(ts,"h%d%d",idhnu,k);
550
552 }
553 }
554 }
555 }
557 }
558 if (
fn==
fNevents) {LOG(WARNING) <<
"End of input file. Rewind.";}
563 cout <<
"Info GenieGenerator: neutrino event-nr "<<
fn << endl;
564 }
565
566
567
568
569 Double_t bparam=0.;
571 Double_t pout[3];
572 pout[2]=-1.;
573 Double_t txnu=0;
574 Double_t tynu=0;
575
576
577 while (pout[2]<0.) {
578
579
580
581
582
585 fTree->GetEntry(nuevent);
586
589 double pt = sqrt(pout[0]*pout[0] + pout[1]*pout[1]);
591 }
593
594 TParticle *nuparticle = (TParticle*)
ancstr->At(0);
595 TVector3 * nup = new TVector3(nuparticle->Px(), nuparticle->Py(), nuparticle->Pz());
596
598
600 fTree->GetEntry(nuevent);
601
602 pout[0] = nup->Px()/nup->Pz() *
pzv;
603 pout[1] = nup->Py()/nup->Pz() *
pzv;
604 double pt = sqrt(pout[0]*pout[0] + pout[1]*pout[1]);
606 }
607
609
613 Double_t pl10=log10(
pzv);
615
616 if (nbx<1) nbx=1;
617 if (nbx>nbinmx) nbx=nbinmx;
619
620 Double_t
pt=pow(10.,ptlog10)-0.01;
621
622 Double_t
phi=gRandom->Uniform(0.,2*TMath::Pi());
623 pout[0] = cos(phi)*
pt;
624 pout[1] = sin(phi)*
pt;
626
627 }
628 if (pout[2]>=0.) {
629 pout[2]=TMath::Sqrt(pout[2]);
630
632 if (gRandom->Uniform(-1.,1.)<0.) pout[0]=-pout[0];
633 if (gRandom->Uniform(-1.,1.)<0.) pout[1]=-pout[1];
634 }
635
636
639
643 }
644
645 txnu=pout[0]/pout[2];
646 tynu=pout[1]/pout[2];
649
653 }
654
655
657
658 }
659 }
660
661 Double_t prob2int = -1.;
666 while (prob2int<gRandom->Uniform(0.,1.)) {
667
668 z=gRandom->Uniform(start[2],end[2]);
671
675 }
676 if (mparam[6]<0.5){
677
678 prob2int=2.;
679 }else{
680
681 TGeoNode *
node = gGeoManager->FindNode(x,y,z);
682 TGeoMaterial *mat = 0;
683 if (node && !gGeoManager->IsOutside()) {
684 mat =
node->GetVolume()->GetMaterial();
685
686
687 prob2int= mat->GetDensity()/
mparam[7];
688 if (prob2int>1.) cout <<
"***WARNING*** GenieGenerator: prob2int > Maximum density????" << prob2int <<
" maxrho:" <<
mparam[7] <<
" material: " << mat->GetName() << endl;
690 }else{
691 prob2int=0.;
692 }
693 }
694 }
695
696
698 Double_t tof=TMath::Sqrt(x*x+y*y+zrelative*zrelative)/2.99792458e+6;
699 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]);
701
703 Int_t oLPdgCode =
neu;
704 if (
cc){oLPdgCode = copysign(TMath::Abs(
neu)-1,
neu);}
705 if (
nuel){oLPdgCode = 11;}
706 cpg->AddTrack(oLPdgCode,pp[0],pp[1],pp[2],x,y,z,0,
true,
El,tof,mparam[0]*mparam[4]);
707
708 for(
int i=0;
i<
nf;
i++)
709 {
711 cpg->AddTrack(
pdgf[i],pp[0],pp[1],pp[2],x,y,z,0,
true,
Ef[i],tof,mparam[0]*mparam[4]);
712
713 }
714
715 }
716 }
717
718
719 FairMCEventHeader*
header = cpg->GetEvent();
722
723 return kTRUE;
724}
TH1D * pyslice[3000][500]
Double_t MeanMaterialBudget(const Double_t *start, const Double_t *end, Double_t *mparam)
Int_t ExtractEvent_Ekin(Double_t Ekin, Double_t DeltaE)