New class for misalignment
[u/mrichter/AliRoot.git] / MUON / Config.C
CommitLineData
8d6c1ae0 1// Config file test for MUON spectormeter
2// Remember to define the directory and option
3// gAlice->SetConfigFunction("Config('$HOME','box');");
4
6b1e4b22 5void Config(char directory[100]="", char option[6]="param")
8d6c1ae0 6{
7 //
8 // Config file for MUON test
6570c14d 9 //
8d6c1ae0 10
11 //=====================================================================
12 // Libraries required by geant321
13 gSystem->Load("libgeant321.so");
6570c14d 14 new TGeant3TGeo("C++ Interface to Geant3");
8d6c1ae0 15 //=======================================================================
16 // Create the output file
17 Text_t filename[100];
18 sprintf(filename,"%sgalice.root",directory);
19 cout << ">>> Output file is " << filename << endl;
20 cout << ">>> Config.C: Creating Run Loader ..."<<endl;
21 AliRunLoader* rl=0x0;
22 rl = AliRunLoader::Open(
23 filename, AliConfig::GetDefaultEventFolderName(), "recreate");
24 if (rl == 0x0) {
25 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
26 return;
27 }
28 rl->SetCompressionLevel(2);
29 rl->SetNumberOfEventsPerFile(100);
30 gAlice->SetRunLoader(rl);
31
b5fb1f3e 32 //AliLog::SetModuleDebugLevel("MUON", 1);
8d6c1ae0 33
34 //=======================================================================
35 // Set External decayer
36 TVirtualMCDecayer *decayer = new AliDecayerPythia();
37 decayer->SetForceDecay(kAll);
38 decayer->Init();
39 gMC->SetExternalDecayer(decayer);
40
41 //
42 //=======================================================================
43 // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
44 gMC->SetProcess("DCAY",1);
45 gMC->SetProcess("PAIR",1);
46 gMC->SetProcess("COMP",1);
47 gMC->SetProcess("PHOT",1);
48 gMC->SetProcess("PFIS",0);
49 gMC->SetProcess("DRAY",0);
50 gMC->SetProcess("ANNI",1);
51 gMC->SetProcess("BREM",1);
52 gMC->SetProcess("MUNU",1);
53 gMC->SetProcess("CKOV",1);
54 gMC->SetProcess("HADR",1);
55 gMC->SetProcess("LOSS",2);
56 gMC->SetProcess("MULS",1);
57 gMC->SetProcess("RAYL",1);
58
59 Float_t cut = 1.e-3; // 1MeV cut by default
60 Float_t tofmax = 1.e10;
61
62 gMC->SetCut("CUTGAM", cut);
63 gMC->SetCut("CUTELE", cut);
64 gMC->SetCut("CUTNEU", cut);
65 gMC->SetCut("CUTHAD", cut);
66 gMC->SetCut("CUTMUO", cut);
67 gMC->SetCut("BCUTE", cut);
68 gMC->SetCut("BCUTM", cut);
69 gMC->SetCut("DCUTE", cut);
70 gMC->SetCut("DCUTM", cut);
71 gMC->SetCut("PPCUTM", cut);
72 gMC->SetCut("TOFMAX", tofmax);
73 //
74 //=======================================================================
75 // ************* STEERING parameters FOR ALICE SIMULATION **************
76 // Chamber positions
77 // From AliMUONConstants class we get :
78 // Position Z (along beam) of the chambers (in cm)
79 // (from AliMUONConstants class):
80 // 533.5, 546.5, 678.5, 693.5, 964.0, 986.0, 1251.5, 1278.5,
81 // 1416.5, 1443.5, 1610, 1625., 1710., 1725.
82 // Internal Radius (in cm)
83 // 36.4, 46.2, 66.0, 80., 80., 100., 100.
84 // External Radius (in cm)
85 // 183., 245., 395., 560., 563., 850., 900.
86 //=======================================================================
87 if (!strcmp(option,"box")) {
88 AliGenBox * gener = new AliGenBox(1);
89 gener->SetMomentumRange(20.,20.1);
90 gener->SetPhiRange(0., 360.);
91 gener->SetThetaRange(171.000,178.001);
92 gener->SetPart(13); // Muons
93 gener->SetOrigin(0.,0., 0.); //vertex position
94 gener->SetSigma(0.0, 0.0, 0.0); //Sigma in (X,Y,Z) (cm) on IP position
95 }
96 if (!strcmp(option,"gun")) {
97 //*********************************************
98 // Example for Fixed Particle Gun *
99 //*********************************************
100 AliGenFixed *gener = new AliGenFixed(ntracks);
101 gener->SetMomentum(10);
102 gener->SetPhiRange(0.);
103 gener->SetThetaRange(0.);
104 gener->SetOrigin(30,30,1200);//vertex position
105 gener->SetPart(13); //GEANT particle type 13 is muons
106 }
107 if (!strcmp(option,"scan")) {
108 AliGenScan *gener = new AliGenScan(-1);
109 gener->SetMomentumRange(10,10);
110 gener->SetPhiRange(0, 0);
111 gener->SetThetaRange(-180, -180);
112 //vertex position
113 //gener->SetSigma(1,1,0); //Sigma in (X,Y,Z) (cm) on IP position
114 gener->SetPart(kRootino);
115 gener->SetRange(100, -300., 300., 100, -300., 300., 1, 2000, 2000);
116 }
117 if (!strcmp(option,"param")) {
118 //*******************************************************
119 // Example for J/psi or Upsilon Production from Parameterisation *
120 //*******************************************************
121 AliGenParam *gener = new AliGenParam(1, AliGenMUONlib::kUpsilon);
122 gener->SetMomentumRange(0,999);
123 gener->SetPtRange(0,100.);
124 gener->SetPhiRange(0., 360.);
125 gener->SetCutOnChild(1);
126 gener->SetChildPhiRange(0.,360.);
127 gener->SetChildThetaRange(171.0,178.0);
128 gener->SetOrigin(0,0,0); //vertex position gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
129 gener->SetForceDecay(kDiMuon);
130 gener->SetTrackingFlag(1);
131 gener->Init();
132 }
133 //=============================================================
134 // Field (L3 0.4 T)
135 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 1, 1., 10., AliMagFMaps::k4kG);
136 gAlice->SetField(field);
137
138 //=================== Alice BODY parameters =============================
139 AliBODY *BODY = new AliBODY("BODY","Alice envelop");
140 //=================== ABSO parameters ============================
141 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
142 //=================== DIPO parameters ============================
143 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
144 //================== HALL parameters ============================
145 AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
146 //=================== PIPE parameters ============================
147 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
148 //=================== SHIL parameters ============================
149 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
150 //=================== MUON Subsystem ===========================
151 cout << ">>> Config.C: Creating AliMUONv1 ..."<<endl;
a2da7817 152
8d6c1ae0 153 // New MUONv1 version (geometry defined via builders)
154 AliMUON *MUON = new AliMUONv1("MUON", "default");
b5fb1f3e 155 //AliMUON *MUON = new AliMUONv1("MUON", "FactoryV3"); // New segmentation slats
156 //AliMUON *MUON = new AliMUONv1("MUON", "FactoryV4"); // New segmentation trigger
6570c14d 157 // If align = true, the detection elements transformations
158 // are taken from the input files and not from the code
8d6c1ae0 159 //MUON->SetAlign(true);
8d6c1ae0 160 MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilderV2(MUON));
e768a44b 161 MUON->AddGeometryBuilder(new AliMUONSt2GeometryBuilderV2(MUON));
162 MUON->AddGeometryBuilder(new AliMUONSlatGeometryBuilder(MUON));
163 MUON->AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(MUON));
8d6c1ae0 164}
165
166Float_t EtaToTheta(Float_t arg){
167 return (180./TMath::Pi())*2.*atan(exp(-arg));
168}