AliPhysics  45fd833 (45fd833)
Simulate.C
Go to the documentation of this file.
1 
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 = 32; // 430;
52  Double_t zMax = 400; // 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 = 6;
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 
89 void Simulate(Int_t nev=1, UInt_t run=0)
90 {
91  // -----------------------------------------------------------------
92  //
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  //
98  gROOT->Macro(Form("GRP.C(%d)", run));
99  gROOT->Macro("BaseConfig.C");
100  gROOT->Macro("DetConfig.C");
101  gROOT->Macro("OCDBConfig.C");
102 
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 
108  // -----------------------------------------------------------------
109  //
110  // Basic setup
111  //
112  AliSimulation steer;
113  TString sDigits, fromHits;
114  detCfg->GetSDigitString(sDigits);
115  detCfg->GetHits2DigitsString(fromHits);
116  steer.SetMakeSDigits(sDigits);
117  steer.SetMakeDigitsFromHits(fromHits);
118 
119  // -----------------------------------------------------------------
120  //
121  // Vertex, Mag.field, and trigger from OCDB
122  //
123  steer.SetTriggerConfig(!isAA ? "p-p" : "Pb-Pb");//Replace with "ocdb"
124  steer.UseMagFieldFromGRP();
125  steer.UseVertexFromCDB();
126  if (detCfg->GeometrySource())
127  steer.SetGeometryFile(detCfg->GeometrySource());
128 
129  // -----------------------------------------------------------------
130  //
131  // OCDB and specific storages
132  //
133  AliCDBManager* cdb = AliCDBManager::Instance();
134  cdb->SetRun(grp->run);
135  cdb->SetDefaultStorageFromRun(grp->run);
136  cdb->SetRun(-1);
137  ocdbCfg->Init(true);
138  steer.SetRunNumber(grp->run);
139 
140  // -----------------------------------------------------------------
141  //
142  // The rest - disable QA and HLT (memory heavy) for PbPb
143  //
144  if (isAA) steer.SetRunQA(":");
145  if (is10h) steer.SetRunHLT("");
146 
147  TStopwatch timer;
148  timer.Start();
149  // Check first if we're doing a Lego run, and if not,
150  // do a normal run
151  if (!RunLego(steer)) steer.Run(nev);
152  timer.Stop();
153  timer.Print();
154 }
155 //
156 // EOF
157 //
UInt_t run
Definition: GRP.C:102
virtual const char * GeometrySource() const
Definition: BaseConfig.C:133
double Double_t
Definition: External.C:58
TSystem * gSystem
TCanvas * c
Definition: TestFitELoss.C:172
virtual void Init(Bool_t forSim)
Definition: BaseConfig.C:158
Bool_t RunLego(AliSimulation &steer)
Definition: Simulate.C:8
Bool_t IsAA() const
Definition: GRP.C:159
VirtualOCDBCfg * ocdbCfg
Definition: BaseConfig.C:181
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
void GetHits2DigitsString(TString &fromHits) const
Definition: BaseConfig.C:109
TString period
Definition: GRP.C:101
GRPData * grp
Definition: GRP.C:361
Bool_t IsPP() const
Definition: GRP.C:141
void Simulate(Int_t nev=1, UInt_t run=0)
Definition: Simulate.C:89
VirtualDetCfg * detCfg
Definition: BaseConfig.C:139
bool Bool_t
Definition: External.C:53
void GetSDigitString(TString &sDigits) const
Definition: BaseConfig.C:89