From 967f53067fac7093144000bdb7fae4aa8549a11f Mon Sep 17 00:00:00 2001 From: hristov Date: Wed, 22 Nov 2006 10:11:33 +0000 Subject: [PATCH] Scripts for the AliRoot primer --- doc/aliroot-primer/scripts/Config.C | 180 ++++++++++++++++++++++++ doc/aliroot-primer/scripts/confroot | 14 ++ doc/aliroot-primer/scripts/fastGen.C | 81 +++++++++++ doc/aliroot-primer/scripts/lsfjob | 17 +++ doc/aliroot-primer/scripts/makeclhep | 6 + doc/aliroot-primer/scripts/makeclhepcvs | 10 ++ doc/aliroot-primer/scripts/makefluka | 11 ++ doc/aliroot-primer/scripts/makeg3 | 5 + doc/aliroot-primer/scripts/makeg4 | 56 ++++++++ doc/aliroot-primer/scripts/makeroot | 17 +++ 10 files changed, 397 insertions(+) create mode 100644 doc/aliroot-primer/scripts/Config.C create mode 100644 doc/aliroot-primer/scripts/confroot create mode 100644 doc/aliroot-primer/scripts/fastGen.C create mode 100644 doc/aliroot-primer/scripts/lsfjob create mode 100644 doc/aliroot-primer/scripts/makeclhep create mode 100644 doc/aliroot-primer/scripts/makeclhepcvs create mode 100644 doc/aliroot-primer/scripts/makefluka create mode 100644 doc/aliroot-primer/scripts/makeg3 create mode 100644 doc/aliroot-primer/scripts/makeg4 create mode 100644 doc/aliroot-primer/scripts/makeroot diff --git a/doc/aliroot-primer/scripts/Config.C b/doc/aliroot-primer/scripts/Config.C new file mode 100644 index 00000000000..dc8fd1d0d74 --- /dev/null +++ b/doc/aliroot-primer/scripts/Config.C @@ -0,0 +1,180 @@ +// Function converting pseudorapidity +// interval to polar angle interval. It is used to set +// the limits in the generator +Float_t EtaToTheta(Float_t arg){ + return (180./TMath::Pi())*2.*atan(exp(-arg)); +} + +// Set Random Number seed using the current time +TDatime dat; +static UInt_t sseed = dat.Get(); + +void Config() +{ + gRandom->SetSeed(sseed); + cout<<"Seed for random number generation= "<GetSeed()<Load("libgeant321"); + + // Instantiation of the particle transport package. gMC is set internaly + new TGeant3TGeo("C++ Interface to Geant3"); + + // Create run loader and set some properties + AliRunLoader* rl = AliRunLoader::Open("galice.root", + AliConfig::GetDefaultEventFolderName(), + "recreate"); + if (!rl) Fatal("Config.C","Can not instatiate the Run Loader"); + rl->SetCompressionLevel(2); + rl->SetNumberOfEventsPerFile(3); + + // Register the run loader in gAlice + gAlice->SetRunLoader(rl); + + // Set external decayer + TVirtualMCDecayer *decayer = new AliDecayerPythia(); + decayer->SetForceDecay(kAll); // kAll means no specific decay is forced + decayer->Init(); + + // Register the external decayer in the transport package + gMC->SetExternalDecayer(decayer); + + // STEERING parameters FOR ALICE SIMULATION + // Specify event type to be transported through the ALICE setup + // All positions are in cm, angles in degrees, and P and E in GeV + // For the details see the GEANT 3 manual + + // Switch on/off the physics processes (global) + // Please consult the file data/galice.cuts for detector + // specific settings, i.e. DRAY + gMC->SetProcess("DCAY",1); // Particle decay + gMC->SetProcess("PAIR",1); // Pair production + gMC->SetProcess("COMP",1); // Compton scattering + gMC->SetProcess("PHOT",1); // Photo effect + gMC->SetProcess("PFIS",0); // Photo fission + gMC->SetProcess("DRAY",0); // Delta rays + gMC->SetProcess("ANNI",1); // Positron annihilation + gMC->SetProcess("BREM",1); // Bremstrahlung + gMC->SetProcess("MUNU",1); // Muon nuclear interactions + gMC->SetProcess("CKOV",1); // Cerenkov production + gMC->SetProcess("HADR",1); // Hadronic interactions + gMC->SetProcess("LOSS",2); // Energy loss (2=complete fluct.) + gMC->SetProcess("MULS",1); // Multiple scattering + gMC->SetProcess("RAYL",1); // Rayleigh scattering + + // Set the transport package cuts + Float_t cut = 1.e-3; // 1MeV cut by default + Float_t tofmax = 1.e10; + + gMC->SetCut("CUTGAM", cut); // Cut for gammas + gMC->SetCut("CUTELE", cut); // Cut for electrons + gMC->SetCut("CUTNEU", cut); // Cut for neutral hadrons + gMC->SetCut("CUTHAD", cut); // Cut for charged hadrons + gMC->SetCut("CUTMUO", cut); // Cut for muons + gMC->SetCut("BCUTE", cut); // Cut for electron brems. + gMC->SetCut("BCUTM", cut); // Cut for muon brems. + gMC->SetCut("DCUTE", cut); // Cut for electron delta-rays + gMC->SetCut("DCUTM", cut); // Cut for muon delta-rays + gMC->SetCut("PPCUTM", cut); // Cut for e+e- pairs by muons + gMC->SetCut("TOFMAX", tofmax); // Time of flight cut + + // Set up the particle generation + + // AliGenCocktail permits to combine several different generators + AliGenCocktail *gener = new AliGenCocktail(); + + // The phi range is always inside 0-360 + gener->SetPhiRange(0, 360); + + // Set pseudorapidity range from -8 to 8. + Float_t thmin = EtaToTheta(8); // theta min. <---> eta max + Float_t thmax = EtaToTheta(-8); // theta max. <---> eta min + gener->SetThetaRange(thmin,thmax); + + 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); + + // First cocktail component: 100 ``background'' particles + AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(100); + hijingparam->SetMomentumRange(0.2, 999); + gener->AddGenerator(hijingparam,"HIJING PARAM",1); + + // Second cocktail component: one gamma in PHOS direction + AliGenBox *genbox = new AliGenBox(1); + genbox->SetMomentumRange(10,11.); + genbox->SetPhiRange(270.5,270.7); + genbox->SetThetaRange(90.5,90.7); + genbox->SetPart(22); + gener->AddGenerator(genbox,"GENBOX GAMMA for PHOS",1); + + gener->Init(); // Initialization of the coctail generator + + // Field (the last parameter is 1 => L3 0.4 T) + AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1); + gAlice->SetField(field); + + // Make sure the current ROOT directory is in galice.root + rl->CdGAFile(); + + // Build the setup and set some detector parameters + + // ALICE BODY parameters. BODY is always present + AliBODY *BODY = new AliBODY("BODY", "ALICE envelop"); + + // Start with Magnet since detector layouts may be depending + // on the selected Magnet dimensions + AliMAG *MAG = new AliMAG("MAG", "Magnet"); + + AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber"); // Absorber + + AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2"); // Dipole magnet + + AliHALL *HALL = new AliHALL("HALL", "ALICE Hall"); // Hall + + AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame"); // Space frame + + AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2"); // Shielding + + AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe"); // Beam pipe + + // ITS parameters + AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS", + "ITS PPR detailed version with asymmetric services"); + ITS->SetMinorVersion(2); // don't change it if you're not an ITS developer + ITS->SetReadDet(kFALSE); // don't change it if you're not an ITS developer + ITS->SetThicknessDet1(200.); // detector thickness on layer 1:[100,300] mkm + ITS->SetThicknessDet2(200.); // detector thickness on layer 2:[100,300] mkm + ITS->SetThicknessChip1(150.); // chip thickness on layer 1: [150,300] mkm + ITS->SetThicknessChip2(150.); // chip thickness on layer 2: [150,300] + ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out + ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon + ITS->SetEUCLID(0); // no output for the EUCLID CAD system + + + AliTPC *TPC = new AliTPCv2("TPC", "Default"); // TPC + + AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF"); // TOF + + AliRICH *RICH = new AliRICHv1("RICH", "normal RICH"); // HMPID + + AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC"); // ZDC + + AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator"); // TRD + + AliFMD *FMD = new AliFMDv1("FMD", "normal FMD"); // FMD + + AliMUON *MUON = new AliMUONv1("MUON", "default"); // MUON + + AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP"); // PHOS + + AliPMD *PMD = new AliPMDv1("PMD", "normal PMD"); // PMD + + AliSTART *START = new AliSTARTv1("START", "START Detector"); // START + + // EMCAL + AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG"); + + AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO"); // VZERO +} diff --git a/doc/aliroot-primer/scripts/confroot b/doc/aliroot-primer/scripts/confroot new file mode 100644 index 00000000000..fe8322d3c46 --- /dev/null +++ b/doc/aliroot-primer/scripts/confroot @@ -0,0 +1,14 @@ +#!/bin/sh + +cd root +export ROOTSYS=`pwd` + +ALIEN_ROOT=/opt/alien + +./configure \ + --with-pythia6-uscore=SINGLE \ + --enable-cern --enable-rfio \ + --enable-mathmore --enable-mathcore --enable-roofit \ + --enable-asimage --enable-minuit2 \ + --enable-alien --with-alien-incdir=${ALIEN_ROOT}/api/include \ + --with-alien-libdir=${ALIEN_ROOT}/api/lib diff --git a/doc/aliroot-primer/scripts/fastGen.C b/doc/aliroot-primer/scripts/fastGen.C new file mode 100644 index 00000000000..fe95be875ef --- /dev/null +++ b/doc/aliroot-primer/scripts/fastGen.C @@ -0,0 +1,81 @@ +void fastGen(Int_t nev = 1, char* filename = "galice.root") +{ + // Run loader + 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(); + + // Generator + AliGenPythia *gener = new AliGenPythia(-1); + gener->SetMomentumRange(0,999999); + gener->SetProcess(kPyMb); + gener->SetEnergyCMS(14000.); + gener->SetThetaRange(45, 135); + gener->SetPtRange(0., 1000.); + gener->SetStack(stack); + gener->Init(); + rl->CdGAFile(); + // + // Event Loop + // + for (Int_t iev = 0; iev < nev; iev++) { + + // Initialize event + header->Reset(0,iev); + rl->SetEventNumber(iev); + stack->Reset(); + rl->MakeTree("K"); + + // Generate event + Int_t nprim = 0; + Int_t ntrial = 0; + Int_t minmult = 1000; + + while(nprimReset(); + gener->Generate(); + ntrial++; + nprim = stack->GetNprimary(); + + } + cout << "Number of particles " << nprim << endl; + cout << "Number of trials " << ntrial << endl; + + // 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(); + // Stack + stack->FinishRun(); + // Write file + rl->WriteHeader("OVERWRITE"); + gener->Write(); + rl->Write(); +} + + + + diff --git a/doc/aliroot-primer/scripts/lsfjob b/doc/aliroot-primer/scripts/lsfjob new file mode 100644 index 00000000000..1405613c495 --- /dev/null +++ b/doc/aliroot-primer/scripts/lsfjob @@ -0,0 +1,17 @@ +#! /bin/sh +# Take all the C++ macros from the local computer to the working directory +command scp phristov@pcepalice69:/home/phristov/pp/*.C . + +# Execute the simulation macro. Redirect the output and error streams +command aliroot -b -q sim.C > sim.log 2>&1 + +# Execute the reconstruction macro. Redirect the output and error streams +command aliroot -b -q rec.C > rec.log 2>&1 + +# Create a new CASTOR directory for this job ($LSB_JOBID) +command rfmkdir /castor/cern.ch/user/p/phristov/pp/$LSB_JOBID + +# Copy all log files to CASTOR +for a in *.log; do rfcp $a /castor/cern.ch/user/p/phristov/pp/$LSB_JOBID; done +# Copy all ROOT files to CASTOR +for a in *.root; do rfcp $a /castor/cern.ch/user/p/phristov/pp/$LSB_JOBID; done diff --git a/doc/aliroot-primer/scripts/makeclhep b/doc/aliroot-primer/scripts/makeclhep new file mode 100644 index 00000000000..5dca9aa4ddc --- /dev/null +++ b/doc/aliroot-primer/scripts/makeclhep @@ -0,0 +1,6 @@ +tar zxvf clhep-2.0.3.1.tgz +cd 2.0.3.1/CLHEP +./configure --prefix=$ALICE/CLHEP # Select the place to install CLHEP +make +make check +make install diff --git a/doc/aliroot-primer/scripts/makeclhepcvs b/doc/aliroot-primer/scripts/makeclhepcvs new file mode 100644 index 00000000000..c19f0c312d3 --- /dev/null +++ b/doc/aliroot-primer/scripts/makeclhepcvs @@ -0,0 +1,10 @@ +cvs -d :pserver:anonymous@clhep.cvs.cern.ch:/cvs/CLHEP login +# Empty password +cvs -d :pserver:anonymous@clhep.cvs.cern.ch:/cvs/CLHEP \ + co -r CLHEP_2_0_3_1 CLHEP +cd CLHEP +./bootstrap +./configure --prefix=$ALICE/CLHEP # Select the place to install CLHEP +make +make check +make install diff --git a/doc/aliroot-primer/scripts/makefluka b/doc/aliroot-primer/scripts/makefluka new file mode 100644 index 00000000000..103cc8903b5 --- /dev/null +++ b/doc/aliroot-primer/scripts/makefluka @@ -0,0 +1,11 @@ +# Make fluka subdirectory in $ALICE +cd $ALICE +mkdir fluka + +# Unpack the FLUKA libraries in the $ALICE/fluka directory. +# Please set correctly the path to the FLUKA tarball. +cd fluka +tar zxvf /fluka2006.3-linuxAA.tar.gz + +# Set the environment variables +export FLUPRO=$ALICE/fluka diff --git a/doc/aliroot-primer/scripts/makeg3 b/doc/aliroot-primer/scripts/makeg3 new file mode 100644 index 00000000000..fd2eea5b1b0 --- /dev/null +++ b/doc/aliroot-primer/scripts/makeg3 @@ -0,0 +1,5 @@ +cd $ALICE +cvs -q -z2 -d :pserver:cvs@root.cern.ch:/user/cvs co -r v1-3 geant3 +cd $ALICE/geant3 +export PLATFORM=`root-config --arch` +make diff --git a/doc/aliroot-primer/scripts/makeg4 b/doc/aliroot-primer/scripts/makeg4 new file mode 100644 index 00000000000..c2d4ad123a1 --- /dev/null +++ b/doc/aliroot-primer/scripts/makeg4 @@ -0,0 +1,56 @@ +tar zxvf geant4.8.1.p02.tar.gz +cd geant4.8.1.p02 +mkdir data +cd data +tar zxvf ../../G4NDL.3.9.tar.gz +tar zxvf ../../G4EMLOW4.0.tar.gz +tar zxvf ../../PhotonEvaporation.2.0.tar.gz +tar zxvf ../../RadiativeDecay.3.0.tar.gz +tar zxvf ../../G4ELASTIC.1.1.tar.gz +cd .. + +# Configuration and compilation + +./Configure -build + +# As asnwer choose the default (proposed) value, except of the following +# (please note that the "Question" word itself is not displayed) + + +# Question: Specify the path where Geant4 libraries and source files should be +# installed. $ALICE/geant4 + +# Question: Directory $ALICE/geant4 doesn't exist. Use that name anyway? Y + +# Question: Do you want to copy all Geant4 headers in one directory? Y + +# Question: Please, specify where CLHEP is installed: $ALICE/CLHEP + +# Question: Do you want to build 'shared' (.so) libraries? Y + +# Question: +# G4VIS_BUILD_OPENGLX_DRIVER +# G4VIS_USE_OPENGLX +# +# It is an interface to the de facto standard 3D graphics library, +# OpenGL. It is well suited for real-time fast visualization +# and prototyping. The X11 version of the OpenGL libraries is +# required. Y + +# Question: +# G4LIB_BUILD_G3TOG4 +# +# The utility module 'g3tog4' will be built by setting this +# variable. NOTE: it requires a valid FORTRAN compiler to be +# installed on your system and the 'cernlib' command in the +# path, in order to build the ancillary tools! +# Do you want to build 'g3tog4' ? Y + +# now a long compilation... + +# Installation in the selected place ($ALICE/geant4) +./Configure -install + +# Environment variables (please note the "dot" in the beginning) +# The has to ve replaced by the actiual value +. $ALICE/geant4/src/geant4/.config/bin//env.sh diff --git a/doc/aliroot-primer/scripts/makeroot b/doc/aliroot-primer/scripts/makeroot new file mode 100644 index 00000000000..f09f3438e2b --- /dev/null +++ b/doc/aliroot-primer/scripts/makeroot @@ -0,0 +1,17 @@ +#!/bin/sh + +make +make map +cd test +make +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. +export PATH=$LD_LIBRARY_PATH:. +./stress +./stressFit +./stressGeometry +./stressGraphics +./stressHepix +./stressLinear +./stressShapes +./stressSpectrum +./stressVector -- 2.39.3