]>
Commit | Line | Data |
---|---|---|
421f877c | 1 | /** |
2 | * @file Simulate.C | |
3 | * @author Christian Holm Christensen <cholm@nbi.dk> | |
4 | * @date Wed Oct 15 13:28:09 2014 | |
5 | * | |
6 | * @brief Steering script for the simulation | |
7 | */ | |
15cb4a2b | 8 | Bool_t RunLego(AliSimulation& steer) |
9 | { | |
10 | TString runType = gSystem->Getenv("CONFIG_RUN_TYPE"); | |
11 | runType.ToUpper(); | |
12 | if (!runType.BeginsWith("LEGO")) return false; | |
13 | ||
14 | TString v(runType); | |
15 | v.ToUpper(); | |
16 | v.ReplaceAll("LEGO", ""); | |
17 | Info("Setup", "Making Lego event generator (variant: %s)", v.Data()); | |
18 | ||
19 | AliLegoGenerator* gener = 0; | |
20 | if (v.BeginsWith("X") || v.BeginsWith("Y") || v.BeginsWith("Z")) { | |
21 | const char* c[] = { v(0), '\0' }; | |
22 | gener = new AliLegoGeneratorXYZ(c); | |
23 | } | |
24 | else if (v.BeginsWith("PHIZ")) { | |
25 | gener = new AliLegoGeneratorPhiZ(); | |
26 | } | |
27 | else if (v.BeginsWith("ETA")) { | |
28 | gener = new AliLegoGeneratorEta(); | |
29 | } | |
30 | else { | |
31 | gener = new AliLegoGenerator(); | |
32 | } | |
33 | ||
34 | // XYZ varies origin of the particles in two dimensions: | |
35 | // X: o=(0,t1,t2), p=(1,0,0) | |
36 | // Y: o=(t1,0,t2), p=(0,1,0) | |
37 | // Z: o=(t1,t2,0), p=(0,0,1) | |
38 | // PhiZ varies the momentum in two dimensions | |
39 | // o=(0,0,t1) p=(cos(t2),sin(t2),0) | |
40 | // Eta varies momentum in two dimensions | |
41 | // phi=t1 | |
42 | // theta=2*atan(exp(-t2)) | |
43 | // o=(0,0,0) p=(cos(phi)*sin(theta),sin(phi)*cos(theta),cos(theta)) | |
44 | // Base varies in two dimensions | |
45 | // phi=t1 | |
46 | // theta=t2 | |
47 | // o=(0,0,0) p=(cos(phi)*sin(theta),sin(phi)*cos(theta),cos(theta)) | |
48 | const char* cfg = "Config.C"; | |
49 | Bool_t ret = false; | |
50 | Double_t rMin = 0; | |
51 | Double_t rMax = 430; | |
52 | Double_t zMax = 10000; | |
53 | if (v.BeginsWith("X") || v.BeginsWith("Y")) | |
54 | ret = steer.RunLego(cfg, | |
55 | 10,-2,2, // Y, X | |
56 | 10,-10,10, // Z | |
57 | rMin, rMax, zMax, gener); | |
58 | else if (v.BeginsWith("Z")) | |
59 | ret = steer.RunLego(cfg, | |
60 | 10,-2,2, // X | |
61 | 10,-2,2, // Y | |
62 | rMin, rMax, zMax, gener); | |
63 | else if (v.BeginsWith("PHIZ")) | |
64 | ret = steer.RunLego(cfg, | |
65 | 10,-10,10, // Z | |
66 | 360,0,360, // phi | |
67 | rMin, rMax, zMax, gener); | |
68 | else if (v.BeginsWith("ETA")) { | |
69 | Double_t aEta = 7; | |
70 | Double_t dEta = (6--4)/200; | |
71 | ret = steer.RunLego(cfg, | |
72 | 360,0,360, // phi | |
73 | 2*aEta/dEta,-aEta,+aEta, // Eta | |
74 | rMin, rMax, zMax, gener); | |
75 | } | |
76 | else | |
77 | ret = steer.RunLego(cfg); | |
78 | if (!ret) | |
79 | Warning("RunLego", "Failed to do lego run"); | |
80 | return true; | |
81 | } | |
82 | ||
a0bdf9a4 | 83 | /** |
84 | * Run the simulation | |
85 | * | |
86 | * @param nev Number of events per job | |
87 | * @param run Run number to simulate | |
88 | */ | |
f8b7a926 | 89 | void Simulate(Int_t nev=1, UInt_t run=0) |
90 | { | |
91 | // ----------------------------------------------------------------- | |
92 | // | |
421f877c | 93 | // - Get GRP parameters. Defines global "grp" as a pointer to GRPData |
94 | // - Load base class definitions in BaseConfig.C | |
95 | // - Get which detectors are turned on in "detCfg". | |
96 | // - Create the OCDB configuration object "ocdbCfg" | |
97 | // | |
f8b7a926 | 98 | gROOT->Macro(Form("GRP.C(%d)", run)); |
421f877c | 99 | gROOT->Macro("BaseConfig.C"); |
100 | gROOT->Macro("DetConfig.C"); | |
101 | gROOT->Macro("OCDBConfig.C"); | |
f8b7a926 | 102 | |
a0bdf9a4 | 103 | // --- Get GRP to deduce collision system -------------------------- |
104 | Bool_t isAA = grp->IsAA(); | |
105 | Bool_t isPP = grp->IsPP(); | |
106 | Bool_t is10h = grp->period.EqualTo("LHC10h"); | |
107 | ||
f8b7a926 | 108 | // ----------------------------------------------------------------- |
109 | // | |
110 | // Basic setup | |
111 | // | |
112 | AliSimulation steer; | |
ee275c29 | 113 | TString sDigits, fromHits; |
114 | detCfg->GetSDigitString(sDigits); | |
115 | detCfg->GetHits2DigitsString(fromHits); | |
116 | steer.SetMakeSDigits(sDigits); | |
117 | steer.SetMakeDigitsFromHits(fromHits); | |
a0bdf9a4 | 118 | |
119 | // ----------------------------------------------------------------- | |
120 | // | |
121 | // Vertex, Mag.field, and trigger from OCDB | |
122 | // | |
123 | steer.SetTriggerConfig(!isAA ? "p-p" : "Pb-Pb");//Replace with "ocdb" | |
f8b7a926 | 124 | steer.UseMagFieldFromGRP(); |
125 | steer.UseVertexFromCDB(); | |
126 | ||
127 | // ----------------------------------------------------------------- | |
128 | // | |
ee275c29 | 129 | // OCDB and specific storages |
f8b7a926 | 130 | // |
131 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
132 | cdb->SetDefaultStorageFromRun(grp->run); | |
ee275c29 | 133 | ocdbCfg->Init(true); |
f8b7a926 | 134 | |
135 | // ----------------------------------------------------------------- | |
136 | // | |
ee275c29 | 137 | // The rest - disable QA and HLT (memory heavy) for PbPb |
f8b7a926 | 138 | // |
139 | if (isAA) steer.SetRunQA(":"); | |
ee275c29 | 140 | if (is10h) steer.SetRunHLT(""); |
141 | ||
f8b7a926 | 142 | TStopwatch timer; |
143 | timer.Start(); | |
15cb4a2b | 144 | // Check first if we're doing a Lego run, and if not, |
145 | // do a normal run | |
146 | if (!RunLego(steer)) steer.Run(nev); | |
f8b7a926 | 147 | timer.Stop(); |
148 | timer.Print(); | |
149 | } | |
a0bdf9a4 | 150 | // |
151 | // EOF | |
152 | // |