BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
ranlxd.c File Reference
#include <limits.h>
#include <float.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

Go to the source code of this file.

Classes

struct  vec_t
 
struct  dble_vec_t
 

Macros

#define BASE   0x1000000
 
#define MASK   0xffffff
 
#define STEP(pi, pj)
 

Functions

void rlxd_init (int level, int seed)
 
void ranlxd (double r[], int n)
 
int rlxd_size (void)
 
void rlxd_get (int state[])
 
void rlxd_reset (int state[])
 

Macro Definition Documentation

◆ BASE

#define BASE   0x1000000

◆ MASK

#define MASK   0xffffff

◆ STEP

#define STEP ( pi,
pj )

Definition at line 386 of file BesEvtGen/BesEvtGen-00-04-30/src/phokhara/PHOKHARA/ranlxd.c.

386#define STEP(pi,pj) \
387 d=(*pj).c1.c1-(*pi).c1.c1-carry.c1; \
388 (*pi).c2.c1+=(d<0); \
389 d+=BASE; \
390 (*pi).c1.c1=d&MASK; \
391 d=(*pj).c1.c2-(*pi).c1.c2-carry.c2; \
392 (*pi).c2.c2+=(d<0); \
393 d+=BASE; \
394 (*pi).c1.c2=d&MASK; \
395 d=(*pj).c1.c3-(*pi).c1.c3-carry.c3; \
396 (*pi).c2.c3+=(d<0); \
397 d+=BASE; \
398 (*pi).c1.c3=d&MASK; \
399 d=(*pj).c1.c4-(*pi).c1.c4-carry.c4; \
400 (*pi).c2.c4+=(d<0); \
401 d+=BASE; \
402 (*pi).c1.c4=d&MASK; \
403 d=(*pj).c2.c1-(*pi).c2.c1; \
404 carry.c1=(d<0); \
405 d+=BASE; \
406 (*pi).c2.c1=d&MASK; \
407 d=(*pj).c2.c2-(*pi).c2.c2; \
408 carry.c2=(d<0); \
409 d+=BASE; \
410 (*pi).c2.c2=d&MASK; \
411 d=(*pj).c2.c3-(*pi).c2.c3; \
412 carry.c3=(d<0); \
413 d+=BASE; \
414 (*pi).c2.c3=d&MASK; \
415 d=(*pj).c2.c4-(*pi).c2.c4; \
416 carry.c4=(d<0); \
417 d+=BASE; \
418 (*pi).c2.c4=d&MASK

Function Documentation

◆ ranlxd()

void ranlxd ( double r[],
int n )

Definition at line 573 of file BesEvtGen/BesEvtGen-00-04-30/src/phokhara/PHOKHARA/ranlxd.c.

574{
575 int k;
576
577 if (init==0)
578 rlxd_init(0,1);
579
580 for (k=0;k<n;k++)
581 {
582 is=next[is];
583 if (is==is_old)
584 update();
585 r[k]=one_bit*((double)(x.num[is+4])+one_bit*(double)(x.num[is]));
586 }
587}
const Int_t n

Referenced by ranlxdf_().

◆ rlxd_get()

void rlxd_get ( int state[])

Definition at line 605 of file BesEvtGen/BesEvtGen-00-04-30/src/phokhara/PHOKHARA/ranlxd.c.

606{
607 int k;
608
609 if (init==0)
610 error(3);
611
612 state[0]=rlxd_size();
613
614 for (k=0;k<96;k++)
615 state[k+1]=x.num[k];
616
617 state[97]=carry.c1;
618 state[98]=carry.c2;
619 state[99]=carry.c3;
620 state[100]=carry.c4;
621
622 state[101]=pr;
623 state[102]=ir;
624 state[103]=jr;
625 state[104]=is;
626}
@ error
Definition Core.h:24

Referenced by rlxdgetf_().

◆ rlxd_init()

void rlxd_init ( int level,
int seed )

Definition at line 503 of file BesEvtGen/BesEvtGen-00-04-30/src/phokhara/PHOKHARA/ranlxd.c.

504{
505 int i,k,l;
506 int ibit,jbit,xbit[31];
507 int ix,iy;
508
509 if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24)||
510 (DBL_MANT_DIG<48))
511 error(0);
512
513 define_constants();
514
515 if (level==1)
516 pr=202;
517 else if (level==2)
518 pr=397;
519 else
520 error(1);
521
522 i=seed;
523
524 for (k=0;k<31;k++)
525 {
526 xbit[k]=i%2;
527 i/=2;
528 }
529
530 if ((seed<=0)||(i!=0))
531 error(2);
532
533 ibit=0;
534 jbit=18;
535
536 for (i=0;i<4;i++)
537 {
538 for (k=0;k<24;k++)
539 {
540 ix=0;
541
542 for (l=0;l<24;l++)
543 {
544 iy=xbit[ibit];
545 ix=2*ix+iy;
546
547 xbit[ibit]=(xbit[ibit]+xbit[jbit])%2;
548 ibit=(ibit+1)%31;
549 jbit=(jbit+1)%31;
550 }
551
552 if ((k%4)!=i)
553 ix=16777215-ix;
554
555 x.num[4*k+i]=ix;
556 }
557 }
558
559 carry.c1=0;
560 carry.c2=0;
561 carry.c3=0;
562 carry.c4=0;
563
564 ir=0;
565 jr=7;
566 is=91;
567 is_old=0;
568 prm=pr%12;
569 init=1;
570}

Referenced by ranlxd(), and rlxdinit_().

◆ rlxd_reset()

void rlxd_reset ( int state[])

Definition at line 629 of file BesEvtGen/BesEvtGen-00-04-30/src/phokhara/PHOKHARA/ranlxd.c.

630{
631 int k;
632
633 if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24)||
634 (DBL_MANT_DIG<48))
635 error(4);
636
637 define_constants();
638
639 if (state[0]!=rlxd_size())
640 error(5);
641
642 for (k=0;k<96;k++)
643 {
644 if ((state[k+1]<0)||(state[k+1]>=167777216))
645 error(5);
646
647 x.num[k]=state[k+1];
648 }
649
650 if (((state[97]!=0)&&(state[97]!=1))||
651 ((state[98]!=0)&&(state[98]!=1))||
652 ((state[99]!=0)&&(state[99]!=1))||
653 ((state[100]!=0)&&(state[100]!=1)))
654 error(5);
655
656 carry.c1=state[97];
657 carry.c2=state[98];
658 carry.c3=state[99];
659 carry.c4=state[100];
660
661 pr=state[101];
662 ir=state[102];
663 jr=state[103];
664 is=state[104];
665 is_old=8*ir;
666 prm=pr%12;
667 init=1;
668
669 if (((pr!=202)&&(pr!=397))||
670 (ir<0)||(ir>11)||(jr<0)||(jr>11)||(jr!=((ir+7)%12))||
671 (is<0)||(is>91))
672 error(5);
673}

Referenced by rlxdresetf_().

◆ rlxd_size()

int rlxd_size ( void )

Definition at line 599 of file BesEvtGen/BesEvtGen-00-04-30/src/phokhara/PHOKHARA/ranlxd.c.

600{
601 return(105);
602}

Referenced by rlxd_get(), rlxd_reset(), and rlxd_sizef_().

Variable Documentation

◆ num

int num[96]

Definition at line 383 of file BesEvtGen/BesEvtGen-00-04-30/src/phokhara/PHOKHARA/ranlxd.c.

Referenced by EvtPDL::alias(), Dalitz::Babar_sakurai(), barrel_conv2root(), ExtSteppingAction::CalculateEmcEndCopyNb(), ExtSteppingAction::CalculateEmcEndPhiNb(), BesTofDigitizerEcV4::StripStruct::calNextN(), MucCalibMgr::CheckEvent(), BesEmcConstruction::ComputeEndCopyNb(), BesEmcSD::ComputeEndCopyNb(), EmcROOTGeo::ComputeEndCopyNb(), ExtBesEmcConstruction::ComputeEndCopyNb(), EvtDToKmPipPipPi0::decay(), draw_check_curve(), EFEventLoopMgr::EF_Fragment_Address(), endcap_conv2root(), EvtSpinAmp::EvtSpinAmp(), EvtSpinAmp::EvtSpinAmp(), EvtSpinAmp::EvtSpinAmp(), EFtoTDS::execute(), ResetEtsAlg::execute(), f_group(), QCMCFilter::findD0Decay(), BesEmcEndGeometry::GetCryNumInOneLayer(), ExtBesEmcEndGeometry::GetCryNumInOneLayer(), RecMucTrack::GetHitInSeg(), TofShower::getNeighbors(), RootTofElecDataCnv::i_createObj(), TreeTofElecDataCnv::i_createObj(), BesMucEfficiency::Initialize(), BesGlobalTrigSvc::initialize(), QCMCFilter::initialize(), StringParse::intpiece(), StringParse::longpiece(), MucMark::NumInCol(), StringParse::numpiece(), KalmanVertexFit::numTrack(), EmcSelBhaEvent::OutputMV(), EvtPdfDiv< T >::pdf(), StringParse::piece(), EmcRecShowerPosLoglin::Position(), BesMucTrig::readIndex(), MdcTSF::ReadLut(), MdcTF::ReadTFLut(), Dalitz::sakurai(), CalibData::EndcapElec::setNum(), CalibData::EndcapElec::setNum(), EndcapElec::setNum(), EndcapElec::setNum(), BarrelElec::setNumEast(), BarrelElec::setNumEast(), CalibData::BarrelElec::setNumEast(), CalibData::BarrelElec::setNumEast(), BarrelElec::setNumWest(), BarrelElec::setNumWest(), CalibData::BarrelElec::setNumWest(), CalibData::BarrelElec::setNumWest(), KalmanVertexFit::setTrackIteration(), and KalmanVertexFit::setVertexIteration().

◆ vec