ROOT logo
// One can use the configuration macro in compiled mode by
// root [0] gSystem->Load("libgeant321");
// root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
//                   -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
// root [0] .x grun.C(1,"ConfigKr.C++")

#if !defined(__CINT__) || defined(__MAKECINT__)
#include <Riostream.h>
#include <TRandom.h>
#include <TSystem.h>
#include <TVirtualMC.h>
#include <TGeant3TGeo.h>
#include "STEER/AliRunLoader.h"
#include "STEER/AliRun.h"
#include "STEER/AliConfig.h"
#include "PYTHIA6/AliDecayerPythia.h"
#include "EVGEN/AliGenCocktail.h"
#include "EVGEN/AliGenHIJINGpara.h"
#include "STEER/AliMagF.h"
#include "STRUCT/AliBODY.h"
#include "STRUCT/AliMAG.h"
#include "STRUCT/AliABSOv3.h"
#include "STRUCT/AliDIPOv3.h"
#include "STRUCT/AliHALLv3.h"
#include "STRUCT/AliFRAMEv2.h"
#include "STRUCT/AliSHILv3.h"
#include "STRUCT/AliPIPEv3.h"
#include "ITS/AliITSvPPRasymmFMD.h"
#include "TPC/AliTPCv2.h"
#include "TOF/AliTOFv6T0.h"
#include "HMPID/AliHMPIDv1.h"
#include "ZDC/AliZDCv2.h"
#include "TRD/AliTRDv1.h"
#include "FMD/AliFMDv1.h"
#include "MUON/AliMUONv1.h"
#include "PHOS/AliPHOSv1.h"
#include "PMD/AliPMDv1.h"
#include "T0/AliT0v1.h"
#include "EMCAL/AliEMCALv2.h"
#include "ACORDE/AliACORDEv1.h"
#include "VZERO/AliVZEROv7.h"
#endif

Float_t EtaToTheta(Float_t arg);

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
  gRandom->SetSeed(123456); // Set 0 to use the currecnt time
  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");

    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(3);
    gAlice->SetRunLoader(rl);

    // Set the trigger configuration
    AliSimulation::Instance()->SetTriggerConfig("Pb-Pb");
    cout<<"Trigger configuration is set to  Pb-Pb"<<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); 


    AliGenCocktail *gener = new AliGenCocktail();
    //
    Int_t nKrDecays = 100; // number of Kr decays
    for(Int_t i=0;i<nKrDecays;i++){
      AliGenKrypton *krypton = new AliGenKrypton();
      gener->AddGenerator(krypton,"Krypton",1);
    }
    gener->Init();

    // Field (L3 0.4 T)
    TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));

    // detectors - only the TPC is relevant

    Int_t   iABSO  =  0;
    Int_t   iDIPO  =  0;
    Int_t   iFMD   =  0;
    Int_t   iFRAME =  0;
    Int_t   iHALL  =  0;
    Int_t   iITS   =  0;
    Int_t   iMAG   =  0;
    Int_t   iMUON  =  0;
    Int_t   iPHOS  =  0;
    Int_t   iPIPE  =  0;
    Int_t   iPMD   =  0;
    Int_t   iHMPID  =  0;
    Int_t   iSHIL  =  0;
    Int_t   iT0 =  0;
    Int_t   iTOF   =  0;
    Int_t   iTPC   =  1;
    Int_t   iTRD   =  0;
    Int_t   iZDC   =  0;
    Int_t   iEMCAL =  0;
    Int_t   iACORDE   =  0;
    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 AliABSOv3("ABSO", "Muon Absorber");
    }

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

        AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
    }

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

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


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

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

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

        AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
    }


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

        AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
    }
 
    if(iITS) {

    //=================== ITS parameters ============================
    //
    // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
    // almost all other detectors. This involves the fact that the ITS geometry
    // still has several options to be followed in parallel in order to determine
    // the best set-up which minimizes the induced background. All the geometries
    // available to date are described in the following. Read carefully the comments
    // and use the default version (the only one uncommented) unless you are making
    // comparisons and you know what you are doing. In this case just uncomment the
    // ITS geometry you want to use and run Aliroot.
    //
    // Detailed geometries:         
    //
    //
    //
	AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","ITS PPR detailed version with asymmetric services");
	ITS->SetMinorVersion(2);  // don't touch this parameter if you're not an ITS developer
	ITS->SetReadDet(kFALSE);	  // don't touch this parameter if you're not an ITS developer
	//    ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
	ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
	ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
	ITS->SetThicknessChip1(150.);  // chip thickness on layer 1 must be in the range [150,300]
	ITS->SetThicknessChip2(150.);  // chip thickness on layer 2 must be in the range [150,300]
	ITS->SetRails(0);	       // 1 --> rails in ; 0 --> rails out
	ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon

 
    //
    // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
    // for reconstruction !):
    //                                                     
    //
    //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
    //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
    //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
    //
    //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
    //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
    //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
    //                      
    //
    //
    // Geant3 <-> EUCLID conversion
    // ============================
    //
    // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
    // media to two ASCII files (called by default ITSgeometry.euc and
    // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
    // The default (=0) means that you dont want to use this facility.
    //
     ITS->SetEUCLID(0);  
    }

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


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


    if (iHMPID)
    {
        //=================== HMPID parameters ===========================
        AliHMPID *HMPID = new AliHMPIDv1("HMPID", "normal HMPID");

    }


    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 (iT0)
    {
        //=================== T0 parameters ============================
        AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
    }

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

     if (iACORDE)
    {
        //=================== ACORDE parameters ============================
        AliACORDE *ACORDE = new AliACORDEv1("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__);

}

Float_t EtaToTheta(Float_t arg){
  return (180./TMath::Pi())*2.*atan(exp(-arg));
}
 ConfigKr.C:1
 ConfigKr.C:2
 ConfigKr.C:3
 ConfigKr.C:4
 ConfigKr.C:5
 ConfigKr.C:6
 ConfigKr.C:7
 ConfigKr.C:8
 ConfigKr.C:9
 ConfigKr.C:10
 ConfigKr.C:11
 ConfigKr.C:12
 ConfigKr.C:13
 ConfigKr.C:14
 ConfigKr.C:15
 ConfigKr.C:16
 ConfigKr.C:17
 ConfigKr.C:18
 ConfigKr.C:19
 ConfigKr.C:20
 ConfigKr.C:21
 ConfigKr.C:22
 ConfigKr.C:23
 ConfigKr.C:24
 ConfigKr.C:25
 ConfigKr.C:26
 ConfigKr.C:27
 ConfigKr.C:28
 ConfigKr.C:29
 ConfigKr.C:30
 ConfigKr.C:31
 ConfigKr.C:32
 ConfigKr.C:33
 ConfigKr.C:34
 ConfigKr.C:35
 ConfigKr.C:36
 ConfigKr.C:37
 ConfigKr.C:38
 ConfigKr.C:39
 ConfigKr.C:40
 ConfigKr.C:41
 ConfigKr.C:42
 ConfigKr.C:43
 ConfigKr.C:44
 ConfigKr.C:45
 ConfigKr.C:46
 ConfigKr.C:47
 ConfigKr.C:48
 ConfigKr.C:49
 ConfigKr.C:50
 ConfigKr.C:51
 ConfigKr.C:52
 ConfigKr.C:53
 ConfigKr.C:54
 ConfigKr.C:55
 ConfigKr.C:56
 ConfigKr.C:57
 ConfigKr.C:58
 ConfigKr.C:59
 ConfigKr.C:60
 ConfigKr.C:61
 ConfigKr.C:62
 ConfigKr.C:63
 ConfigKr.C:64
 ConfigKr.C:65
 ConfigKr.C:66
 ConfigKr.C:67
 ConfigKr.C:68
 ConfigKr.C:69
 ConfigKr.C:70
 ConfigKr.C:71
 ConfigKr.C:72
 ConfigKr.C:73
 ConfigKr.C:74
 ConfigKr.C:75
 ConfigKr.C:76
 ConfigKr.C:77
 ConfigKr.C:78
 ConfigKr.C:79
 ConfigKr.C:80
 ConfigKr.C:81
 ConfigKr.C:82
 ConfigKr.C:83
 ConfigKr.C:84
 ConfigKr.C:85
 ConfigKr.C:86
 ConfigKr.C:87
 ConfigKr.C:88
 ConfigKr.C:89
 ConfigKr.C:90
 ConfigKr.C:91
 ConfigKr.C:92
 ConfigKr.C:93
 ConfigKr.C:94
 ConfigKr.C:95
 ConfigKr.C:96
 ConfigKr.C:97
 ConfigKr.C:98
 ConfigKr.C:99
 ConfigKr.C:100
 ConfigKr.C:101
 ConfigKr.C:102
 ConfigKr.C:103
 ConfigKr.C:104
 ConfigKr.C:105
 ConfigKr.C:106
 ConfigKr.C:107
 ConfigKr.C:108
 ConfigKr.C:109
 ConfigKr.C:110
 ConfigKr.C:111
 ConfigKr.C:112
 ConfigKr.C:113
 ConfigKr.C:114
 ConfigKr.C:115
 ConfigKr.C:116
 ConfigKr.C:117
 ConfigKr.C:118
 ConfigKr.C:119
 ConfigKr.C:120
 ConfigKr.C:121
 ConfigKr.C:122
 ConfigKr.C:123
 ConfigKr.C:124
 ConfigKr.C:125
 ConfigKr.C:126
 ConfigKr.C:127
 ConfigKr.C:128
 ConfigKr.C:129
 ConfigKr.C:130
 ConfigKr.C:131
 ConfigKr.C:132
 ConfigKr.C:133
 ConfigKr.C:134
 ConfigKr.C:135
 ConfigKr.C:136
 ConfigKr.C:137
 ConfigKr.C:138
 ConfigKr.C:139
 ConfigKr.C:140
 ConfigKr.C:141
 ConfigKr.C:142
 ConfigKr.C:143
 ConfigKr.C:144
 ConfigKr.C:145
 ConfigKr.C:146
 ConfigKr.C:147
 ConfigKr.C:148
 ConfigKr.C:149
 ConfigKr.C:150
 ConfigKr.C:151
 ConfigKr.C:152
 ConfigKr.C:153
 ConfigKr.C:154
 ConfigKr.C:155
 ConfigKr.C:156
 ConfigKr.C:157
 ConfigKr.C:158
 ConfigKr.C:159
 ConfigKr.C:160
 ConfigKr.C:161
 ConfigKr.C:162
 ConfigKr.C:163
 ConfigKr.C:164
 ConfigKr.C:165
 ConfigKr.C:166
 ConfigKr.C:167
 ConfigKr.C:168
 ConfigKr.C:169
 ConfigKr.C:170
 ConfigKr.C:171
 ConfigKr.C:172
 ConfigKr.C:173
 ConfigKr.C:174
 ConfigKr.C:175
 ConfigKr.C:176
 ConfigKr.C:177
 ConfigKr.C:178
 ConfigKr.C:179
 ConfigKr.C:180
 ConfigKr.C:181
 ConfigKr.C:182
 ConfigKr.C:183
 ConfigKr.C:184
 ConfigKr.C:185
 ConfigKr.C:186
 ConfigKr.C:187
 ConfigKr.C:188
 ConfigKr.C:189
 ConfigKr.C:190
 ConfigKr.C:191
 ConfigKr.C:192
 ConfigKr.C:193
 ConfigKr.C:194
 ConfigKr.C:195
 ConfigKr.C:196
 ConfigKr.C:197
 ConfigKr.C:198
 ConfigKr.C:199
 ConfigKr.C:200
 ConfigKr.C:201
 ConfigKr.C:202
 ConfigKr.C:203
 ConfigKr.C:204
 ConfigKr.C:205
 ConfigKr.C:206
 ConfigKr.C:207
 ConfigKr.C:208
 ConfigKr.C:209
 ConfigKr.C:210
 ConfigKr.C:211
 ConfigKr.C:212
 ConfigKr.C:213
 ConfigKr.C:214
 ConfigKr.C:215
 ConfigKr.C:216
 ConfigKr.C:217
 ConfigKr.C:218
 ConfigKr.C:219
 ConfigKr.C:220
 ConfigKr.C:221
 ConfigKr.C:222
 ConfigKr.C:223
 ConfigKr.C:224
 ConfigKr.C:225
 ConfigKr.C:226
 ConfigKr.C:227
 ConfigKr.C:228
 ConfigKr.C:229
 ConfigKr.C:230
 ConfigKr.C:231
 ConfigKr.C:232
 ConfigKr.C:233
 ConfigKr.C:234
 ConfigKr.C:235
 ConfigKr.C:236
 ConfigKr.C:237
 ConfigKr.C:238
 ConfigKr.C:239
 ConfigKr.C:240
 ConfigKr.C:241
 ConfigKr.C:242
 ConfigKr.C:243
 ConfigKr.C:244
 ConfigKr.C:245
 ConfigKr.C:246
 ConfigKr.C:247
 ConfigKr.C:248
 ConfigKr.C:249
 ConfigKr.C:250
 ConfigKr.C:251
 ConfigKr.C:252
 ConfigKr.C:253
 ConfigKr.C:254
 ConfigKr.C:255
 ConfigKr.C:256
 ConfigKr.C:257
 ConfigKr.C:258
 ConfigKr.C:259
 ConfigKr.C:260
 ConfigKr.C:261
 ConfigKr.C:262
 ConfigKr.C:263
 ConfigKr.C:264
 ConfigKr.C:265
 ConfigKr.C:266
 ConfigKr.C:267
 ConfigKr.C:268
 ConfigKr.C:269
 ConfigKr.C:270
 ConfigKr.C:271
 ConfigKr.C:272
 ConfigKr.C:273
 ConfigKr.C:274
 ConfigKr.C:275
 ConfigKr.C:276
 ConfigKr.C:277
 ConfigKr.C:278
 ConfigKr.C:279
 ConfigKr.C:280
 ConfigKr.C:281
 ConfigKr.C:282
 ConfigKr.C:283
 ConfigKr.C:284
 ConfigKr.C:285
 ConfigKr.C:286
 ConfigKr.C:287
 ConfigKr.C:288
 ConfigKr.C:289
 ConfigKr.C:290
 ConfigKr.C:291
 ConfigKr.C:292
 ConfigKr.C:293
 ConfigKr.C:294
 ConfigKr.C:295
 ConfigKr.C:296
 ConfigKr.C:297
 ConfigKr.C:298
 ConfigKr.C:299
 ConfigKr.C:300
 ConfigKr.C:301
 ConfigKr.C:302
 ConfigKr.C:303
 ConfigKr.C:304
 ConfigKr.C:305
 ConfigKr.C:306
 ConfigKr.C:307
 ConfigKr.C:308
 ConfigKr.C:309
 ConfigKr.C:310
 ConfigKr.C:311
 ConfigKr.C:312
 ConfigKr.C:313
 ConfigKr.C:314
 ConfigKr.C:315
 ConfigKr.C:316
 ConfigKr.C:317
 ConfigKr.C:318
 ConfigKr.C:319
 ConfigKr.C:320
 ConfigKr.C:321
 ConfigKr.C:322
 ConfigKr.C:323
 ConfigKr.C:324
 ConfigKr.C:325
 ConfigKr.C:326
 ConfigKr.C:327
 ConfigKr.C:328
 ConfigKr.C:329
 ConfigKr.C:330
 ConfigKr.C:331
 ConfigKr.C:332
 ConfigKr.C:333
 ConfigKr.C:334
 ConfigKr.C:335
 ConfigKr.C:336
 ConfigKr.C:337
 ConfigKr.C:338
 ConfigKr.C:339
 ConfigKr.C:340
 ConfigKr.C:341
 ConfigKr.C:342
 ConfigKr.C:343
 ConfigKr.C:344
 ConfigKr.C:345
 ConfigKr.C:346
 ConfigKr.C:347
 ConfigKr.C:348
 ConfigKr.C:349
 ConfigKr.C:350
 ConfigKr.C:351
 ConfigKr.C:352
 ConfigKr.C:353
 ConfigKr.C:354
 ConfigKr.C:355
 ConfigKr.C:356
 ConfigKr.C:357
 ConfigKr.C:358
 ConfigKr.C:359
 ConfigKr.C:360
 ConfigKr.C:361
 ConfigKr.C:362
 ConfigKr.C:363
 ConfigKr.C:364
 ConfigKr.C:365