Пример #1
0
void Config()
{
  
  //____________________________________________________________________
  // 
  // ***** This part is for configuration:                   ******
  // ***** please, select the following 6 fields as you need ******
  //
  
  //1) Select your generator
  static PprRun_t srun = kGenFixed; //particle gun with fixed momentum, phi, theta
//   static PprRun_t srun = kGenBox;    //particle gun with const. distribution in theta
//   static PprRun_t srun = kCocktail; //EXAMPLE of Cocktail. From this example improve your own Cocktail of particles/generators.
  
  
  //2) Select your MC here
  static PprMC_t  mc   = kGEANT4;
//   static PprMC_t  mc   = kGEANT3TGEO;
  
  
  //3) Magnetic field in Tesla
  static Float_t MagField = 1.25;
  
  
  //4) Select the seed
  static Int_t  sseed = 123456; //Set 0 to use the current time 
  
  
  //5) Select the number of events per file root
  static Int_t evntperfile = 100;
  
  
  //6) Select SubDetectors to use
  
  Int_t   iPVBAR  = 1;  //Photon Veto Barrel
  Int_t   iPVEC   = 1;  //Photon Veto EndCap
  Int_t   iRSTACK = 1;  //Range Stack
  Int_t   iDCH    = 1;  //Drift Chamber
  Int_t   iTARGET = 1;  //Target
  
  
  // Set Random Number seed
  gRandom->SetSeed(sseed);
  
  IlcLog::Message(IlcLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
  
  
  
  //____________________________________________________________________
  IlcRunLoader* rl=0x0;
  
  cout<<"Config.C: Creating Run Loader ..."<<endl;
  
  rl = IlcRunLoader::Open("gilc.root", IlcConfig::GetDefaultEventFolderName(), "recreate");
  if (!rl)
  {
    gIlc->Fatal("Config.C","Can not instatiate the Run Loader");
    return;
  }
  
  // Set compression level for gIlc.root file
  rl->SetCompressionLevel(2);
  
  // Set number of events per file to "evntperfile" selected above
  rl->SetNumberOfEventsPerFile(evntperfile);
  
  // Set run loader to "rl"
  gIlc->SetRunLoader(rl);
  
  
  
  //generator configuration
  GeneratorFactory(srun);
  
  
  // Field (1.25 T)
  TGeoGlobalMagField::Instance()->SetField(new IlcMagF("MagField","MagField", MagField, 1., IlcMagF::kConst, IlcMagF::kNoBeamField));
  rl->CdGAFile();
  TGeoGlobalMagField::Instance()->GetField()->Write();
  
  comment = comment.Append(Form("*** MAGNETIC FIELD: Solenoidal %f Tesla\n", MagField));
  
  
  
  //=================== Ilc BODY parameters =============================
  IlcBODY *BODY = new IlcBODY("BODY", "Ilc envelop");
  
  comment = comment.Append("*** DETECTORS ON: ");
  
  
  if(iTARGET)
  {
    
    //=================== TARGET parameters ============================
    //TARGET version for ORKA
    //Mionor version: 1=square fibers; 2=poligonal shape
    Int_t MinorVersion = 1;
    
    IlcTARGETvORKA *TARGET  = new IlcTARGETvORKA("TARGET","TARGET version for ORKA",MinorVersion);
    
    comment = comment.Append(" TARGET ");
    
  }
  
  if (iDCH)
  {
    //=================== DCH parameters ===========================
    IlcDCH *DCH = new IlcDCHv1("DCH", "default");
    
    comment = comment.Append(" DCH ");
    
  }
  
  
  if (iPVBAR)
  {
    //=================== Photon Veto Barrel ===========================
    IlcPVBAR *PVBAR = new IlcPVBARv1("PVBAR", "ORKA");
    
    comment = comment.Append(" PVBAR ");
    
  }
  
  if (iPVEC)
  {
    //=================== Photon Veto EndCap ===========================
    IlcPVEC *PVEC = new IlcPVECv1("PVEC", "ORKA");
    
    comment = comment.Append(" PVEC ");
    
  }
  
  if (iRSTACK)
  {
    //=================== Range Stack ===========================
    IlcRSTACK *RSTACK = new IlcRSTACKv1("RSTACK", "ORKA");
    
    comment = comment.Append(" RSTACK ");
    
  }
  
  comment = comment.Append("\n*** MC: ");
  
  
  //MC section
  //__________________________________________________________________
  switch (mc) 
  {
    case kGEANT4:
      // 
      // libraries required by Geant4
      //       
      if (gClassTable->GetID("TGeant4") == -1) {
	
	if (!gInterpreter->IsLoaded("$G4VMC/examples/macro/g4libs.C")) {
	  gROOT->LoadMacro("$G4VMC/examples/macro/g4libs.C");
	  gInterpreter->ProcessLine("g4libs()");
	  if (gSystem->FindFile(gSystem->ExpandPathName("$ILC_ROOT/lib/tgt_$ILC_TARGET"),"libPhysicsList.so"))
	    gSystem->Load("libPhysicsList.so");
	}
	
      }
      //
      // Create Geant4 VMC
      //  
      TGeant4 *geant4 = 0;
      if (!gMC) {
	
	
	/********************************************************************************
	 *          
	 * "stepLimit" permits to choose the stepping in the step manager of the detector
	 * "specialCuts" permits to set your own cuts like:  gMC->SetCut("CUTGAM", cut);
	 * "specialControls" permits to set your own processes like:  gMC->SetProcess("DCAY",1);
	 *  
	 ********************************************************************************/

	//ORKA Physics list defined by user
	//ORKARunConfiguration *runConfiguration = new ORKARunConfiguration("geomVMCtoRoot","ORKA_PL_v1");

	//QGSP_BERT HP neutrons Physics list
	//TG4RunConfiguration* runConfiguration = new TG4RunConfiguration("geomVMCtoRoot","QGSP_BERT_HP");//,"stepLimiter+specialCut",true);
	
	//QGSP_BERT Physics list
	TG4RunConfiguration* runConfiguration = new TG4RunConfiguration("geomVMCtoRoot","QGSP_BERT");//,"stepLimiter+specialCut",true);
	geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo",runConfiguration);        
	
	cout << "Geant4 has been created." << endl;
      }      
      else{ 
	cout << "Monte Carlo has been already created." << endl;
      }
      
     /****************************************************************************************/
	
	
	// Switch on special cuts process
	//geant4->ProcessGeantCommand("/run/setCut 1.e-5");  
	//geant4->ProcessGeantCommand("/tracking/verbose 0");  
	
	//geant4->ProcessGeantCommand("/mcVerbose/all 0");
	//geant4->ProcessGeantCommand("/mcVerbose/runAction 1");
	//geant4->ProcessGeantCommand("/mcVerbose/geometryManager 2");
	//geant4->ProcessGeantCommand("/mcVerbose/stackingAction 0");
	//geant4->ProcessGeantCommand("/mcVerbose/eventAction 2");
	
	//geant4->ProcessGeantCommand("/run/particle/applyCuts");
	//geant4->ProcessGeantCommand("/random/setSavingFlag 1");
	//geant4->ProcessGeantCommand("/random/saveThisRun");
	
	//geant4->ProcessGeantCommand("/run/particle/applyCuts");  
	//geant4->ProcessGeantCommand("/mcVerbose/geometryManager 2");  
	//geant4->ProcessGeantCommand("/mcDet/volNameSeparator #");
	//geant4->ProcessGeantCommand("/mcDet/useVGM "); 
	//geant4->ProcessGeantCommand("/mcControl/g3Defaults");
	//geant4->ProcessGeantCommand("/mcPhysics/setStackPopperSelection e+ e- pi+ pi- kaon+ kaon- gamma");
	
	comment = comment.Append(" GEANT4 ");
	
	break;
	
	case kGEANT3TGEO:
	  
	  ///////////////////////////////////////////////////
	  // libraries required by geant321
	  #if defined(__CINT__)
	  gSystem->Load("libEGPythia6");
	  gSystem->Load("libpythia6");
	  gSystem->Load("libIlcPythia6");
	  gSystem->Load("libgeant321");
	  #endif
	  
	  
	  // 
	  // GEANT 3.21 MC 
	  // 
	  new TGeant3TGeo("C++ Interface to Geant3");
	  Printf("Making a TGeant3TGeo objet");
	  
	  // Set External decayer
	  TVirtualMCDecayer *decayer = new IlcDecayerPythia();
	  
	  decayer->SetForceDecay(kAll);
	  decayer->Init();
	  gMC->SetExternalDecayer(decayer);
	  
	  //************************************************************************
	  
	  //CUTGAM threshold for gamma transport;
	  //CUTELE threshold for electron and positron transport;
	  //CUTNEU threshold for neutral hadron transport;
	  //CUTHAD threshold for charged hadron and ion transport;
	  //CUTMUO threshold for muon transport;
	  //BCUTE threshold for photons produced by electron bremsstrahlung;
	  //BCUTM threshold for photons produced by muon bremsstrahlung;
	  //DCUTE threshold for electrons produced by electron delta-rays;
	  //DCUTM threshold for electrons produced by muon or hadron delta-rays;
	  //PPCUTM threshold for electron-positron direct pair production by muon;
	  //TOFMAX threshold on time of flight counted from primary interaction time;
	  //GCUTS free for user applications.
	  
	  //*********************************************************************
	  
	  
	  Float_t cut = 1.e-3;        // 1 MeV  cut by default for ILC
	  Float_t cutn = 0.;
	  Float_t tofmax = 1.e10;
	  
	  gMC->SetCut("CUTGAM", cut);
	  gMC->SetCut("CUTELE", cut);
	  gMC->SetCut("CUTNEU", cutn);
	  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); 
	  
	  
	  
	  comment = comment.Append(" GEANT3TGEO ");
	  
	  break;
	  
	  default:
	    gIlc->Fatal("Config.C", "No MC type chosen");
	    return;
  }
  
  
  
  
  gMC->SetProcess("DCAY",1); //Decay in flight with generation of secondaries.
  gMC->SetProcess("PAIR",1); //Pair production with generation of the electron-positron.
  gMC->SetProcess("COMP",1); //Compton scattering with generation of the electron.
  gMC->SetProcess("PHOT",1); //Photo-electric effect with generation of the electron.
  gMC->SetProcess("PFIS",0); //No photo-fission.
  gMC->SetProcess("DRAY",0); //No delta-rays production.
  gMC->SetProcess("ANNI",1); //Positron annihilation with generation of photons.
  gMC->SetProcess("BREM",1); //bremsstrahlung with generation of gamma.
  gMC->SetProcess("MUNU",1); //Muon-nucleus interactions with generation of secondaries.
  gMC->SetProcess("CKOV",1); //Cherenkov photon.
  gMC->SetProcess("HADR",1); //Hadronic interactions with generation of secondaries.
  gMC->SetProcess("LOSS",2); //Continuous energy loss without generation of delta-rays and full Landau-Vavilov-Gauss fluctuations. 
  //In this case "DRAY" is forced to 0 to avoid double
  //counting of fluctuations.
  gMC->SetProcess("MULS",1); //Multiple scattering according to Moliere theory.
  gMC->SetProcess("RAYL",1); //Rayleigh effect.  
  
  printf("\n \n");
  
  printf("***************** WITH THIS CONFIG YOU HAVE CHOOSEN ***************** ");  
  printf("\n \n%s \n \n", comment.Data());
  printf("\n*********************************************************************\n \n");
  
  IlcLog::Message(IlcLog::kInfo, "END OF CONFIG", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
  
  printf("\n \n");
  
  
  gMC->SetMaxNStep(1000000);  
  
}
Пример #2
0
void genExtFileConfig()
{
  cout << "Running genExtFileConfig.C ... " << endl;

  //=======================================================================
  // Steering parameters for ILC simulation
  //=======================================================================

  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); 

  //=======================================================================
  // External decayer
  //=======================================================================

  TVirtualMCDecayer *decayer = new IlcDecayerPythia();
  decayer->SetForceDecay(kAll);
  decayer->Init();
/*
  //forbid some decays
  IlcPythia * py= IlcPythia::Instance();
  py->SetMDME(737,1,0); //forbid D*+->D+ + pi0
  py->SetMDME(738,1,0);//forbid D*+->D+ + gamma

  for(Int_t d=747; d<=762; d++){ 
    py->SetMDME(d,1,0);
  }

  for(Int_t d=764; d<=807; d++){ 
    py->SetMDME(d,1,0);
  }
*/
  gMC->SetExternalDecayer(decayer);
  
  //=======================================================================
  // Event generator
  //=======================================================================

  // External generator configuration
  IlcGenerator* gener = GeneratorFactory();
  gener->SetOrigin(0, 0, 0);    // vertex position
  //gener->SetSigma(0, 0, 5.3);   // Sigma in (X,Y,Z) (cm) on IP position
  //gener->SetCutVertexZ(1.);     // Truncate at 1 sigma
  //gener->SetVertexSmear(kPerEvent); 
  gener->SetTrackingFlag(1);
  gener->Init();
    
  cout << "Running genExtFileConfig.C finished ... " << endl;
}
Пример #3
0
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(sseed);
    cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl; 
  


   // libraries required by geant321 and Pythia6
#if defined(__CINT__)
    gSystem->Load("liblhapdf.so");      // Parton density functions
    gSystem->Load("libEGPythia6.so");   // TGenerator interface
    gSystem->Load("libpythia6.so");     // Pythia
    gSystem->Load("libIlcPythia6.so");  // ILC specific implementations
    gSystem->Load("libgeant321");
#endif

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

    IlcRunLoader* rl=0x0;

    cout<<"Config.C: Creating Run Loader ..."<<endl;
    rl = IlcRunLoader::Open("gilc.root",
			    IlcConfig::GetDefaultEventFolderName(),
			    "recreate");
    if (rl == 0x0)
      {
	gIlc->Fatal("Config.C","Can not instatiate the Run Loader");
	return;
      }
    rl->SetCompressionLevel(2);
    rl->SetNumberOfEventsPerFile(100);
    gIlc->SetRunLoader(rl);

  // Set the trigger configuration
    IlcSimulation::Instance()->SetTriggerConfig(pprTrigConfName[strig]);
    cout<<"Trigger configuration is set to  "<<pprTrigConfName[strig]<<endl;


    //
    // Set External decayer
    IlcDecayer *decayer = new IlcDecayerPythia();
    decayer->SetForceDecay(kAll);
    decayer->Init();

    //forbid some decays
    IlcPythia * py= IlcPythia::Instance();
    py->SetMDME(737,1,0); //forbid D*+->D+ + pi0
    py->SetMDME(738,1,0);//forbid D*+->D+ + gamma

    for(Int_t d=747; d<=762; d++){ 
      py->SetMDME(d,1,0);
    }

    for(Int_t d=764; d<=807; d++){ 
      py->SetMDME(d,1,0);
    }


   
    gMC->SetExternalDecayer(decayer);
    //
    //
    //=======================================================================
    //
    //=======================================================================
    // ************* STEERING parameters FOR ILC SIMULATION **************
    // --- Specify event type to be tracked through the ILC 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); 

    // Debug and log level
    //    IlcLog::SetGlobalDebugLevel(0);
    //    IlcLog::SetGlobalLogLevel(IlcLog::kError);

    // Generator Configuration
    IlcGenerator* gener = GeneratorFactory();
    gener->SetOrigin(0, 0, 0);    // vertex position
    gener->SetSigma(0, 0, 5.3);   // Sigma in (X,Y,Z) (cm) on IP position
    gener->SetCutVertexZ(1.);     // Truncate at 1 sigma
    gener->SetVertexSmear(kPerEvent); 
    gener->SetTrackingFlag(1);
    gener->Init();
    
    if (smag == IlcMagF::k2kG) {
	comment = comment.Append(" | L3 field 0.2 T");
    } else if (smag == IlcMagF::k5kG) {
	comment = comment.Append(" | L3 field 0.5 T");
    }
    
    
    if (srad == kGluonRadiation)
    {
	comment = comment.Append(" | Gluon Radiation On");
	
    } else {
	comment = comment.Append(" | Gluon Radiation Off");
    }


    printf("\n \n Comment: %s \n \n", comment.Data());
    
    
// Field (L3 0.4 T)
    IlcMagF* field = new IlcMagF("Maps","Maps",-1., -1., smag);
    TGeoGlobalMagField::Instance()->SetField(field);

    rl->CdGAFile();
    //
    Int_t   iABSO   = 1;
    Int_t   iDIPO   = 1;
    Int_t   iFMD    = 1;
    Int_t   iFRAME  = 1;
    Int_t   iHALL   = 1;
    Int_t   iITS    = 1;
    Int_t   iMAG    = 1;
    Int_t   iMUON   = 1;
    Int_t   iPHOS   = 1;
    Int_t   iPIPE   = 1;
    Int_t   iPMD    = 1;
    Int_t   iHMPID   = 1;
    Int_t   iSHIL   = 1;
    Int_t   iT0  = 1;
    Int_t   iTOF    = 1;
    Int_t   iTPC    = 1;
    Int_t   iTRD    = 1;
    Int_t   iZDC    = 1;
    Int_t   iEMCAL  = 1;
    Int_t   iVZERO  = 1;
    Int_t   iACORDE    = 0;

    //=================== Ilc BODY parameters =============================
    IlcBODY *BODY = new IlcBODY("BODY", "Ilc envelop");


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


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

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

        IlcDIPO *DIPO = new IlcDIPOv3("DIPO", "Dipole version 3");
    }

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

        IlcHALL *HALL = new IlcHALLv3("HALL", "Ilc Hall");
    }


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

        IlcFRAMEv2 *FRAME = new IlcFRAMEv2("FRAME", "Space Frame");
	FRAME->SetHoles(1);
    }

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

        IlcSHIL *SHIL = new IlcSHILv3("SHIL", "Shielding Version 3");
    }


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

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

	IlcITS *ITS  = new IlcITSv11("ITS","ITS v11");
    }

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


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


    if (iHMPID)
    {
        //=================== HMPID parameters ===========================
        IlcHMPID *HMPID = new IlcHMPIDv3("HMPID", "normal HMPID");

    }


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

        IlcZDC *ZDC = new IlcZDCv4("ZDC", "normal ZDC");
    }

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

        IlcTRD *TRD = new IlcTRDv1("TRD", "TRD slow simulator");
    }

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

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

    if (iPHOS)
    {
        IlcPHOS *PHOS = new IlcPHOSv1("PHOS", "IHEP");
    }


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

    if (iT0)
    {
        //=================== T0 parameters ============================
        IlcT0 *T0 = new IlcT0v1("T0", "T0 Detector");
    }

    if (iEMCAL)
    {
        //=================== EMCAL parameters ============================
        IlcEMCAL *EMCAL = new IlcEMCALv2("EMCAL", "EMCAL_COMPLETEV1");
    }

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

     if (iVZERO)
    {
        //=================== VZERO parameters ============================
        IlcVZERO *VZERO = new IlcVZEROv7("VZERO", "normal VZERO");
    }
 
             
}