void Config()
{
    /// ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
    /// Theta range given through pseudorapidity limits 22/6/2001

    // Set Random Number seed
  TDatime dt;
  UInt_t curtime=dt.Get();
  UInt_t procid=gSystem->GetPid();
  UInt_t seed=curtime-procid;
  if (gSystem->Getenv("envevno")) {
    seed=atoi(gSystem->Getenv("envevno"));
    seed += 1000; // 0 e' il seed dall'orologio....
    printf("...taking seed as event number + 1000...\n");
  }
  printf("...setting seed as %d...\n",seed);
  gRandom->SetSeed(seed);
  printf("Seed for random number generation = %d \n",gRandom->GetSeed());


  //  AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);


   // libraries required by geant321
#if defined(__CINT__)
    gSystem->Load("libgeant321");
#endif

    new     TGeant3TGeo("C++ Interface to Geant3");

    if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
      AliCDBManager::Instance()->SetRun(0);
    }

    AliRunLoader* rl=0x0;

    AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);

    rl = AliRunLoader::Open("galice.root",
			    AliConfig::GetDefaultEventFolderName(),
			    "recreate");
    if (rl == 0x0)
      {
	gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
	return;
      }
    rl->SetCompressionLevel(2);
    rl->SetNumberOfEventsPerFile(1000);
    gAlice->SetRunLoader(rl);
    // gAlice->SetGeometryFromFile("geometry.root");
    // gAlice->SetGeometryFromCDB();

    // Set the trigger configuration
    //    AliSimulation::Instance()->SetTriggerConfig("Pb-Pb");
    AliSimulation::Instance()->SetTriggerConfig("ACORDE");
    cout<<"Trigger configuration is set to  ACORDE"<<endl;

    //
    // Set External decayer
    TVirtualMCDecayer *decayer = new AliDecayerPythia();

    decayer->SetForceDecay(kAll);
    decayer->Init();
    gMC->SetExternalDecayer(decayer);
    //=======================================================================
    // ************* STEERING parameters FOR ALICE SIMULATION **************
    // --- Specify event type to be tracked through the ALICE setup
    // --- All positions are in cm, angles in degrees, and P and E in GeV


    gMC->SetProcess("DCAY",1);
    gMC->SetProcess("PAIR",1);
    gMC->SetProcess("COMP",1);
    gMC->SetProcess("PHOT",1);
    gMC->SetProcess("PFIS",0);
    gMC->SetProcess("DRAY",0);
    gMC->SetProcess("ANNI",1);
    gMC->SetProcess("BREM",1);
    gMC->SetProcess("MUNU",1);
    gMC->SetProcess("CKOV",1);
    gMC->SetProcess("HADR",1);
    gMC->SetProcess("LOSS",2);
    gMC->SetProcess("MULS",1);
    gMC->SetProcess("RAYL",1);

    Float_t cut = 1.e-3;        // 1MeV cut by default
    Float_t tofmax = 1.e10;

    gMC->SetCut("CUTGAM", cut);
    gMC->SetCut("CUTELE", cut);
    gMC->SetCut("CUTNEU", cut);
    gMC->SetCut("CUTHAD", cut);
    gMC->SetCut("CUTMUO", cut);
    gMC->SetCut("BCUTE",  cut); 
    gMC->SetCut("BCUTM",  cut); 
    gMC->SetCut("DCUTE",  cut); 
    gMC->SetCut("DCUTM",  cut); 
    gMC->SetCut("PPCUTM", cut);
    gMC->SetCut("TOFMAX", tofmax); 


    //  AliGenCosmicsParam
    AliGenCosmicsParam *gener = new AliGenCosmicsParam();
    gener->SetNumberParticles(100);
    gener->SetParamACORDE();
    gener->SetYOrigin(260.); // warning: just above TPC, no TOF, no ACORDE
    gener->SetMomentumRange(8.,1000.);
    gener->SetMaxAngleWRTVertical(3.1415/4.);
    gener->SetInTPC(); // "acceptance trigger"
    gener->SetBkG(0.); // needed for "acceptance trigger"
    gener->Init();
    gGener = gener;

  //   AliGenCocktail *gener = new AliGenCocktail();
//     gener->SetPhiRange(0, 360);
//     // Set pseudorapidity range from -8 to 8.
//     Float_t thmin = EtaToTheta(1.2);   // theta min. <---> eta max
//     Float_t thmax = EtaToTheta(-1.2);  // theta max. <---> eta min
//     gener->SetThetaRange(thmin,thmax);
//     gener->SetOrigin(0, 0, 0);  //vertex position
//     gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
//     AddCosmicParticles(gener, 300);  //
//     gener->Init();


    // MAGNETIC FIELD IN THE BARREL
    TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., mag));
    //    TGeoGlobalMagField::Instance()->GetField()->SetL3ConstField(0); //Using const. field in the barrel
    rl->CdGAFile();


    Int_t   iABSO  =  1;
    Int_t   iDIPO  =  0;
    Int_t   iFMD   =  0;
    Int_t   iFRAME =  1;
    Int_t   iHALL  =  1;
    Int_t   iITS   =  1;
    Int_t   iMAG   =  1;
    Int_t   iMUON  =  0;
    Int_t   iPHOS  =  0;
    Int_t   iPIPE  =  1;
    Int_t   iPMD   =  0;
    Int_t   iRICH  =  0;
    Int_t   iSHIL  =  1;
    Int_t   iSTART =  0;
    Int_t   iTOF   =  0;
    Int_t   iTPC   =  1;
    Int_t   iTRD   =  0;
    Int_t   iZDC   =  0;
    Int_t   iEMCAL =  0;
    Int_t   iACORDE   =  1;
    Int_t   iVZERO =  0;
    rl->CdGAFile();
    //=================== Alice BODY parameters =============================
    AliBODY *BODY = new AliBODY("BODY", "Alice envelop");

    if (iMAG)
    {
        //=================== MAG parameters ============================
        // --- Start with Magnet since detector layouts may be depending ---
        // --- on the selected Magnet dimensions ---
        AliMAG *MAG = new AliMAG("MAG", "Magnet");
    }


    if (iABSO)
    {
        //=================== ABSO parameters ============================
        AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
    }

    if (iDIPO)
    {
        //=================== DIPO parameters ============================

        AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
    }

    if (iHALL)
    {
        //=================== HALL parameters ============================

        AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
    }


    if (iFRAME)
    {
        //=================== FRAME parameters ============================

        AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
    }

    if (iSHIL)
    {
        //=================== SHIL parameters ============================

        AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
    }


    if (iPIPE)
    {
        //=================== PIPE parameters ============================

        AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
    }
 
    if (iITS)
    {
        //=================== ITS parameters ============================

	AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","ITS PPR detailed version with asymmetric services");
    }

    if (iTPC)
    {
        //============================ TPC parameters ===================
        AliTPC *TPC = new AliTPCv2("TPC", "Default");
    }


    if (iTOF) {
        //=================== TOF parameters ============================
	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
    }


    if (iRICH)
    {
        //=================== RICH parameters ===========================
        AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");

    }


    if (iZDC)
    {
        //=================== ZDC parameters ============================

        AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
    }

    if (iTRD)
    {
        //=================== TRD parameters ============================

        AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
    }

    if (iFMD)
    {
        //=================== FMD parameters ============================
	AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
   }

    if (iMUON)
    {
        //=================== MUON parameters ===========================
        // New MUONv1 version (geometry defined via builders)
        AliMUON *MUON = new AliMUONv1("MUON", "default");
    }
    //=================== PHOS parameters ===========================

    if (iPHOS)
    {
        AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
    }


    if (iPMD)
    {
        //=================== PMD parameters ============================
        AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
    }

    if (iSTART)
    {
        //=================== START parameters ============================
        AliSTART *START = new AliSTARTv1("START", "START Detector");
    }

    if (iEMCAL)
    {
        //=================== EMCAL parameters ============================
        AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
    }

     if (iACORDE)
    {
        //=================== ACORDE parameters ============================
        AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
    }

     if (iVZERO)
    {
        //=================== ACORDE parameters ============================
        AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
    }

     AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);

}
Exemple #2
0
//--- Functions ---
class IlcGenPythia;
IlcGenerator *MbPythia();
IlcGenerator *MbPhojet();
void ProcessEnvironmentVars();

// Geterator, field, beam energy
static PDC06Proc_t   proc     = kPhojet;
static Mag_t         mag      = k5kG;
static Float_t       energy   = 10000; // energy in CMS
static EmbedRun_t    embedrun = kBackground;
//========================//
// Set Random Number seed //
//========================//
TDatime dt;
static UInt_t seed    = dt.Get();

// Comment line
static TString comment;

Float_t EtaToTheta(Float_t arg);

void Config()
{
    

  // Get settings from environment variables
  ProcessEnvironmentVars();

  gRandom->SetSeed(seed);
  cerr<<"Seed for random number generation= "<<seed<<endl; 
Exemple #3
0
void fastGen(Tune_t tune = kPyTuneCDFA , Float_t energy, Int_t nev = 1, TString process)
{
  // Add all particles to the PDG database
  AliPDG::AddParticlesToPdgDataBase();

  // set the random seed
  TDatime date;
  UInt_t seed    = date.Get()+gSystem->GetPid();
  gRandom->SetSeed(seed);
  cout<<"Seed for random number generation= "<<seed<<endl; 


  //  Runloader  
  AliRunLoader* rl = AliRunLoader::Open("galice.root", "FASTRUN","recreate");
    
  rl->SetCompressionLevel(2);
  rl->SetNumberOfEventsPerFile(nev);
  rl->LoadKinematics("RECREATE");
  rl->MakeTree("E");
  gAlice->SetRunLoader(rl);

  //  Create stack
  rl->MakeStack();
  AliStack* stack      = rl->Stack();
 
  //  Header
  AliHeader* header = rl->GetHeader();
  //
  //  Create and Initialize Generator
  AliGenerator *gener = CreateGenerator(tune,energy);
  gener->Init();
  // if nsd switch off single diffraction
  if ( process == "NSD"){
    if(tune != kPhojet) {
      AliPythia::Instance()->	SetMSUB(92,0);             // single diffraction AB-->XB
      AliPythia::Instance()-> SetMSUB(93,0);             // single diffraction AB-->AX
    }
    else {
      cout << "NSD not yet implemented in the phojet case" << endl;
      exit(1);
    }
  }
  gener->SetStack(stack);
    
  //
  //                        Event Loop
  //
  Int_t iev;
     
  for (iev = 0; iev < nev; iev++) {

    if(!(iev%500)) printf("\n \n Event number %d \n \n", iev);
	
    //  Initialize event
    header->Reset(0,iev);
    rl->SetEventNumber(iev);
    stack->Reset();
    rl->MakeTree("K");
    //	stack->ConnectTree();
    
    //  Generate event
    gener->Generate();
    //  Analysis
    // 	Int_t npart = stack->GetNprimary();
    // 	printf("Analyse %d Particles\n", npart);
    // 	for (Int_t part=0; part<npart; part++) {
    // 	    TParticle *MPart = stack->Particle(part);
    // 	    Int_t mpart  = MPart->GetPdgCode();
    // 	    printf("Particle %d\n", mpart);
    // 	}
	
    //  Finish event
    header->SetNprimary(stack->GetNprimary());
    header->SetNtrack(stack->GetNtrack());  
    //      I/O
    //	
    stack->FinishEvent();
    header->SetStack(stack);
    rl->TreeE()->Fill();
    rl->WriteKinematics("OVERWRITE");

  } // event loop
    //
    //                         Termination
    //  Generator
  gener->FinishRun();
  //  Write file
  rl->WriteHeader("OVERWRITE");
  gener->Write();
  rl->Write();
    
}