3 * @author Christian Holm Christensen <cholm@nbi.dk>
4 * @date Wed Oct 15 13:28:09 2014
6 * @brief Steering script for the simulation
8 Bool_t RunLego(AliSimulation& steer)
10 TString runType = gSystem->Getenv("CONFIG_RUN_TYPE");
12 if (!runType.BeginsWith("LEGO")) return false;
16 v.ReplaceAll("LEGO", "");
17 Info("Setup", "Making Lego event generator (variant: %s)", v.Data());
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);
24 else if (v.BeginsWith("PHIZ")) {
25 gener = new AliLegoGeneratorPhiZ();
27 else if (v.BeginsWith("ETA")) {
28 gener = new AliLegoGeneratorEta();
31 gener = new AliLegoGenerator();
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
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
47 // o=(0,0,0) p=(cos(phi)*sin(theta),sin(phi)*cos(theta),cos(theta))
48 const char* cfg = "Config.C";
51 Double_t rMax = 32; // 430;
52 Double_t zMax = 400; // 10000;
53 if (v.BeginsWith("X") || v.BeginsWith("Y"))
54 ret = steer.RunLego(cfg,
57 rMin, rMax, zMax, gener);
58 else if (v.BeginsWith("Z"))
59 ret = steer.RunLego(cfg,
62 rMin, rMax, zMax, gener);
63 else if (v.BeginsWith("PHIZ"))
64 ret = steer.RunLego(cfg,
67 rMin, rMax, zMax, gener);
68 else if (v.BeginsWith("ETA")) {
70 Double_t dEta = (6.--4.)/200;
71 ret = steer.RunLego(cfg,
73 2*aEta/dEta,-aEta,+aEta, // Eta
74 rMin, rMax, zMax, gener);
77 ret = steer.RunLego(cfg);
79 Warning("RunLego", "Failed to do lego run");
86 * @param nev Number of events per job
87 * @param run Run number to simulate
89 void Simulate(Int_t nev=1, UInt_t run=0)
91 // -----------------------------------------------------------------
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"
98 gROOT->Macro(Form("GRP.C(%d)", run));
99 gROOT->Macro("BaseConfig.C");
100 gROOT->Macro("DetConfig.C");
101 gROOT->Macro("OCDBConfig.C");
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");
108 // -----------------------------------------------------------------
113 TString sDigits, fromHits;
114 detCfg->GetSDigitString(sDigits);
115 detCfg->GetHits2DigitsString(fromHits);
116 steer.SetMakeSDigits(sDigits);
117 steer.SetMakeDigitsFromHits(fromHits);
119 // -----------------------------------------------------------------
121 // Vertex, Mag.field, and trigger from OCDB
123 steer.SetTriggerConfig(!isAA ? "p-p" : "Pb-Pb");//Replace with "ocdb"
124 steer.UseMagFieldFromGRP();
125 steer.UseVertexFromCDB();
127 // -----------------------------------------------------------------
129 // OCDB and specific storages
131 AliCDBManager* cdb = AliCDBManager::Instance();
132 cdb->SetRun(grp->run);
133 cdb->SetDefaultStorageFromRun(grp->run);
136 steer.SetRunNumber(grp->run);
138 // -----------------------------------------------------------------
140 // The rest - disable QA and HLT (memory heavy) for PbPb
142 if (isAA) steer.SetRunQA(":");
143 if (is10h) steer.SetRunHLT("");
147 // Check first if we're doing a Lego run, and if not,
149 if (!RunLego(steer)) steer.Run(nev);