FairRoot/PandaRoot
Functions
runLmdSim.C File Reference

Go to the source code of this file.

Functions

void runSim (const int nEvents=10, const double mom=6.2, TString storePath=" /private/huagen/simdata", const int verboseLevel=0, const int particle=-2212)
 
int runLmdSim ()
 

Function Documentation

int runLmdSim ( )

Definition at line 118 of file runLmdSim.C.

References runSim().

119 {
120  runSim();
121  return 0;
122 }
void runSim(const int nEvents=10, const double mom=6.2, TString storePath=" /private/huagen/simdata", const int verboseLevel=0, const int particle=-2212)
Definition: runLmdSim.C:2
void runSim ( const int  nEvents = 10,
const double  mom = 6.2,
TString  storePath = " /private/huagen/simdata",
const int  verboseLevel = 0,
const int  particle = -2212 
)

Definition at line 2 of file runLmdSim.C.

References Bool_t, boxGen, Cave, ctime, Double_t, exit(), fField, fieldPar, fRun, gDebug, kParameterMerged, mom, nEvents, output, parOutput, Pi, pi, Pipe, primGen, printf(), rootlogon(), rtdb, rtime, PndMultiFieldPar::SetParameters(), simOutput, storePath, timer, TString, and verboseLevel.

Referenced by runLmdSim().

3 { //The macro is to make the simulation run after constructing the detector Geometry, defining
4  // the physics process, creating the event generator.
5  TStopwatch timer;
6  timer.Start();
7  gDebug=0;
8  //int verboseLevel = 1;
9 
10  // Int_t nEvents = 20;
11  gROOT->LoadMacro("/home/huagen/fairroot/pandarootJun24/trunk/gconfig/rootlogon.C");
12  rootlogon();
13 
15  FairRunSim *fRun = new FairRunSim();
16  TString simOutput =storePath+"/Lmd_Test.root";
17  TString parOutput=storePath+"/LmdParams1.root";
18 
19  fRun->SetName("TGeant3");
20 
21  fRun->SetOutputFile(simOutput);
22  fRun->SetMaterials("media_pnd.geo");
23 
24 // *************************************************************
25 // Step 1 of the main flowchart to create detector
26 // *************************************************************
27  // Create and add detectors // Add cave of panda, it's one of the FAIR moduel
28  FairModule *Cave= new PndCave("CAVE");
29  Cave->SetGeometryFileName("pndcave.geo");
30  fRun->AddModule(Cave);
31  // Add magnet of panda on this macro, also FAIR module
32 
33  FairModule *Pipe= new PndPipe("PIPE");
34  Pipe->SetGeometryFileName("pipebeamtarget.geo");
35 // fRun->AddModule(Pipe);
36 
37 // cout<<"before loading lmd"<<endl;
38  FairDetector* Lmd= new PndLmdDetector("LMD",kTRUE);
39 // cout<<"after loading lmd"<<endl;
40  Lmd->SetGeometryFileName("lmd.geo");
41 // cout<<"after loading lmd"<<endl;
42  Lmd->SetVerboseLevel(verboseLevel);
43 // cout<<"after loading lmd"<<endl;
44  fRun->AddModule(Lmd);
45  // cout<<"after loading lmd"<<endl;
46 
47 
48 // ***************************************************************
49 // Step 2 of the main flowchart to define the event generator
50 // ***************************************************************
51  // Create and set event generator // Invoke the primGen for this simulation run
52  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
53  fRun->SetGenerator(primGen);
54 
55  // Box Generator:
56  FairBoxGenerator* boxGen = new FairBoxGenerator(-2212, 1);
57  // first number: PDG particle code: 2nd number: particle multiplicity per event
58  boxGen->SetPRange(mom, mom); // GeV/c
59  boxGen->SetPhiRange(0.,360.);// Azimuth angle range [degree]
60  boxGen->SetThetaRange(0.005*180./pi, 0.005*180./pi);
61  boxGen->SetXYZ(0., 0., 0.); // vertex coordinates [cm]
62 // boxGen->SetBoxXYZ(-1,1,1,-1,0);
63  primGen->AddGenerator(boxGen);
64 
65 
66 // Field Map Definition
67  // // MultiField:
69 /*
70  PndTransMap *map_t = new PndTransMap("TransMap", "R");
71  PndDipoleMap *map_d = new PndDipoleMap("DipoleMap", "R");
72 // PndSolenoidMap *map_s = new PndSolenoidMap("SolenoidMap", "R");
73  PndSolenoidMap *map_s1 = new PndSolenoidMap("SolenoidMap1", "R");
74  PndSolenoidMap *map_s2 = new PndSolenoidMap("SolenoidMap2", "R");
75  PndSolenoidMap *map_s3 = new PndSolenoidMap("SolenoidMap3", "R");
76  PndSolenoidMap *map_s4 = new PndSolenoidMap("SolenoidMap4", "R");
77 */
78 // fField->AddField(map_t);
79 // fField->AddField(map_d);
80 // fField->AddField(map_s);
81 // fField->AddField(map_s1);
82 // fField->AddField(map_s2);
83 // fField->AddField(map_s3);
84 // fField->AddField(map_s4);
85 
86 //switch offf the field on Jul. 13 2009
87 // fRun->SetField(fField);
88 
89  fRun->SetStoreTraj(kTRUE);
90  //fRun->SetStoreTraj(kFALSE);
91  fRun->Init();
92  cout<<"fRun Initialize successfully!"<<endl;
93 
94  FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
96  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
97  output->open(parOutput.Data(), "RECREATE");
98  rtdb->setOutput(output);
99 
100  // Initalize the monte carlo // ------------------------
101  PndMultiFieldPar* fieldPar = (PndMultiFieldPar*) rtdb->getContainer("PndMultiFieldPar");
102  if ( fField ) { fieldPar->SetParameters(fField); }
103  fieldPar->setInputVersion(fRun->GetRunId(),1);
104  fieldPar->setChanged(kTRUE);
105 
106  rtdb->saveOutput();
107  rtdb->print();
108 
109  fRun->Run(nEvents);
110 
111  timer.Stop();
112  Double_t rtime = timer.RealTime();
113  Double_t ctime = timer.CpuTime();
114  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
115  exit();
116 }
PndMultiField * fField
Definition: sim_emc_apd.C:97
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
int verboseLevel
Definition: Lars/runMvdSim.C:7
Bool_t kParameterMerged
Definition: sim_emc_apd.C:113
void SetParameters(FairField *field)
exit(0)
#define pi
Definition: createSTT.C:60
TString storePath
Double_t mom
Definition: plot_dirc.C:14
FairParRootFileIo * output
Definition: sim_emc_apd.C:120
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
TString parOutput
FairRunAna * fRun
Definition: hit_dirc.C:58
Double_t
FairModule * Cave
Definition: sim_emc_apd.C:32
Int_t nEvents
Definition: hit_dirc.C:11
PndMultiFieldPar * fieldPar
Definition: sim_ftof.C:102
TStopwatch timer
Definition: hit_dirc.C:51
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
gDebug
Definition: sim_emc_apd.C:6
Double_t ctime
Definition: hit_dirc.C:114
FairBoxGenerator * boxGen
Definition: sim_emc_apd.C:85
TString simOutput
FairModule * Pipe
Definition: sim_emc_apd.C:44
Double_t rtime
Definition: hit_dirc.C:113
Double_t Pi
Definition: PndCave.h:8