BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
ranlxd.c File Reference
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.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

Definition at line 314 of file BesEvtGen/phokhara/PHOKHARA/ranlxd.c.

◆ MASK

#define MASK   0xffffff

Definition at line 315 of file BesEvtGen/phokhara/PHOKHARA/ranlxd.c.

◆ STEP

#define STEP ( pi,
pj )

Definition at line 334 of file BesEvtGen/phokhara/PHOKHARA/ranlxd.c.

334# define STEP( pi, pj ) \
335 d = ( *pj ).c1.c1 - ( *pi ).c1.c1 - carry.c1; \
336 ( *pi ).c2.c1 += ( d < 0 ); \
337 d += BASE; \
338 ( *pi ).c1.c1 = d & MASK; \
339 d = ( *pj ).c1.c2 - ( *pi ).c1.c2 - carry.c2; \
340 ( *pi ).c2.c2 += ( d < 0 ); \
341 d += BASE; \
342 ( *pi ).c1.c2 = d & MASK; \
343 d = ( *pj ).c1.c3 - ( *pi ).c1.c3 - carry.c3; \
344 ( *pi ).c2.c3 += ( d < 0 ); \
345 d += BASE; \
346 ( *pi ).c1.c3 = d & MASK; \
347 d = ( *pj ).c1.c4 - ( *pi ).c1.c4 - carry.c4; \
348 ( *pi ).c2.c4 += ( d < 0 ); \
349 d += BASE; \
350 ( *pi ).c1.c4 = d & MASK; \
351 d = ( *pj ).c2.c1 - ( *pi ).c2.c1; \
352 carry.c1 = ( d < 0 ); \
353 d += BASE; \
354 ( *pi ).c2.c1 = d & MASK; \
355 d = ( *pj ).c2.c2 - ( *pi ).c2.c2; \
356 carry.c2 = ( d < 0 ); \
357 d += BASE; \
358 ( *pi ).c2.c2 = d & MASK; \
359 d = ( *pj ).c2.c3 - ( *pi ).c2.c3; \
360 carry.c3 = ( d < 0 ); \
361 d += BASE; \
362 ( *pi ).c2.c3 = d & MASK; \
363 d = ( *pj ).c2.c4 - ( *pi ).c2.c4; \
364 carry.c4 = ( d < 0 ); \
365 d += BASE; \
366 ( *pi ).c2.c4 = d & MASK

Function Documentation

◆ ranlxd()

void ranlxd ( double r[],
int n )

Definition at line 502 of file BesEvtGen/phokhara/PHOKHARA/ranlxd.c.

502 {
503 int k;
504
505 if ( init == 0 ) rlxd_init( 0, 1 );
506
507 for ( k = 0; k < n; k++ )
508 {
509 is = next[is];
510 if ( is == is_old ) update();
511 r[k] = one_bit * ( (double)( x.num[is + 4] ) + one_bit * (double)( x.num[is] ) );
512 }
513}
void rlxd_init(int level, int seed)
const Int_t n

Referenced by ranlxdf_().

◆ rlxd_get()

void rlxd_get ( int state[])

Definition at line 526 of file BesEvtGen/phokhara/PHOKHARA/ranlxd.c.

526 {
527 int k;
528
529 if ( init == 0 ) error( 3 );
530
531 state[0] = rlxd_size();
532
533 for ( k = 0; k < 96; k++ ) state[k + 1] = x.num[k];
534
535 state[97] = carry.c1;
536 state[98] = carry.c2;
537 state[99] = carry.c3;
538 state[100] = carry.c4;
539
540 state[101] = pr;
541 state[102] = ir;
542 state[103] = jr;
543 state[104] = is;
544}

Referenced by rlxdgetf_().

◆ rlxd_init()

void rlxd_init ( int level,
int seed )

Definition at line 439 of file BesEvtGen/phokhara/PHOKHARA/ranlxd.c.

439 {
440 int i, k, l;
441 int ibit, jbit, xbit[31];
442 int ix, iy;
443
444 if ( ( INT_MAX < 2147483647 ) || ( FLT_RADIX != 2 ) || ( FLT_MANT_DIG < 24 ) ||
445 ( DBL_MANT_DIG < 48 ) )
446 error( 0 );
447
448 define_constants();
449
450 if ( level == 1 ) pr = 202;
451 else if ( level == 2 ) pr = 397;
452 else error( 1 );
453
454 i = seed;
455
456 for ( k = 0; k < 31; k++ )
457 {
458 xbit[k] = i % 2;
459 i /= 2;
460 }
461
462 if ( ( seed <= 0 ) || ( i != 0 ) ) error( 2 );
463
464 ibit = 0;
465 jbit = 18;
466
467 for ( i = 0; i < 4; i++ )
468 {
469 for ( k = 0; k < 24; k++ )
470 {
471 ix = 0;
472
473 for ( l = 0; l < 24; l++ )
474 {
475 iy = xbit[ibit];
476 ix = 2 * ix + iy;
477
478 xbit[ibit] = ( xbit[ibit] + xbit[jbit] ) % 2;
479 ibit = ( ibit + 1 ) % 31;
480 jbit = ( jbit + 1 ) % 31;
481 }
482
483 if ( ( k % 4 ) != i ) ix = 16777215 - ix;
484
485 x.num[4 * k + i] = ix;
486 }
487 }
488
489 carry.c1 = 0;
490 carry.c2 = 0;
491 carry.c3 = 0;
492 carry.c4 = 0;
493
494 ir = 0;
495 jr = 7;
496 is = 91;
497 is_old = 0;
498 prm = pr % 12;
499 init = 1;
500}
#define ix(i)

Referenced by ranlxd(), and rlxdinit_().

◆ rlxd_reset()

void rlxd_reset ( int state[])

Definition at line 546 of file BesEvtGen/phokhara/PHOKHARA/ranlxd.c.

546 {
547 int k;
548
549 if ( ( INT_MAX < 2147483647 ) || ( FLT_RADIX != 2 ) || ( FLT_MANT_DIG < 24 ) ||
550 ( DBL_MANT_DIG < 48 ) )
551 error( 4 );
552
553 define_constants();
554
555 if ( state[0] != rlxd_size() ) error( 5 );
556
557 for ( k = 0; k < 96; k++ )
558 {
559 if ( ( state[k + 1] < 0 ) || ( state[k + 1] >= 167777216 ) ) error( 5 );
560
561 x.num[k] = state[k + 1];
562 }
563
564 if ( ( ( state[97] != 0 ) && ( state[97] != 1 ) ) ||
565 ( ( state[98] != 0 ) && ( state[98] != 1 ) ) ||
566 ( ( state[99] != 0 ) && ( state[99] != 1 ) ) ||
567 ( ( state[100] != 0 ) && ( state[100] != 1 ) ) )
568 error( 5 );
569
570 carry.c1 = state[97];
571 carry.c2 = state[98];
572 carry.c3 = state[99];
573 carry.c4 = state[100];
574
575 pr = state[101];
576 ir = state[102];
577 jr = state[103];
578 is = state[104];
579 is_old = 8 * ir;
580 prm = pr % 12;
581 init = 1;
582
583 if ( ( ( pr != 202 ) && ( pr != 397 ) ) || ( ir < 0 ) || ( ir > 11 ) || ( jr < 0 ) ||
584 ( jr > 11 ) || ( jr != ( ( ir + 7 ) % 12 ) ) || ( is < 0 ) || ( is > 91 ) )
585 error( 5 );
586}

Referenced by rlxdresetf_().

◆ rlxd_size()

int rlxd_size ( void )

Definition at line 524 of file BesEvtGen/phokhara/PHOKHARA/ranlxd.c.

524{ return ( 105 ); }

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

Variable Documentation

◆ num

int num[96]

Definition at line 331 of file BesEvtGen/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(), EFEventLoopMgr::EF_Fragment_Address(), endcap_conv2root(), EvtSpinAmp::EvtSpinAmp(), EvtSpinAmp::EvtSpinAmp(), EvtSpinAmp::EvtSpinAmp(), EFtoTDS::execute(), ResetEtsAlg::execute(), QCMCFilter::findD0Decay(), BesEmcEndGeometry::GetCryNumInOneLayer(), ExtBesEmcEndGeometry::GetCryNumInOneLayer(), RecMucTrack::GetHitInSeg(), TofShower::getNeighbors(), EmcROOTGeo::GetPhysicalCrystal(), RootTofElecDataCnv::i_createObj(), TreeTofElecDataCnv::i_createObj(), BesMucEfficiency::Initialize(), BesGlobalTrigSvc::initialize(), QCMCFilter::initialize(), MucMark::NumInCol(), KalmanVertexFit::numTrack(), EmcSelBhaEvent::OutputMV(), EvtPdfDiv< T >::pdf(), 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