Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

EsafRandom - source file

// $Id: EsafRandom.cc,v 1.7 2005/08/25 15:51:58 thea Exp $
// M.Pallavicini created Feb, 11 2002

/*****************************************************************************
 * ESAF: Euso Simulation and Analysis Framework                              *
 *                                                                           *
 *  Id: EsafRandom                                                           *
 *  Package: Base                                                            *
 *  Coordinator: Marco.Pallavicini                                           *
 *                                                                           *
 *****************************************************************************/

//_____________________________________________________________________________
//  
//  ESAF random numbers generator manager
//  =====================================
//
//  TODO

#include "EsafRandom.hh"
#include "Config.hh"

EsafRandom *EsafRandom::fgMe   = NULL;

ClassImp(EsafRandom)

//______________________________________________________________________________
 EsafRandom::EsafRandom() : EsafConfigurable() {
    // 
    // Constructor
    // 

    string type = Conf()->GetStr("EsafRandom.fType");
    if (type == "TRandom" ) {
        fRndm = new TRandom();
    } else if (type == "TRandom2" ) {
        fRndm = new TRandom2();
    } else if (type == "TRandom3" ) {
        fRndm = new TRandom3();
    } 
    else 
        FatalError("EsafRandom: "+type+" random generator type not known");

    // read seed from config file
    Int_t seed = (Int_t)Conf()->GetNum("EsafRandom.fSeed");

    MsgForm(EsafMsg::Debug,"Seed set to %d",seed);
    fRndm->SetSeed(seed);

    // set frndm as root rndm number generator.
    gRandom = fRndm;

}

//______________________________________________________________________________
 EsafRandom::~EsafRandom() {
    //
    // Destructor
    // 
}

//______________________________________________________________________________
 TRandom* EsafRandom::Get() {
    // 
    // Get
    // 

    if (fgMe==NULL) {
        fgMe = new EsafRandom(); 
    }

    return fgMe->GetRandom();
}



About Us | EUSO Official Website | Web pages created by Roberto Pesce and Alessandro Thea - Last Update Wed Nov 16 16:57:39 2005 Wed Nov 16 16:29:22 2005