456{
457
459
460
461
462 if (
fTree->GetEntry(
fn) == 0 )
return kFALSE;
463
465 cout <<
"Info GenieGenerator: neutrino event-nr "<<
fn << endl;
466 }
467
469
470
474 -1,
475 false);
476
477
478 int outgoing_lepton_pdg =
neu;
479 if (
cc) outgoing_lepton_pdg = copysign(TMath::Abs(
neu)-1,
neu);
480 if (
nuel) outgoing_lepton_pdg = 11;
481
482 bool track_outgoing_lepton = (
cc ||
nuel) ?
true : false;
483 cpg->AddTrack(outgoing_lepton_pdg,
486 0,
487 track_outgoing_lepton);
488
489
490 for (
int i_hadron = 0; i_hadron <
nf; i_hadron++){
491 cpg->AddTrack(
pdgf[i_hadron],
492 pxf[i_hadron],
pyf[i_hadron],
pzf[i_hadron],
494 0,
495 true);
496 }
497
498 return kTRUE;
499
500 } else {
501
504 char ts[20];
505
506
507 Int_t idbase=1200;
509 Double_t bparam=0.;
512 cout <<
"Info GenieGenerator: MaterialBudget " <<
start[2] <<
" - "<<
end[2] << endl;
513 cout << "Info GenieGenerator: MaterialBudget " << bparam << endl;
514 cout <<
"Info GenieGenerator: MaterialBudget 0 " <<
mparam[0] << endl;
515 cout <<
"Info GenieGenerator: MaterialBudget 1 " <<
mparam[1] << endl;
516 cout <<
"Info GenieGenerator: MaterialBudget 2 " <<
mparam[2] << endl;
517 cout <<
"Info GenieGenerator: MaterialBudget 3 " <<
mparam[3] << endl;
518 cout <<
"Info GenieGenerator: MaterialBudget 4 " <<
mparam[4] << endl;
519 cout <<
"Info GenieGenerator: MaterialBudget 5 " <<
mparam[5] << endl;
520 cout <<
"Info GenieGenerator: MaterialBudget 6 " <<
mparam[6] << endl;
521 cout <<
"Info GenieGenerator: MaterialBudget " <<
mparam[0]*
mparam[4] << endl;
522
523
524 printf(
"Reading (log10(p),log10(pt)) Hists from file: %s\n",
fInputFile->GetName());
525 for (Int_t idnu=12;idnu<17;idnu+=2){
527 Int_t
idhnu=idbase+idnu;
528 if (idadd<0)
idhnu+=1000;
529 sprintf(ts,"%d",idhnu);
530
533 printf("HISTID=%d, Title:%s\n",idhnu,h2tmp->GetTitle());
534 sprintf(ts,"px_%d",idhnu);
535
537 Int_t nbinx=h2tmp->GetNbinsX();
538
539
540 for (Int_t k=1;
k<nbinx+1;
k+=1){
541 sprintf(ts,"h%d%d",idhnu,k);
542
544 }
545 }
546 }
547 }
549 }
550 if (
fn==
fNevents) {LOG(WARNING) <<
"End of input file. Rewind.";}
555 cout <<
"Info GenieGenerator: neutrino event-nr "<<
fn << endl;
556 }
557
558
559
560
561 Double_t bparam=0.;
563 Double_t pout[3];
564 pout[2]=-1.;
565 Double_t txnu=0;
566 Double_t tynu=0;
567
568
569 while (pout[2]<0.) {
570
571
572
573
574
577 fTree->GetEntry(nuevent);
578
581 double pt = sqrt(pout[0]*pout[0] + pout[1]*pout[1]);
583 }
585
586 TParticle *nuparticle = (TParticle*)
ancstr->At(0);
587 TVector3 * nup = new TVector3(nuparticle->Px(), nuparticle->Py(), nuparticle->Pz());
588
590
592 fTree->GetEntry(nuevent);
593
594 pout[0] = nup->Px()/nup->Pz() *
pzv;
595 pout[1] = nup->Py()/nup->Pz() *
pzv;
596 double pt = sqrt(pout[0]*pout[0] + pout[1]*pout[1]);
598 }
599
601
605 Double_t pl10=log10(
pzv);
607
608 if (nbx<1) nbx=1;
609 if (nbx>nbinmx) nbx=nbinmx;
611
612 Double_t
pt=pow(10.,ptlog10)-0.01;
613
614 Double_t
phi=gRandom->Uniform(0.,2*TMath::Pi());
615 pout[0] = cos(phi)*
pt;
616 pout[1] = sin(phi)*
pt;
618
619 }
620 if (pout[2]>=0.) {
621 pout[2]=TMath::Sqrt(pout[2]);
622
624 if (gRandom->Uniform(-1.,1.)<0.) pout[0]=-pout[0];
625 if (gRandom->Uniform(-1.,1.)<0.) pout[1]=-pout[1];
626 }
627
628
631
635 }
636
637 txnu=pout[0]/pout[2];
638 tynu=pout[1]/pout[2];
641
645 }
646
647
649
650 }
651 }
652
653 Double_t prob2int = -1.;
658 while (prob2int<gRandom->Uniform(0.,1.)) {
659
660 z=gRandom->Uniform(start[2],end[2]);
663
667 }
668 if (mparam[6]<0.5){
669
670 prob2int=2.;
671 }else{
672
673 TGeoNode *
node = gGeoManager->FindNode(x,y,z);
674 TGeoMaterial *mat = 0;
675 if (node && !gGeoManager->IsOutside()) {
676 mat =
node->GetVolume()->GetMaterial();
677
678
679 prob2int= mat->GetDensity()/
mparam[7];
680 if (prob2int>1.) cout <<
"***WARNING*** GenieGenerator: prob2int > Maximum density????" << prob2int <<
" maxrho:" <<
mparam[7] <<
" material: " << mat->GetName() << endl;
682 }else{
683 prob2int=0.;
684 }
685 }
686 }
687
688
690 Double_t tof=TMath::Sqrt(x*x+y*y+zrelative*zrelative)/2.99792458e+6;
691 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]);
693
695 Int_t oLPdgCode =
neu;
696 if (
cc){oLPdgCode = copysign(TMath::Abs(
neu)-1,
neu);}
697 if (
nuel){oLPdgCode = 11;}
698 cpg->AddTrack(oLPdgCode,pp[0],pp[1],pp[2],x,y,z,0,
true,
El,tof,mparam[0]*mparam[4]);
699
700 for(
int i=0;
i<
nf;
i++)
701 {
703 cpg->AddTrack(
pdgf[i],pp[0],pp[1],pp[2],x,y,z,0,
true,
Ef[i],tof,mparam[0]*mparam[4]);
704
705 }
706
707 }
708 }
709 return kTRUE;
710}
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)