FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndMasterRunSim Class Reference

Class for the master simulation chain. More...

#include <PndMasterRunSim.h>

Inheritance diagram for PndMasterRunSim:

Public Member Functions

 PndMasterRunSim ()
 Default constructor. More...
 
virtual ~PndMasterRunSim ()
 Default destructor. More...
 
Bool_t Setup (TString outprefix="")
 Initial setup. More...
 
void Finish ()
 Final diagnostics. More...
 
void CreateGeometry ()
 It switches between different standard geometry volumes. More...
 
void CreateGeometryDefault ()
 It creates all the standard geometry volumes. More...
 
void CreateGeometryPhase1 ()
 It creates the standard geometry volumes for phase1 of the experiment. More...
 
void CreateGeometryDay1 ()
 It creates the standard geometry volumes for day1 phase. More...
 
void AddSimTasks ()
 Add simulation tasks. More...
 
void SetGenerator ()
 Set the event generator. More...
 
void AddGenerator (FairGenerator *aGen)
 Add a generator to existing setup. More...
 
void SetGenerator (FairGenerator *boxGen)
 Set the event generator for FairBoxGenerator. More...
 
void SetGenerator (PndBoxGenerator *boxGen)
 Set the event generator for PndBoxGenerator. More...
 
void SetDpmFlag (Int_t Mode)
 Set the DPM flag. More...
 
void SetFtfFlag (Int_t Mode)
 Set the FTF noelastic flag. More...
 
void UseDpmGenerator ()
 Use DPM as event generator. More...
 
void UseFtfGenerator (TString ftfData)
 Use FTF as event generator. More...
 
void UseEvtGenGenerator (TString EvtGenFile)
 Use EvtGen as event generator. More...
 
void UseBoxGenerator (TString BoxConfig)
 Use BoxGen as event generator. More...
 
void UsePiPiGenerator (TString pipiConfig)
 Use PiPiGenerator as event generator. More...
 
void UseLepLepGenerator (TString leplepConfig)
 Use LepLepGenerator as event generator. More...
 
void SetInput (TString par)
 Input of the simulation This string can be: a) the name of the dec file for EvtGen, ending w/ .dec b) "dpm" if you want to use dpm c) "ftf" if you want to use ftf d) "box:[...]" if you want to use box. More...
 
void SetInputDir (TString par)
 Input directory of the simulation. More...
 
void SetParamRootFile (TString par)
 Setter of the parameter root file. More...
 
void SetParamAsciiFile (TString par)
 Setter of the parameter ascii file. More...
 
void SetOptions (TString par)
 Setter of the simulation options This string can be: "" -> default settings full setup "day1" -> Setup for day1 experiment: no GEM, FTS1234, NO DISC, NO RICH "gem2" (added to "day1") -> Setup for day1 experiment with 2 GEM planes (first two) "gem3" (added to "day1") -> Setup for day1 experiment with 3 GEM planes "fts1256" (added to "day1") -> Setup for day1 experiment with FTS1256 insted of FTS1234 "strip" (added to "day1") -> Setup for day1 experiment with only the strip part of the MVD instead of the full MVD Example: "day1+gem+fts1256" means day1 setup + GEM planes + fst1256. More...
 
TString GetOptions ()
 
void SetNumberOfEvents (Int_t par)
 Setter of the number of events. More...
 
void SetEventCounterRate (Int_t par)
 Setter of the event counter rate. More...
 
void SetTargetMode (Short_t par)
 Setter of the target mode. More...
 
FairFilteredPrimaryGeneratorGetFilteredPrimaryGenerator ()
 Getter for the primary generator, e.g. to configure the event filter. More...
 
PndFilteredPrimaryGeneratorGetPndFilteredPrimaryGenerator ()
 

Private Member Functions

void GetRange (TString par, double &min, double &max)
 

Private Attributes

TString fInput
 Name of the input for the simulation. More...
 
TString fInputDir
 Name of the input directory for the simulation. More...
 
TString fOutFile
 Name of the output file. More...
 
TString fParamRootFile
 Name of the parameter root file. More...
 
TString fParamAsciiFile
 Name of the parameter ascii file. More...
 
TString fOptions
 Options parsed to the simulation. More...
 
Int_t fDpmFlag
 Flag for DPM event generator. More...
 
Int_t fFtfFlag
 Flag for FTF event generator. More...
 
Int_t fNEvents
 Number of events. More...
 
Int_t fEventCounterRate
 After how many events the counter will print. More...
 
Short_t fTargetMode
 Target mode. More...
 
FairRuntimeDb * fRtdb
 Runtime DB. More...
 
TStopwatch fTimer
 Timer. More...
 

Detailed Description

Class for the master simulation chain.

Master Simulation Class

This class is the basic for the simulation macro. It loads the environment and all the standard detectors.

Author
Stefano Spataro spata.nosp@m.ro@t.nosp@m.o.inf.nosp@m.n.it, Torino University
Version
1.0
Date
Feb 3, 2016

Definition at line 31 of file PndMasterRunSim.h.

Constructor & Destructor Documentation

PndMasterRunSim::PndMasterRunSim ( )

Default constructor.

Definition at line 54 of file PndMasterRunSim.cxx.

References fTimer.

54  :
56 {
57  fTimer.Start();
58 }
TString fInput
Name of the input for the simulation.
Int_t fFtfFlag
Flag for FTF event generator.
Int_t fNEvents
Number of events.
Short_t fTargetMode
Target mode.
TString fOptions
Options parsed to the simulation.
Int_t fEventCounterRate
After how many events the counter will print.
TString fParamRootFile
Name of the parameter root file.
FairRuntimeDb * fRtdb
Runtime DB.
TString fOutFile
Name of the output file.
TStopwatch fTimer
Timer.
TString fInputDir
Name of the input directory for the simulation.
TString fParamAsciiFile
Name of the parameter ascii file.
Int_t fDpmFlag
Flag for DPM event generator.
PndMasterRunSim::~PndMasterRunSim ( )
virtual

Default destructor.

Definition at line 60 of file PndMasterRunSim.cxx.

References gGeoManager.

61 {
62  if (gROOT->GetVersionInt() >= 60602 && gGeoManager!=NULL) {
63  gGeoManager->GetListOfVolumes()->Delete();
64  gGeoManager->GetListOfShapes()->Delete();
65  delete gGeoManager;
66  }
67 }
TGeoManager * gGeoManager

Member Function Documentation

void PndMasterRunSim::AddGenerator ( FairGenerator *  aGen)

Add a generator to existing setup.

Adds a generator to the existing one. BOTH generators will be active

and produce their particle content in each even simultaneously.

void PndMasterRunSim::AddSimTasks ( )

Add simulation tasks.

Add Master simulation tasks

It adds all the standard simulation tasks

Definition at line 379 of file PndMasterRunSim.cxx.

References AddTask(), fEventCounterRate, fNEvents, fOptions, and sim().

Referenced by prod_sim(), sim_box(), sim_complete(), sim_complete_newSTT(), sim_day1(), sim_radlength_complete(), and tut_sim().

380 {
381  // ----- Event Counter --------------------------------
382  AddTask(new PndEventCounterTask("Event Counter", fNEvents, fEventCounterRate));
383 
385  AddTask(sim);
386 
387  return;
388 }
sim(Int_t nEvents=1, TString SimEngine="TGeant4", Float_t mom=6.231552)
Int_t fNEvents
Number of events.
The default sim tasks.
TString fOptions
Options parsed to the simulation.
Int_t fEventCounterRate
After how many events the counter will print.
fRun AddTask(drcdigi)
void PndMasterRunSim::CreateGeometry ( )

It switches between different standard geometry volumes.

Master Geometry List

According to fOptions, it creates the standard geometry volumes for the full setup, or dedicated geometries (such as day1)

Definition at line 125 of file PndMasterRunSim.cxx.

References CreateGeometryDay1(), CreateGeometryDefault(), CreateGeometryPhase1(), and fOptions.

Referenced by prod_sim(), sim_box(), sim_complete(), sim_day1(), and tut_sim().

126 {
127  if (fOptions.Contains("phase1")) CreateGeometryPhase1();
128  else if (fOptions.Contains("day1")) CreateGeometryDay1();
129  else CreateGeometryDefault();
130 }
void CreateGeometryDefault()
It creates all the standard geometry volumes.
TString fOptions
Options parsed to the simulation.
void CreateGeometryDay1()
It creates the standard geometry volumes for day1 phase.
void CreateGeometryPhase1()
It creates the standard geometry volumes for phase1 of the experiment.
void PndMasterRunSim::CreateGeometryDay1 ( )

It creates the standard geometry volumes for day1 phase.

Master Geometry List

It creates all the standard geometry volumes which have to be used in simulation, with the setup for day1 experiments. All the MCPoint will be stored, except for EMC

Definition at line 283 of file PndMasterRunSim.cxx.

References AddModule(), Cave, Dipole, Drc, Emc, fOptions, FTof, Fts, Gem, Muo, Mvd, Pipe, PndMdt::SetBarrel(), PndMdt::SetEndcap(), PndMdt::SetForward(), PndEmc::SetGeometryVersion(), PndMdt::SetMdtCoil(), PndMdt::SetMdtMagnet(), PndMdt::SetMdtMFIron(), PndMdt::SetMuonFilter(), PndDrc::SetRunCherenkov(), PndEmc::SetStorageOfData(), and Stt.

Referenced by CreateGeometry().

284 {
285  //------------------------- CAVE -----------------
286  FairModule *Cave= new PndCave("CAVE");
287  Cave->SetGeometryFileName("pndcave.geo");
288  AddModule(Cave);
289  //------------------------- Magnet -----------------
290  // This part is commented because the MDT geometry contains the magnet now
291  //FairModule *Magnet= new PndMagnet("MAGNET");
292  //Magnet->SetGeometryFileName("FullSolenoid_V842.root");
293  //Magnet->SetGeometryFileName("FullSuperconductingSolenoid_v831.root");
294  //AddModule(Magnet);
295  FairModule *Dipole= new PndMagnet("MAGNET");
296  Dipole->SetGeometryFileName("dipole.geo");
297  AddModule(Dipole);
298  //------------------------- Pipe -----------------
299  FairModule *Pipe= new PndPipe("PIPE");
300  Pipe->SetGeometryFileName("beampipe_201309.root");
301  AddModule(Pipe);
302  //------------------------- STT -----------------
303  FairDetector *Stt= new PndStt("STT", kTRUE);
304  Stt->SetGeometryFileName("straws_skewed_blocks_35cm_pipe.geo");
305  AddModule(Stt);
306  //------------------------- MVD -----------------
307  if (fOptions.Contains("strip")||fOptions.Contains("nopixels")){
308  FairDetector *Mvd = new PndMvdDetector("MVD", kTRUE);
309  Mvd->SetGeometryFileName("Mvd-2.1-Strips.root");
310  AddModule(Mvd);
311  } else {
312  FairDetector *Mvd = new PndMvdDetector("MVD", kTRUE);
313  Mvd->SetGeometryFileName("Mvd-2.1_FullVersion.root");
314  AddModule(Mvd);
315  }
316  //------------------------- EMC -----------------
317  PndEmc *Emc = new PndEmc("EMC",kTRUE);
318  Emc->SetGeometryVersion(1);
319  Emc->SetStorageOfData(kFALSE);
320  AddModule(Emc);
321  //------------------------- SCITIL -----------------
322  FairDetector *SciT = new PndSciT("SCIT",kTRUE);
323  SciT->SetGeometryFileName("SciTil_201601.root");
324  AddModule(SciT);
325  //------------------------- DRC -----------------
326  PndDrc *Drc = new PndDrc("DIRC", kTRUE);
327  Drc->SetGeometryFileName("dirc_e3_b3_l6_m40.root");
328  Drc->SetRunCherenkov(kFALSE);
329  AddModule(Drc);
330  //------------------------- MDT -----------------
331  PndMdt *Muo = new PndMdt("MDT",kTRUE);
332  Muo->SetBarrel("fast");
333  Muo->SetEndcap("fast");
334  Muo->SetMuonFilter("fast");
335  Muo->SetForward("fast");
336  Muo->SetMdtMagnet(kTRUE);
337  Muo->SetMdtCoil(kTRUE);
338  Muo->SetMdtMFIron(kTRUE);
339  AddModule(Muo);
340  //------------------------- FTOF -----------------
341  FairDetector *FTof = new PndFtof("FTOF",kTRUE);
342  FTof->SetGeometryFileName("ftofwall.root");
343  AddModule(FTof);
344 
345  if (fOptions.Contains("nogem")||fOptions.Contains("gem0")) {
346  // do nothing
347  }
348  else if (fOptions.Contains("gem3")) // GEM 3 Stations
349  {
350  FairDetector *Gem = new PndGemDetector("GEM", kTRUE);
351  Gem->SetGeometryFileName("gem_3Stations_realistic_v2.root");
352  AddModule(Gem);
353  }
354  else //GEM 2 Stations
355  {
356  //------------------------- GEM -----------------
357  FairDetector *Gem = new PndGemDetector("GEM", kTRUE);
358  Gem->SetGeometryFileName("gem_2Stations_realistic_v2.root");
359  AddModule(Gem);
360  }
361 
362  if (fOptions.Contains("fts1256"))
363  {
364  //------------------------- FTS -----------------
365  FairDetector *Fts= new PndFts("FTS", kTRUE);
366  Fts->SetGeometryFileName("fts_1256.geo");
367  AddModule(Fts);
368  }
369  else
370  {
371  //------------------------- FTS -----------------
372  FairDetector *Fts= new PndFts("FTS", kTRUE);
373  Fts->SetGeometryFileName("fts_reduced.geo");
374  AddModule(Fts);
375  }
376 }
PndDrc * Drc
Definition: sim_emc_apd.C:75
void SetForward(TString name)
Definition: PndMdt.h:34
FairDetector * FTof
Definition: sim_ftof.C:49
PndEmc * Emc
Definition: sim_emc_apd.C:55
void SetMdtCoil(bool opt=false)
Definition: PndMdt.h:28
FairDetector * Mvd
Definition: sim_emc_apd.C:51
void SetMdtMFIron(bool opt=false)
Definition: PndMdt.h:29
void SetStorageOfData(Bool_t val)
Definition: PndEmc.cxx:941
PndMdt * Muo
Definition: sim_emc_apd.C:67
Simulation of EMC.
Definition: PndEmc.h:26
TString fOptions
Options parsed to the simulation.
FairDetector * Gem
Definition: runJohan.C:71
void SetMdtMagnet(bool opt=false)
Definition: PndMdt.h:27
FairDetector * Stt
Definition: sim_emc_apd.C:47
FairModule * Dipole
Definition: sim_emc_apd.C:40
FairModule * Cave
Definition: sim_emc_apd.C:32
Definition: PndDrc.h:31
virtual void SetGeometryVersion(const Int_t GeoNumber)
Definition: PndEmc.cxx:966
void SetBarrel(TString name)
Definition: PndMdt.h:31
fRun AddModule(Cave)
void SetEndcap(TString name)
Definition: PndMdt.h:32
void SetMuonFilter(TString name)
Definition: PndMdt.h:33
void SetRunCherenkov(Bool_t ch)
Definition: PndDrc.h:222
Definition: PndStt.h:34
Definition: PndMdt.h:20
FairModule * Pipe
Definition: sim_emc_apd.C:44
FairDetector * Fts
Definition: sim_ftof_stof.C:58
Definition: PndFts.h:25
Definition: PndCave.h:8
void PndMasterRunSim::CreateGeometryDefault ( )

It creates all the standard geometry volumes.

Master Geometry List

It creates all the standard geometry volumes which have to be used in simulation. All the MCPoint will be stored, expect for EMC.

Definition at line 133 of file PndMasterRunSim.cxx.

References AddModule(), Cave, Dipole, Drc, Dsk, Emc, FTof, Fts, Gem, Muo, Mvd, Pipe, PndMdt::SetBarrel(), PndMdt::SetEndcap(), PndMdt::SetForward(), PndEmc::SetGeometryVersion(), PndMdt::SetMdtCoil(), PndMdt::SetMdtMagnet(), PndMdt::SetMdtMFIron(), PndMdt::SetMuonFilter(), PndDrc::SetRunCherenkov(), PndEmc::SetStorageOfData(), PndDsk::SetStoreCerenkovs(), PndDsk::SetStoreTrackPoints(), and Stt.

Referenced by CreateGeometry().

134 {
135  //------------------------- CAVE -----------------
136  FairModule *Cave= new PndCave("CAVE");
137  Cave->SetGeometryFileName("pndcave.geo");
138  AddModule(Cave);
139  //------------------------- Magnet -----------------
140  // This part is commented because the MDT geometry contains the magnet now
141  //FairModule *Magnet= new PndMagnet("MAGNET");
142  //Magnet->SetGeometryFileName("FullSolenoid_V842.root");
143  //Magnet->SetGeometryFileName("FullSuperconductingSolenoid_v831.root");
144  //AddModule(Magnet);
145  FairModule *Dipole= new PndMagnet("MAGNET");
146  Dipole->SetGeometryFileName("dipole.geo");
147  AddModule(Dipole);
148  //------------------------- Pipe -----------------
149  FairModule *Pipe= new PndPipe("PIPE");
150  Pipe->SetGeometryFileName("beampipe_201309.root");
151  AddModule(Pipe);
152  //------------------------- STT -----------------
153  FairDetector *Stt= new PndStt("STT", kTRUE);
154  Stt->SetGeometryFileName("straws_skewed_blocks_35cm_pipe.geo");
155  AddModule(Stt);
156  //------------------------- MVD -----------------
157  FairDetector *Mvd = new PndMvdDetector("MVD", kTRUE);
158  Mvd->SetGeometryFileName("Mvd-2.1_FullVersion.root");
159  AddModule(Mvd);
160  //------------------------- GEM -----------------
161  FairDetector *Gem = new PndGemDetector("GEM", kTRUE);
162  Gem->SetGeometryFileName("gem_3Stations_realistic_v2.root");
163  AddModule(Gem);
164  //------------------------- EMC -----------------
165  PndEmc *Emc = new PndEmc("EMC",kTRUE);
166  Emc->SetGeometryVersion(1);
167  Emc->SetStorageOfData(kFALSE);
168  AddModule(Emc);
169  //------------------------- SCITIL -----------------
170  FairDetector *SciT = new PndSciT("SCIT",kTRUE);
171  SciT->SetGeometryFileName("SciTil_201601.root");
172  AddModule(SciT);
173  //------------------------- DRC -----------------
174  PndDrc *Drc = new PndDrc("DIRC", kTRUE);
175  Drc->SetGeometryFileName("dirc_e3_b3_l6_m40.root");
176  Drc->SetRunCherenkov(kFALSE);
177  AddModule(Drc);
178  //------------------------- DISC -----------------
179  PndDsk* Dsk = new PndDsk("DSK", kTRUE);
180  Dsk->SetStoreCerenkovs(kFALSE);
181  Dsk->SetStoreTrackPoints(kFALSE);
182  AddModule(Dsk);
183  //------------------------- MDT -----------------
184  PndMdt *Muo = new PndMdt("MDT",kTRUE);
185  Muo->SetBarrel("fast");
186  Muo->SetEndcap("fast");
187  Muo->SetMuonFilter("fast");
188  Muo->SetForward("fast");
189  Muo->SetMdtMagnet(kTRUE);
190  Muo->SetMdtCoil(kTRUE);
191  Muo->SetMdtMFIron(kTRUE);
192  AddModule(Muo);
193  //------------------------- FTS -----------------
194  FairDetector *Fts= new PndFts("FTS", kTRUE);
195  Fts->SetGeometryFileName("fts.geo");
196  AddModule(Fts);
197  //------------------------- FTOF -----------------
198  FairDetector *FTof = new PndFtof("FTOF",kTRUE);
199  FTof->SetGeometryFileName("ftofwall.root");
200  AddModule(FTof);
201  //------------------------- RICH ----------------
202  PndRich *Rich= new PndRich("RICH",kTRUE);
203  Rich->SetGeometryFileName("rich_v313.root");
204  AddModule(Rich);
205 }
PndDrc * Drc
Definition: sim_emc_apd.C:75
void SetForward(TString name)
Definition: PndMdt.h:34
FairDetector * FTof
Definition: sim_ftof.C:49
PndEmc * Emc
Definition: sim_emc_apd.C:55
void SetMdtCoil(bool opt=false)
Definition: PndMdt.h:28
FairDetector * Mvd
Definition: sim_emc_apd.C:51
void SetMdtMFIron(bool opt=false)
Definition: PndMdt.h:29
void SetStorageOfData(Bool_t val)
Definition: PndEmc.cxx:941
PndMdt * Muo
Definition: sim_emc_apd.C:67
Simulation of EMC.
Definition: PndEmc.h:26
FairDetector * Dsk
Definition: run_DpmSim.C:66
FairDetector * Gem
Definition: runJohan.C:71
void SetMdtMagnet(bool opt=false)
Definition: PndMdt.h:27
void SetStoreTrackPoints(Bool_t storeTrackPoints)
Definition: PndDsk.h:148
FairDetector * Stt
Definition: sim_emc_apd.C:47
void SetStoreCerenkovs(Bool_t storeCerenkovs)
Definition: PndDsk.h:146
FairModule * Dipole
Definition: sim_emc_apd.C:40
FairModule * Cave
Definition: sim_emc_apd.C:32
Definition: PndDrc.h:31
virtual void SetGeometryVersion(const Int_t GeoNumber)
Definition: PndEmc.cxx:966
void SetBarrel(TString name)
Definition: PndMdt.h:31
fRun AddModule(Cave)
void SetEndcap(TString name)
Definition: PndMdt.h:32
void SetMuonFilter(TString name)
Definition: PndMdt.h:33
void SetRunCherenkov(Bool_t ch)
Definition: PndDrc.h:222
Definition: PndStt.h:34
Definition: PndMdt.h:20
FairModule * Pipe
Definition: sim_emc_apd.C:44
FairDetector * Fts
Definition: sim_ftof_stof.C:58
Definition: PndDsk.h:23
Definition: PndFts.h:25
Definition: PndCave.h:8
void PndMasterRunSim::CreateGeometryPhase1 ( )

It creates the standard geometry volumes for phase1 of the experiment.

Master Geometry List

It creates all the standard geometry volumes which have to be used in simulation, with the setup for phase1 experiments. All the MCPoint will be stored, except for EMC

Definition at line 208 of file PndMasterRunSim.cxx.

References AddModule(), Cave, Dipole, Drc, Emc, FTof, Fts, Gem, Muo, Mvd, Pipe, PndMdt::SetBarrel(), PndMdt::SetEndcap(), PndMdt::SetForward(), PndEmc::SetGeometryVersion(), PndMdt::SetMdtCoil(), PndMdt::SetMdtMagnet(), PndMdt::SetMdtMFIron(), PndMdt::SetMuonFilter(), PndDrc::SetRunCherenkov(), PndEmc::SetStorageOfData(), and Stt.

Referenced by CreateGeometry().

209 {
210  //------------------------- CAVE -----------------
211  FairModule *Cave= new PndCave("CAVE");
212  Cave->SetGeometryFileName("pndcave.geo");
213  AddModule(Cave);
214  //------------------------- Magnet -----------------
215  // This part is commented because the MDT geometry contains the magnet now
216  //FairModule *Magnet= new PndMagnet("MAGNET");
217  //Magnet->SetGeometryFileName("FullSolenoid_V842.root");
218  //Magnet->SetGeometryFileName("FullSuperconductingSolenoid_v831.root");
219  //AddModule(Magnet);
220  FairModule *Dipole= new PndMagnet("MAGNET");
221  Dipole->SetGeometryFileName("dipole.geo");
222  AddModule(Dipole);
223  //------------------------- Pipe -----------------
224  FairModule *Pipe= new PndPipe("PIPE");
225  Pipe->SetGeometryFileName("beampipe_201309.root");
226  AddModule(Pipe);
227  //------------------------- STT -----------------
228  FairDetector *Stt= new PndStt("STT", kTRUE);
229  Stt->SetGeometryFileName("straws_skewed_blocks_35cm_pipe.geo");
230  AddModule(Stt);
231  //------------------------- MVD -----------------
232  FairDetector *Mvd = new PndMvdDetector("MVD", kTRUE);
233  Mvd->SetGeometryFileName("Mvd-2.1_FullVersion.root");
234  AddModule(Mvd);
235  //------------------------- GEM -----------------
236  FairDetector *Gem = new PndGemDetector("GEM", kTRUE);
237  Gem->SetGeometryFileName("gem_3Stations_realistic_v2.root");
238  AddModule(Gem);
239  //------------------------- EMC -----------------
240  PndEmc *Emc = new PndEmc("EMC",kTRUE);
241  Emc->SetGeometryVersion(1);
242  Emc->SetStorageOfData(kFALSE);
243  AddModule(Emc);
244  //------------------------- SCITIL -----------------
245  FairDetector *SciT = new PndSciT("SCIT",kTRUE);
246  SciT->SetGeometryFileName("SciTil_201601.root");
247  AddModule(SciT);
248  //------------------------- DRC -----------------
249  PndDrc *Drc = new PndDrc("DIRC", kTRUE);
250  Drc->SetGeometryFileName("dirc_e3_b3_l6_m40.root");
251  Drc->SetRunCherenkov(kFALSE);
252  AddModule(Drc);
253  //------------------------- DISC -----------------
254  //PndDsk* Dsk = new PndDsk("DSK", kTRUE);
255  //Dsk->SetStoreCerenkovs(kFALSE);
256  //Dsk->SetStoreTrackPoints(kFALSE);
257  //AddModule(Dsk);
258  //------------------------- MDT -----------------
259  PndMdt *Muo = new PndMdt("MDT",kTRUE);
260  Muo->SetBarrel("fast");
261  Muo->SetEndcap("fast");
262  Muo->SetMuonFilter("fast");
263  Muo->SetForward("fast");
264  Muo->SetMdtMagnet(kTRUE);
265  Muo->SetMdtCoil(kTRUE);
266  Muo->SetMdtMFIron(kTRUE);
267  AddModule(Muo);
268  //------------------------- FTS -----------------
269  FairDetector *Fts= new PndFts("FTS", kTRUE);
270  Fts->SetGeometryFileName("fts.geo");
271  AddModule(Fts);
272  //------------------------- FTOF -----------------
273  FairDetector *FTof = new PndFtof("FTOF",kTRUE);
274  FTof->SetGeometryFileName("ftofwall.root");
275  AddModule(FTof);
276  //------------------------- RICH ----------------
277  //PndRich *Rich= new PndRich("RICH",kTRUE);
278  //Rich->SetGeometryFileName("rich_v313.root");
279  //AddModule(Rich);
280 }
PndDrc * Drc
Definition: sim_emc_apd.C:75
void SetForward(TString name)
Definition: PndMdt.h:34
FairDetector * FTof
Definition: sim_ftof.C:49
PndEmc * Emc
Definition: sim_emc_apd.C:55
void SetMdtCoil(bool opt=false)
Definition: PndMdt.h:28
FairDetector * Mvd
Definition: sim_emc_apd.C:51
void SetMdtMFIron(bool opt=false)
Definition: PndMdt.h:29
void SetStorageOfData(Bool_t val)
Definition: PndEmc.cxx:941
PndMdt * Muo
Definition: sim_emc_apd.C:67
Simulation of EMC.
Definition: PndEmc.h:26
FairDetector * Gem
Definition: runJohan.C:71
void SetMdtMagnet(bool opt=false)
Definition: PndMdt.h:27
FairDetector * Stt
Definition: sim_emc_apd.C:47
FairModule * Dipole
Definition: sim_emc_apd.C:40
FairModule * Cave
Definition: sim_emc_apd.C:32
Definition: PndDrc.h:31
virtual void SetGeometryVersion(const Int_t GeoNumber)
Definition: PndEmc.cxx:966
void SetBarrel(TString name)
Definition: PndMdt.h:31
fRun AddModule(Cave)
void SetEndcap(TString name)
Definition: PndMdt.h:32
void SetMuonFilter(TString name)
Definition: PndMdt.h:33
void SetRunCherenkov(Bool_t ch)
Definition: PndDrc.h:222
Definition: PndStt.h:34
Definition: PndMdt.h:20
FairModule * Pipe
Definition: sim_emc_apd.C:44
FairDetector * Fts
Definition: sim_ftof_stof.C:58
Definition: PndFts.h:25
Definition: PndCave.h:8
void PndMasterRunSim::Finish ( )

Final diagnostics.

Master Final diagnostics

It prints CPU time, memory usage, used parameters, and eventually send the information to CDash

Definition at line 727 of file PndMasterRunSim.cxx.

References ctime, Double_t, fOptions, fOutFile, fParamAsciiFile, fParamRootFile, fRtdb, fTimer, gGeoManager, outfile, and rtime.

Referenced by prod_sim(), sim_complete(), sim_complete_newSTT(), sim_day1(), sim_radlength_complete(), and tut_sim().

728 {
729  fRtdb->saveOutput();
730 
731  cout<<"PndMasterRunAna::Finish(): Tasks that ran just now:"<<endl;
732  TFile* outfile=fRootManager->GetOutFile();
733  bool wasopen=outfile->IsOpen ();
734  if (!wasopen)
735  {
736  cout<<"file is "<< ((wasopen) ? "" : "not " ) <<"open" <<endl;
737  outfile=new TFile(outfile->GetName(),"UPDATE");
738  }
739  outfile->cd();
740 
741  // write the summary of event filter to output root file
742  if (!strcmp(fGen->ClassName(),"PndFilteredPrimaryGenerator"))
743  ((PndFilteredPrimaryGenerator*)fGen)->WriteEvtFilterStatsToRootFile(outfile);
744  else
745  ((FairFilteredPrimaryGenerator*)fGen)->WriteEvtFilterStatsToRootFile(outfile);
746 
747  FairFileHeader* outheader=(FairFileHeader*)outfile->Get("FileHeader");
748  cout<<"Task tha ran just now:"<<endl;
749  for(const auto&& os : *(outheader->GetListOfTasks()) ) cout<<" - "<<((TObjString*)os)->GetString().Data()<<endl;
750 
751  TObjString outoptions(fOptions);
752  outoptions.Write("PndOptions",kOverwrite);
753 
754  outfile->Write();
755  if(!wasopen) outfile->Close();
756 
757  cout << endl;
758  if (gROOT->GetVersionInt() >= 60602) {
759  gGeoManager->GetListOfVolumes()->Delete();
760  gGeoManager->GetListOfShapes()->Delete();
761  delete gGeoManager;
762  }
763 
764  // Extract the maximal used memory an add is as Dart measurement
765  // This line is filtered by CTest and the value send to CDash
766  FairSystemInfo sysInfo;
767  Float_t maxMemory=sysInfo.GetMaxMemory();
768  cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
769  cout << maxMemory;
770  cout << "</DartMeasurement>" << endl;
771 
772  fTimer.Stop();
773  Double_t rtime = fTimer.RealTime();
774  Double_t ctime = fTimer.CpuTime();
775 
776  Float_t cpuUsage=ctime/rtime;
777  cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
778  cout << cpuUsage;
779  cout << "</DartMeasurement>" << endl;
780 
781  cout << endl;
782  cout << "Output file is\t\t" << fOutFile << endl;
783  cout << "Parameter ROOT file is\t" << fParamRootFile << endl;
784  cout << "Parameter ASCII file is\t" << fParamAsciiFile << endl;
785  cout << "Real time " << rtime << " s, CPU time " << ctime
786  << "s" << endl;
787  cout << "CPU usage " << cpuUsage*100. << "%" << endl;
788  cout << "Max Memory " << maxMemory << " MB" << endl;
789 
790  cout << "Macro finished successfully." << endl;
791 
792 }
TGeoManager * gGeoManager
TString fOptions
Options parsed to the simulation.
Primary generator with added event filtering capabilities.
Double_t
Primary generator with added event filtering capabilities.
Double_t ctime
Definition: hit_dirc.C:114
TString fParamRootFile
Name of the parameter root file.
FairRuntimeDb * fRtdb
Runtime DB.
TString fOutFile
Name of the output file.
Double_t rtime
Definition: hit_dirc.C:113
TStopwatch fTimer
Timer.
TString fParamAsciiFile
Name of the parameter ascii file.
TString outfile
FairFilteredPrimaryGenerator* PndMasterRunSim::GetFilteredPrimaryGenerator ( )
inline

Getter for the primary generator, e.g. to configure the event filter.

Definition at line 273 of file PndMasterRunSim.h.

Referenced by sim_complete(), sim_complete_newSTT(), sim_day1(), sim_radlength_complete(), and tut_sim().

273 {return (FairFilteredPrimaryGenerator*)fGen;}
Primary generator with added event filtering capabilities.
TString PndMasterRunSim::GetOptions ( )
inline

Definition at line 248 of file PndMasterRunSim.h.

References fOptions.

248 { return fOptions;}
TString fOptions
Options parsed to the simulation.
PndFilteredPrimaryGenerator* PndMasterRunSim::GetPndFilteredPrimaryGenerator ( )
inline

Definition at line 274 of file PndMasterRunSim.h.

Referenced by prod_sim().

274 {return (PndFilteredPrimaryGenerator*)fGen;}
Primary generator with added event filtering capabilities.
void PndMasterRunSim::GetRange ( TString  par,
double &  min,
double &  max 
)
private

Definition at line 797 of file PndMasterRunSim.cxx.

References par, and TString.

Referenced by UseBoxGenerator(), UseLepLepGenerator(), and UsePiPiGenerator().

798 {
799  par.ReplaceAll(" ","");
800  par = par(par.Index("(")+1, par.Length()-par.Index("(")-2);
801 
802  TString smin=par, smax=par;
803 
804  if (par.Contains(","))
805  {
806  smin = par(0,par.Index(","));
807  smax = par(par.Index(",")+1,1000);
808  }
809 
810  min = smin.Atof();
811  max = smax.Atof();
812 }
Double_t par[3]
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:25
void PndMasterRunSim::SetDpmFlag ( Int_t  Mode)
inline

Set the DPM flag.

Parameters
Mode= 0. - DPM - No elastic scattering, only inelastic
Mode= 1. - DPM - Elastic and inelastic interactions (default)
Mode= 2. - DPM - Only elastic scattering, no inelastic one

Definition at line 145 of file PndMasterRunSim.h.

References fDpmFlag.

Referenced by prod_sim().

145 { fDpmFlag = Mode; };
Int_t fDpmFlag
Flag for DPM event generator.
void PndMasterRunSim::SetEventCounterRate ( Int_t  par)
inline

Setter of the event counter rate.

Definition at line 258 of file PndMasterRunSim.h.

References fEventCounterRate, and par.

Double_t par[3]
Int_t fEventCounterRate
After how many events the counter will print.
void PndMasterRunSim::SetFtfFlag ( Int_t  Mode)
inline

Set the FTF noelastic flag.

Parameters
Mode= 0. - FTF - Elastic and inelastic interactions (default)
Mode= 1. - FTF - No elastic scattering, only inelastic

Definition at line 152 of file PndMasterRunSim.h.

References fFtfFlag.

Referenced by prod_sim().

152 { fFtfFlag = Mode; };
Int_t fFtfFlag
Flag for FTF event generator.
void PndMasterRunSim::SetGenerator ( )

Set the event generator.

Master event generator

This call set the event generator according to the input name. If the input name contains "dpm" it uses dpm, if it contains "ftf" then ftf, if ".dec" it runs evtgen using the input name as namefile of the .dec file. If the input name contains "box" the macro breaks, since in that case the SetGenerator(PndBoxGenerator *boxGen) function must be used.

Definition at line 391 of file PndMasterRunSim.cxx.

References fInput, fOptions, fTargetMode, TString, UseBoxGenerator(), UseDpmGenerator(), UseEvtGenGenerator(), UseFtfGenerator(), and UsePiPiGenerator().

Referenced by prod_sim(), sim_box(), sim_complete(), sim_complete_newSTT(), sim_day1(), sim_radlength_complete(), and tut_sim().

392 {
393  if (fOptions.Contains("pndfiltprim"))
394  fGen = new PndFilteredPrimaryGenerator();
395  else
396  fGen = new FairFilteredPrimaryGenerator();
397 
398  switch (fTargetMode)
399  {
400  case 0:
401  LOG(INFO) << "Using no Vertex smearing" << FairLogger::endl;
402  break;
403  case 1:
404  LOG(INFO) << "Using Cluster Jet Target" << FairLogger::endl;
405  // a cluster-jet beam at the interaction zone with a horizontal width
406  // of e.g. dx = 1 mm and a length in accelerator beam direction of dz = 10 mm.
407  // Target TDR, page 44
408  fGen->SetTarget(0., 1./2.355); // From FWHM to sigma
409  fGen->SmearVertexZ(kTRUE);
410  fGen->SmearGausVertexZ(kTRUE);
411  fGen->SetBeam(0., 0., 0.1, 0.1);
412  fGen->SmearVertexXY(kTRUE);
413  break;
414  case 2:
415  LOG(INFO) << "Using Pellet Target" << FairLogger::endl;
416  // At PANDA a beam diameter around 3mm is needed and one may want even
417  // smaller size when PTR is not possible.
418  // Target TDR, page 61
419  fGen->SetTarget(0., 0.3);
420  fGen->SmearVertexZ(kTRUE);
421  fGen->SmearGausVertexZ(kTRUE);
422  fGen->SetBeam(0., 0., 0.3, 0.3);
423  fGen->SmearVertexXY(kTRUE);
424  break;
425  case 3:
426  LOG(INFO) << "Using Pellet Tracking Target" << FairLogger::endl;
427  // A position resolution σ(x, y, z) < 0.2 mm in the in- teraction position
428  // is desirable for event reconstruc- tion.
429  // Target TDR, page 61
430  fGen->SetTarget(0., 0.02);
431  fGen->SmearVertexZ(kTRUE);
432  fGen->SmearGausVertexZ(kTRUE);
433  fGen->SetBeam(0., 0., 0.02, 0.02);
434  fGen->SmearVertexXY(kTRUE);
435  break;
436  default:
437  LOG(INFO) << "Unkwown target mode - Using no vertex smearing" << FairLogger::endl;
438  }
439 
440  TString input = fInput;
441  input.ToLower();
442 
443  if (input.EndsWith(".dec") || input.Contains(".dec:"))
444  {
446  }
447  else if (input.BeginsWith("dpm"))
448  {
449  UseDpmGenerator();
450  }
451  else if (input.BeginsWith("ftf"))
452  {
454  }
455  else if (input.BeginsWith("box"))
456  {
458  }
459  else if (input.BeginsWith("pipi"))
460  {
462  }
463  else
464  {
465  LOG(FATAL)<< "Generator could not be identified from input '"<<fInput.Data()<<"'!!" << FairLogger::endl;
466  }
467 
468 }
TString fInput
Name of the input for the simulation.
void UseEvtGenGenerator(TString EvtGenFile)
Use EvtGen as event generator.
Short_t fTargetMode
Target mode.
void UseDpmGenerator()
Use DPM as event generator.
TString fOptions
Options parsed to the simulation.
Primary generator with added event filtering capabilities.
void UsePiPiGenerator(TString pipiConfig)
Use PiPiGenerator as event generator.
Primary generator with added event filtering capabilities.
void UseFtfGenerator(TString ftfData)
Use FTF as event generator.
void UseBoxGenerator(TString BoxConfig)
Use BoxGen as event generator.
void PndMasterRunSim::SetGenerator ( FairGenerator *  boxGen)

Set the event generator for FairBoxGenerator.

Master event generator for FairBoxGenerator

This call set the FairBoxGenerator as event generator. The user should create a FairBoxGenerator object with all the settings, and pass it as argument to the function.

Definition at line 630 of file PndMasterRunSim.cxx.

References fOptions.

631  {
632  LOG(INFO) << "Using FairBoxGenerator generator" << FairLogger::endl;
633  if (fOptions.Contains("PndFiltPrim"))
634  fGen = new PndFilteredPrimaryGenerator();
635  else
636  fGen = new FairFilteredPrimaryGenerator();
637  fGen->AddGenerator(boxGen);
638 }
TString fOptions
Options parsed to the simulation.
Primary generator with added event filtering capabilities.
Primary generator with added event filtering capabilities.
FairBoxGenerator * boxGen
Definition: sim_emc_apd.C:85
void PndMasterRunSim::SetGenerator ( PndBoxGenerator boxGen)

Set the event generator for PndBoxGenerator.

Master event generator for PndBoxGenerator

This call set the PndBoxGenerator as event generator. The user should create a PndBoxGenerator object with all the settings, and pass it as argument to the function.

Definition at line 619 of file PndMasterRunSim.cxx.

References fOptions.

620 {
621  LOG(INFO) << "Using PndBoxGenerator generator" << FairLogger::endl;
622  if (fOptions.Contains("PndFiltPrim"))
623  fGen = new PndFilteredPrimaryGenerator();
624  else
625  fGen = new FairFilteredPrimaryGenerator();
626  fGen->AddGenerator(boxGen);
627 }
TString fOptions
Options parsed to the simulation.
Primary generator with added event filtering capabilities.
Primary generator with added event filtering capabilities.
void PndMasterRunSim::SetInput ( TString  par)
inline

Input of the simulation This string can be: a) the name of the dec file for EvtGen, ending w/ .dec b) "dpm" if you want to use dpm c) "ftf" if you want to use ftf d) "box:[...]" if you want to use box.

Definition at line 219 of file PndMasterRunSim.h.

References fInput, and par.

Referenced by prod_sim(), sim_box(), sim_complete(), sim_complete_newSTT(), sim_day1(), sim_radlength_complete(), and tut_sim().

219 { fInput = par;}
TString fInput
Name of the input for the simulation.
Double_t par[3]
void PndMasterRunSim::SetInputDir ( TString  par)
inline

Input directory of the simulation.

Definition at line 224 of file PndMasterRunSim.h.

References fInputDir, and par.

Referenced by sim_complete(), and sim_day1().

224 { fInputDir = par;}
Double_t par[3]
TString fInputDir
Name of the input directory for the simulation.
void PndMasterRunSim::SetNumberOfEvents ( Int_t  par)
inline

Setter of the number of events.

Definition at line 253 of file PndMasterRunSim.h.

References fNEvents, and par.

Referenced by prod_sim(), sim_box(), sim_complete(), sim_complete_newSTT(), sim_day1(), sim_radlength_complete(), and tut_sim().

253 { fNEvents = par;}
Int_t fNEvents
Number of events.
Double_t par[3]
void PndMasterRunSim::SetOptions ( TString  par)
inline

Setter of the simulation options This string can be: "" -> default settings full setup "day1" -> Setup for day1 experiment: no GEM, FTS1234, NO DISC, NO RICH "gem2" (added to "day1") -> Setup for day1 experiment with 2 GEM planes (first two) "gem3" (added to "day1") -> Setup for day1 experiment with 3 GEM planes "fts1256" (added to "day1") -> Setup for day1 experiment with FTS1256 insted of FTS1234 "strip" (added to "day1") -> Setup for day1 experiment with only the strip part of the MVD instead of the full MVD Example: "day1+gem+fts1256" means day1 setup + GEM planes + fst1256.

Definition at line 247 of file PndMasterRunSim.h.

References fOptions, and par.

Referenced by prod_sim(), sim_complete(), and sim_day1().

247 { fOptions = par; fOptions.ToLower();}
Double_t par[3]
TString fOptions
Options parsed to the simulation.
void PndMasterRunSim::SetParamAsciiFile ( TString  par)
inline

Setter of the parameter ascii file.

Definition at line 234 of file PndMasterRunSim.h.

References fParamAsciiFile, and par.

Referenced by prod_sim(), sim_box(), sim_complete(), sim_complete_newSTT(), sim_day1(), sim_radlength_complete(), and tut_sim().

234 { fParamAsciiFile = par;}
Double_t par[3]
TString fParamAsciiFile
Name of the parameter ascii file.
void PndMasterRunSim::SetParamRootFile ( TString  par)
inline

Setter of the parameter root file.

Definition at line 229 of file PndMasterRunSim.h.

References fParamRootFile, and par.

Referenced by Setup().

229 { fParamRootFile = par;}
Double_t par[3]
TString fParamRootFile
Name of the parameter root file.
void PndMasterRunSim::SetTargetMode ( Short_t  par)
inline

Setter of the target mode.

Target mode 0 - No IP smearing (default) 1 - Cluster Jet 2 - Pellet target 3 - Pellet Tracking target

Definition at line 268 of file PndMasterRunSim.h.

References fTargetMode, and par.

268 { fTargetMode = par;}
Double_t par[3]
Short_t fTargetMode
Target mode.
Bool_t PndMasterRunSim::Setup ( TString  outprefix = "")

Initial setup.

Master Inital setup

This command set the source files, load the proper parameters, and set the relevant flags. If something fails, it returns a kFALSE value.

Definition at line 70 of file PndMasterRunSim.cxx.

References allDigiFile, Bool_t, creator, Double_t, fIni, fInput, fOptions, fOutFile, fParamAsciiFile, fParamRootFile, fRtdb, fTargetMode, kParameterMerged, mom, parIo1, parOutput, SetField(), SetMaterials(), SetOutputFile(), SetParamRootFile(), SetUseFairLinks(), sqrt(), and TString.

Referenced by prod_sim(), sim_box(), sim_complete(), sim_complete_newSTT(), sim_day1(), sim_radlength_complete(), and tut_sim().

71 {
72  TString inputName = outprefix;
73 
74  // If no prefix is given, we create one from fInput and force lower-case
75  if (inputName=="")
76  {
77  inputName = fInput;
78  inputName.ToLower();
79  }
80 
81  if (inputName.EndsWith(".dec")) inputName.Remove(inputName.Length()-4,4);
82  inputName.ReplaceAll(":","_");
83 
84  PndFileNameCreator creator(inputName.Data());
85  SetOutputFile(creator.GetSimFileName().data());
86  fOutFile = creator.GetSimFileName().data();
87  SetParamRootFile(creator.GetParFileName().data());
88  SetMaterials("media_pnd.geo");
89  SetGenerateRunInfo(kFALSE);
90  SetUseFairLinks(kTRUE);
91 
92  // ----- Parameter database --------------------------------------------
93  TString allDigiFile = gSystem->Getenv("VMCWORKDIR");
94  allDigiFile += "/macro/params/";
95  allDigiFile += fParamAsciiFile;
96 
97  fRtdb = this->GetRuntimeDb();
98  Bool_t kParameterMerged=kFALSE; // No use until now
99  FairParRootFileIo* parOutput = new FairParRootFileIo(kParameterMerged);
100  parOutput->open(fParamRootFile,"RECREATE");
101 
102  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
103  parIo1->open(allDigiFile.Data(),"in");
104 
105  fRtdb->setFirstInput(parIo1);
106  fRtdb->setOutput(parOutput);
107 
108  // ----- Create and Set the Field(s) ------------------------------------
109  PndMultiField *field= new PndMultiField("AUTO");
110  SetField(field);
111 
112  // ---- Defining PANDA particles -----------------------------------------
113  Double_t mom = GetBeamMom();
114  TLorentzVector fIni(0, 0, mom, sqrt(mom*mom+9.3827203e-01*9.3827203e-01)+9.3827203e-01);
115  TDatabasePDG::Instance()->AddParticle("pbarpSystem" ,"pbarpSystem", fIni.M(), kFALSE, 0.1, 0, "", 88888);
116  TDatabasePDG::Instance()->AddParticle("pbarpSystem0","pbarpSystem0", fIni.M(), kFALSE, 0.1, 0, "", 88880);
117  TDatabasePDG::Instance()->AddParticle("pbarpSystem1","pbarpSystem1", fIni.M(), kFALSE, 0.1, 0, "", 88881);
118  TDatabasePDG::Instance()->AddParticle("pbarpSystem2","pbarpSystem2", fIni.M(), kFALSE, 0.1, 0, "", 88882);
119 
120  if (fOptions.Contains("day1")) fTargetMode = 1;
121  return kTRUE;
122 }
TString fInput
Name of the input for the simulation.
Bool_t kParameterMerged
Definition: sim_emc_apd.C:113
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Double_t mom
Definition: plot_dirc.C:14
Short_t fTargetMode
Target mode.
TString allDigiFile
Definition: hit_muo.C:36
TString fOptions
Options parsed to the simulation.
TString parOutput
void SetParamRootFile(TString par)
Setter of the parameter root file.
A simple class which adds the corresponding file extensions to a given base class.
Double_t
fRun SetField(fField)
FairParAsciiFileIo * parIo1
Definition: bump_emc.C:53
TString fParamRootFile
Name of the parameter root file.
fRun SetMaterials("media_pnd.geo")
fRun SetOutputFile(outFile)
PndMvdCreateDefaultApvMap * creator
FairRuntimeDb * fRtdb
Runtime DB.
TLorentzVector fIni
Definition: full_core_ntp.C:29
TString fOutFile
Name of the output file.
fRun SetUseFairLinks(kTRUE)
TString fParamAsciiFile
Name of the parameter ascii file.
void PndMasterRunSim::UseBoxGenerator ( TString  BoxConfig)

Use BoxGen as event generator.

Box event generator

This call sets BoxGenerator as event generator. The format of the config string is for isotrop events in theta: 'BOX:type(pdg,mult):p(min,max):phi(min,max):tht(min,max)' for isotrop events in cos(theta): 'BOX:type(pdg,mult):p(min,max):phi(min,max):ctht(min,max)' Instead of range 'var(min,max)' also a fixed value can be set with 'var(value)' All variables left out are set to defaults.

Parameters
BoxConfigconfiguration string of the BOX generator

Definition at line 470 of file PndMasterRunSim.cxx.

References Bool_t, boxGen, Double_t, GetRange(), mult, PndBoxGenerator::SetCosTheta(), PndBoxGenerator::SetDebug(), PndBoxGenerator::SetPhiRange(), PndBoxGenerator::SetPRange(), PndBoxGenerator::SetPtRange(), PndBoxGenerator::SetThetaRange(), PndBoxGenerator::SetXYZ(), and TString.

Referenced by SetGenerator().

471 {
472  // use BOX generator; defaults
473 
474  Double_t BoxMomMin = 0.05; // minimum momentum for box generator
475  Double_t BoxMomMax = 10.; // maximum " "
476  Double_t BoxThtMin = 0. ; // minimum theta for box generator
477  Double_t BoxThtMax = 180.; // maximum " "
478  Double_t BoxPhiMin = 0. ; // minimum phi for box generator
479  Double_t BoxPhiMax = 360.; // maximum " "
480  Bool_t BoxCosTht = false; // isotropic in cos(theta) instead theta
481  Bool_t BoxPt = false; // is pt given instead of p
482 
483  Int_t BoxType = 13; // default particle muon
484  Int_t BoxMult = 1; // default particle multiplicity
485  Double_t type=0,mult=0; // ref. parameters for range function
486 
487  BoxConfig.ToLower();
488 
489  if (BoxConfig!="box")
490  {
491  BoxConfig.ReplaceAll("box","");
492  BoxConfig.ReplaceAll(" ","");
493  BoxConfig += ":";
494 
495  while (BoxConfig.Contains(":"))
496  {
497  TString curpar = BoxConfig(0,BoxConfig.Index(":"));
498  BoxConfig = BoxConfig(BoxConfig.Index(":")+1,1000);
499  curpar.ReplaceAll("[","(");
500  curpar.ReplaceAll("]",")");
501 
502  if (curpar.BeginsWith("type(")) {GetRange(curpar,type,mult); BoxType = (Int_t)type; BoxMult = (Int_t)mult; }
503  if (curpar.BeginsWith("p(")) GetRange(curpar,BoxMomMin,BoxMomMax);
504  if (curpar.BeginsWith("pt(")) {GetRange(curpar,BoxMomMin,BoxMomMax); BoxPt = true;}
505  if (curpar.BeginsWith("tht(")) GetRange(curpar,BoxThtMin,BoxThtMax);
506  if (curpar.BeginsWith("ctht(")) {GetRange(curpar,BoxThtMin,BoxThtMax); BoxCosTht=true;}
507  if (curpar.BeginsWith("phi(")) GetRange(curpar,BoxPhiMin,BoxPhiMax);
508  }
509  }
510 
511  PndBoxGenerator* boxGen = new PndBoxGenerator(BoxType, BoxMult);
512  boxGen->SetDebug(0);
513 
514  if (BoxPt == true){
515  boxGen->SetPtRange(BoxMomMin, BoxMomMax);
516  } else {
517  boxGen->SetPRange(BoxMomMin,BoxMomMax); // GeV/c
518  }
519  boxGen->SetPhiRange(BoxPhiMin, BoxPhiMax); // Azimuth angle range [degree]
520  boxGen->SetThetaRange(BoxThtMin, BoxThtMax); // Polar angle in lab system range [degree]
521 
522  if (BoxCosTht) boxGen->SetCosTheta();
523 
524  boxGen->SetXYZ(0., 0., 0.); //cm
525 
526  LOG(INFO) << "Using PndBoxGenerator(" << GetBeamMom() <<", pdg="<<BoxType<<" mult="<<BoxMult
527  <<" ) generator with range p["<<BoxMomMin<<","<<BoxMomMax<<"] tht["<<BoxThtMin<<","<<BoxThtMax<<"]"<<(BoxCosTht?"*":"")<<" phi["<<BoxPhiMin<<","<<BoxPhiMax<<"]" << FairLogger::endl;
528 
529  // cout <<"BOX generator range: p["<<BoxMomMin<<","<<BoxMomMax<<"] tht["<<BoxThtMin<<","<<BoxThtMax<<"]"<<(BoxCosTht?"*":"")<<" phi["<<BoxPhiMin<<","<<BoxPhiMax<<"]"<<endl;
530 
531  fGen->AddGenerator(boxGen);
532 }
void SetThetaRange(Double32_t thetamin=0, Double32_t thetamax=90)
void SetXYZ(Double32_t x=0, Double32_t y=0, Double32_t z=0)
Double_t
void SetPtRange(Double32_t ptmin=0, Double32_t ptmax=10)
void SetDebug(Bool_t debug=0)
FairBoxGenerator * boxGen
Definition: sim_emc_apd.C:85
void GetRange(TString par, double &min, double &max)
void SetPRange(Double32_t pmin=0, Double32_t pmax=10)
Double_t mult
void SetPhiRange(Double32_t phimin=0, Double32_t phimax=360)
void PndMasterRunSim::UseDpmGenerator ( )

Use DPM as event generator.

Definition at line 641 of file PndMasterRunSim.cxx.

References fDpmFlag.

Referenced by SetGenerator().

642 {
643  LOG(INFO) << "Using PndDpmDirect(" << GetBeamMom() << ", " << fDpmFlag << ") generator" << FairLogger::endl;
644  PndDpmDirect *Dpm= new PndDpmDirect(GetBeamMom(), fDpmFlag);
645  fGen->AddGenerator(Dpm);
646 }
Int_t fDpmFlag
Flag for DPM event generator.
void PndMasterRunSim::UseEvtGenGenerator ( TString  EvtGenFile)

Use EvtGen as event generator.

EvtGen event generator

This call set EvtGen as event generator. The user should set the .dec file, and the function will retrieve automaticall beam momentum and initial state.

Parameters
EvtGenFileFilename of the .dec file

Definition at line 664 of file PndMasterRunSim.cxx.

References fInputDir, s, PndEvtGenDirect::SetStoreTree(), and TString.

Referenced by SetGenerator().

665 {
666 
667  TString IniRes="";
668 
669  if (EvtGenFile.Contains(":")) // is the initial resonance provide as <decfile>.dec:iniRes ?
670  {
671  IniRes = EvtGenFile(EvtGenFile.Index(":")+1,1000);
672  EvtGenFile = EvtGenFile(0,EvtGenFile.Index(":"));
673  }
674 
675  if (IniRes=="") // we need to search the decay file
676  {
677  TString fnamepath=fInputDir+EvtGenFile;
678  std::ifstream fs(fnamepath.Data());
679  char line[250];
680 
681  while (fs)
682  {
683  fs.getline(line,249);
684  TString s(line);
685  s.ReplaceAll("\r","");
686  if (IniRes=="" && s.Contains("Decay "))
687  {
688  if (s.Contains("#")) s=s(0,s.Index("#"));
689  s.ReplaceAll("Decay ","");
690  s.ReplaceAll(" ","");
691  IniRes = s;
692  }
693  }
694  fs.close();
695  }
696  /*
697  // Looping over the dec file trying to find the first string "Decay", in order to find the initai
698  // state as the following string
699  FILE *dec = fopen(fInputDir+EvtGenFile,"r");
700  if (dec==NULL) LOG(FATAL) << "The EvtGen dec file does not exist!! " << EvtGenFile << FairLogger::endl;
701 
702  char temp[6], particle[20];
703  Bool_t found = kFALSE;
704  while(fgets(temp, 6, dec) !=NULL)
705  {
706  if((strstr(temp, "Decay")) != NULL)
707  {
708  fscanf(dec, "%s",particle);
709  LOG(INFO) << "It was found a " << particle << " as initial state." << FairLogger::endl;
710  found = kTRUE;
711  break;
712  }
713  }
714  */
715  if (IniRes=="") LOG(FATAL) << "The input file is not a proper .dec!! " << FairLogger::endl;
716 
717  // TString EvtInput =gSystem->Getenv("VMCWORKDIR");
718  // EvtInput+="/macro/run/psi2s_Jpsi2pi_Jpsi_mumu.dec";
719  LOG(INFO) << "Using PndEvtGenDirect(" <<IniRes << ", " << (fInputDir+EvtGenFile).Data() << ", " << GetBeamMom() << ") generator" << FairLogger::endl;
720  PndEvtGenDirect *EvtGen = new PndEvtGenDirect(IniRes, (fInputDir+EvtGenFile).Data(), GetBeamMom());
721  EvtGen->SetStoreTree(kTRUE);
722  fGen->AddGenerator(EvtGen);
723 
724 }
TLorentzVector s
Definition: Pnd2DStar.C:50
void SetStoreTree(Bool_t store=true)
TString fInputDir
Name of the input directory for the simulation.
void PndMasterRunSim::UseFtfGenerator ( TString  ftfData)

Use FTF as event generator.

FTF event generator

This call set FTF as event generator. If no input file is given FtfDirect is used. With input file the events are taken from ftfData.

Definition at line 649 of file PndMasterRunSim.cxx.

References fFtfFlag.

Referenced by SetGenerator().

650 {
651  //if ( strncmp(fName,"TGeant4",7 ) == 0 ) LOG(FATAL) << "FTF does not run with Geant4 !!!" << FairLogger::endl;
652  if (ftfData.Contains(".root")){
653  LOG(INFO) << "Using PndFtfGenerator with input file " << ftfData << FairLogger::endl;
654  PndFtfGenerator* Ftf = new PndFtfGenerator(ftfData);
655  fGen->AddGenerator(Ftf);
656  } else {
657  LOG(INFO) << "Using PndFtfDirect(anti_proton, G4_H, 1, ftfp, " << GetBeamMom() << ", " << gRandom->GetSeed() <<", "<<fFtfFlag<< ") generator" << FairLogger::endl;
658  PndFtfDirect *Ftf = new PndFtfDirect("anti_proton", "G4_H", 1, "ftfp", GetBeamMom(), gRandom->GetSeed(), fFtfFlag);
659  fGen->AddGenerator(Ftf);
660  }
661 }
Int_t fFtfFlag
Flag for FTF event generator.
void PndMasterRunSim::UseLepLepGenerator ( TString  leplepConfig)

Use LepLepGenerator as event generator.

LepLep event generator

This call sets the PndLepLepGenerator as event generator. The format of the config string is: 'LEPLEP:pid(value):gegm(value):cosTheta(min, max)'

Parameters
leplepConfigconfiguration string of the LepLep generator

Definition at line 573 of file PndMasterRunSim.cxx.

References Double_t, GetRange(), pid(), PndLepLepGenerator::SetBeamMom(), PndLepLepGenerator::SetCosThetaMax(), PndLepLepGenerator::SetCosThetaMin(), and TString.

574 {
575  // use BOX generator; defaults
576 
577  Double_t cosThetaMin = 0.0;
578  Double_t cosThetaMax = 1.0;
579  Double_t pid = -1.0;
580  Double_t GeGmRatio = -1.0;
581  Double_t dummy = 1.0;
582 
583  leplepConfig.ToLower();
584 
585  if (leplepConfig!="")
586  {
587  leplepConfig.ReplaceAll("leplep","");
588  leplepConfig.ReplaceAll(" ","");
589  leplepConfig += ":";
590 
591  while (leplepConfig.Contains(":"))
592  {
593  TString curpar = leplepConfig(0,leplepConfig.Index(":"));
594  leplepConfig = leplepConfig(leplepConfig.Index(":")+1,1000);
595  curpar.ReplaceAll("[","(");
596  curpar.ReplaceAll("]",")");
597 
598  if (curpar.BeginsWith("pid(")) GetRange(curpar, pid, dummy);
599  if (curpar.BeginsWith("gegm(")) GetRange(curpar, GeGmRatio, dummy);
600  if (curpar.BeginsWith("cosTheta(")) GetRange(curpar, cosThetaMin, cosThetaMax);
601  }
602  }
603 
604  PndLepLepGenerator* leplepGen = new PndLepLepGenerator();
605  leplepGen->SetBeamMom(GetBeamMom());
606 
607  leplepGen->SetCosThetaMin(cosThetaMin);
608  leplepGen->SetCosThetaMax(cosThetaMax);
609 
610 
611  LOG(INFO) << "Using PndleplepGenerator(BeamMom = " << GetBeamMom() << " GeV/c, cosThetaRange = "<< cosThetaMin << " : " << cosThetaMax << ")" << FairLogger::endl;
612 
613  // cout <<"BOX generator range: p["<<BoxMomMin<<","<<BoxMomMax<<"] tht["<<BoxThtMin<<","<<BoxThtMax<<"]"<<(BoxCosTht?"*":"")<<" phi["<<BoxPhiMin<<","<<BoxPhiMax<<"]"<<endl;
614 
615  fGen->AddGenerator(leplepGen);
616 }
void SetBeamMom(Double_t in_P)
int pid()
Double_t
void SetCosThetaMax(Double_t in_cos_theta_max)
void GetRange(TString par, double &min, double &max)
void SetCosThetaMin(Double_t in_cos_theta_min)
void PndMasterRunSim::UsePiPiGenerator ( TString  pipiConfig)

Use PiPiGenerator as event generator.

PiPi event generator

This call sets the PndPiPiGenerator as event generator. The format of the config string is: 'PIPI:cosTheta(min, max)'

Parameters
pipiConfigconfiguration string of the PiPi generator

Definition at line 534 of file PndMasterRunSim.cxx.

References Double_t, GetRange(), PndPiPiGenerator::SetBeamMom(), PndPiPiGenerator::SetCosThetaMax(), PndPiPiGenerator::SetCosThetaMin(), and TString.

Referenced by SetGenerator().

535 {
536  // use BOX generator; defaults
537 
538  Double_t cosThetaMin = 0.0;
539  Double_t cosThetaMax = 1.0;
540 
541  pipiConfig.ToLower();
542 
543  if (pipiConfig!="pipi")
544  {
545  pipiConfig.ReplaceAll("pipi","");
546  pipiConfig.ReplaceAll(" ","");
547  pipiConfig += ":";
548 
549  while (pipiConfig.Contains(":"))
550  {
551  TString curpar = pipiConfig(0,pipiConfig.Index(":"));
552  pipiConfig = pipiConfig(pipiConfig.Index(":")+1,1000);
553  curpar.ReplaceAll("[","(");
554  curpar.ReplaceAll("]",")");
555 
556  if (curpar.BeginsWith("cosTheta(")) GetRange(curpar, cosThetaMin, cosThetaMax);
557  }
558  }
559 
560  PndPiPiGenerator* pipiGen = new PndPiPiGenerator();
561  pipiGen->SetBeamMom(GetBeamMom());
562  pipiGen->SetCosThetaMin(cosThetaMin);
563  pipiGen->SetCosThetaMax(cosThetaMax);
564 
565 
566  LOG(INFO) << "Using PndPiPiGenerator(BeamMom = " << GetBeamMom() << " GeV/c, cosThetaRange = "<< cosThetaMin << " : " << cosThetaMax << ")" << FairLogger::endl;
567 
568  // cout <<"BOX generator range: p["<<BoxMomMin<<","<<BoxMomMax<<"] tht["<<BoxThtMin<<","<<BoxThtMax<<"]"<<(BoxCosTht?"*":"")<<" phi["<<BoxPhiMin<<","<<BoxPhiMax<<"]"<<endl;
569 
570  fGen->AddGenerator(pipiGen);
571 }
void SetBeamMom(Double_t in_P)
void SetCosThetaMax(Double_t in_cos_theta_max)
Double_t
void SetCosThetaMin(Double_t in_cos_theta_min)
void GetRange(TString par, double &min, double &max)

Member Data Documentation

Int_t PndMasterRunSim::fDpmFlag
private

Flag for DPM event generator.

Definition at line 287 of file PndMasterRunSim.h.

Referenced by SetDpmFlag(), and UseDpmGenerator().

Int_t PndMasterRunSim::fEventCounterRate
private

After how many events the counter will print.

Definition at line 290 of file PndMasterRunSim.h.

Referenced by AddSimTasks(), and SetEventCounterRate().

Int_t PndMasterRunSim::fFtfFlag
private

Flag for FTF event generator.

Definition at line 288 of file PndMasterRunSim.h.

Referenced by SetFtfFlag(), and UseFtfGenerator().

TString PndMasterRunSim::fInput
private

Name of the input for the simulation.

Definition at line 280 of file PndMasterRunSim.h.

Referenced by SetGenerator(), SetInput(), and Setup().

TString PndMasterRunSim::fInputDir
private

Name of the input directory for the simulation.

Definition at line 281 of file PndMasterRunSim.h.

Referenced by SetInputDir(), and UseEvtGenGenerator().

Int_t PndMasterRunSim::fNEvents
private

Number of events.

Definition at line 289 of file PndMasterRunSim.h.

Referenced by AddSimTasks(), and SetNumberOfEvents().

TString PndMasterRunSim::fOptions
private

Options parsed to the simulation.

Definition at line 285 of file PndMasterRunSim.h.

Referenced by AddSimTasks(), CreateGeometry(), CreateGeometryDay1(), Finish(), GetOptions(), SetGenerator(), SetOptions(), and Setup().

TString PndMasterRunSim::fOutFile
private

Name of the output file.

Definition at line 282 of file PndMasterRunSim.h.

Referenced by Finish(), and Setup().

TString PndMasterRunSim::fParamAsciiFile
private

Name of the parameter ascii file.

Definition at line 284 of file PndMasterRunSim.h.

Referenced by Finish(), SetParamAsciiFile(), and Setup().

TString PndMasterRunSim::fParamRootFile
private

Name of the parameter root file.

Definition at line 283 of file PndMasterRunSim.h.

Referenced by Finish(), SetParamRootFile(), and Setup().

FairRuntimeDb* PndMasterRunSim::fRtdb
private

Runtime DB.

Definition at line 293 of file PndMasterRunSim.h.

Referenced by Finish(), and Setup().

Short_t PndMasterRunSim::fTargetMode
private

Target mode.

Definition at line 291 of file PndMasterRunSim.h.

Referenced by SetGenerator(), SetTargetMode(), and Setup().

TStopwatch PndMasterRunSim::fTimer
private

Timer.

Definition at line 294 of file PndMasterRunSim.h.

Referenced by Finish(), and PndMasterRunSim().


The documentation for this class was generated from the following files: