]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/genExtFileConfig.C
fix for pid in pr task: sjena
[u/mrichter/AliRoot.git] / MUON / genExtFileConfig.C
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 /// \ingroup macros
19 /// \file genExtFileConfig.C
20 /// \brief Configuration macro for event generator from external file
21 /// for MUON spectrometer Monte Carlo simulation
22
23 // Functions
24 Float_t EtaToTheta(Float_t arg);
25 AliGenerator* GeneratorFactory();
26
27 void genConfig()
28 {
29   cout << "Running genExtFileConfig.C ... " << endl;
30
31   //=======================================================================
32   // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
33   if ( gMC ) {
34     gMC->SetProcess("DCAY",1);
35     gMC->SetProcess("PAIR",1);
36     gMC->SetProcess("COMP",1);
37     gMC->SetProcess("PHOT",1);
38     gMC->SetProcess("PFIS",0);
39     gMC->SetProcess("DRAY",0);
40     gMC->SetProcess("ANNI",1);
41     gMC->SetProcess("BREM",1);
42     gMC->SetProcess("MUNU",1);
43     gMC->SetProcess("CKOV",1);
44     gMC->SetProcess("HADR",1);
45     gMC->SetProcess("LOSS",2);
46     gMC->SetProcess("MULS",1);
47     gMC->SetProcess("RAYL",1);
48     Float_t cut = 1.e-3;        // 1MeV cut by default
49     Float_t tofmax = 1.e10;
50     gMC->SetCut("CUTGAM", cut);
51     gMC->SetCut("CUTELE", cut);
52     gMC->SetCut("CUTNEU", cut);
53     gMC->SetCut("CUTHAD", cut);
54     gMC->SetCut("CUTMUO", cut);
55     gMC->SetCut("BCUTE",  cut); 
56     gMC->SetCut("BCUTM",  cut); 
57     gMC->SetCut("DCUTE",  cut); 
58     gMC->SetCut("DCUTM",  cut); 
59     gMC->SetCut("PPCUTM", cut);
60     gMC->SetCut("TOFMAX", tofmax); 
61   }
62
63   //=======================================================================
64   // External decayer
65   //=======================================================================
66
67   // Set External decayer
68   TVirtualMCDecayer *decayer = new AliDecayerPythia();
69   decayer->SetForceDecay(kAll);
70   decayer->Init();
71   if ( gMC ) gMC->SetExternalDecayer(decayer);
72   
73   //=======================================================================
74   // Event generator
75   //=======================================================================
76
77   // External generator configuration
78   AliGenerator* gener = GeneratorFactory();
79   gener->SetOrigin(0, 0, 0);    // vertex position
80   //gener->SetSigma(0, 0, 5.3);   // Sigma in (X,Y,Z) (cm) on IP position
81   //gener->SetCutVertexZ(1.);     // Truncate at 1 sigma
82   //gener->SetVertexSmear(kPerEvent); 
83   gener->SetTrackingFlag(1);
84   gener->Init();
85     
86   cout << "Running genExtFileConfig.C finished ... " << endl;
87 }
88
89 Float_t EtaToTheta(Float_t arg){
90   return (180./TMath::Pi())*2.*atan(exp(-arg));
91 }
92
93 AliGenerator* GeneratorFactory() {
94
95   AliGenExtFile *gener = new AliGenExtFile(-1);
96   AliGenReaderTreeK * reader = new AliGenReaderTreeK();
97
98   reader->SetFileName("galice.root");
99   reader->AddDir("$ALICE_ROOT/MUON/gen");
100   gener->SetReader(reader);
101      
102   return gener; 
103 }
104