FairRoot/PandaRoot
Functions
runLumi0SimBox.C File Reference

Go to the source code of this file.

Functions

int runLumi0SimBox (const int nEvents=10000, const int startEv=0, const double mom=15, TString storePath="tmpOutput", const int verboseLevel=0, const int particle=-2212, const int trkNum=1, const int seed=3435)
 

Function Documentation

int runLumi0SimBox ( const int  nEvents = 10000,
const int  startEv = 0,
const double  mom = 15,
TString  storePath = "tmpOutput",
const int  verboseLevel = 0,
const int  particle = -2212,
const int  trkNum = 1,
const int  seed = 3435 
)

Definition at line 4 of file runLumi0SimBox.C.

References Bool_t, Cave, ctime, Dipole, Double_t, fBox, fField, fRun, gDebug, kParameterMerged, Magnet, mom, nEvents, output, Par, parOutput, particle, primGen, printf(), rtdb, rtime, seed, PndSdsDetector::SetExclusiveSensorType(), PndMultiFieldPar::SetParameters(), PndSdsDetector::SetVerboseLevel(), simOutput, storePath, timer, TString, and verboseLevel.

5 {
6  gRandom->SetSeed(seed);
7  TStopwatch timer;
8  timer.Start();
9  gDebug=0;
10  cout<<"We start run for beam Mom = "<<mom<<endl;
11  //output1
12  TString simOutput=storePath+"/Lumi_MC_";
13  simOutput += startEv;
14  simOutput += ".root";
15  TString parOutput=storePath+"/Lumi_Params_";
16  parOutput +=startEv;
17  parOutput +=".root";
18  //Load basic libraries
19  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
20  gSystem->Load("libSds");
21  gSystem->Load("libLmd");
22  FairRunSim *fRun = new FairRunSim();
23  cout<<"All libraries succsesfully loaded!"<<endl;
24 
25  //set the MC version used
26  fRun->SetName("TGeant4");
27  // fRun->SetName("TGeant3");//GEANE uses GEANT3!
28 
29  fRun->SetOutputFile(simOutput);
30 
31  //set material
32  fRun->SetMaterials("media_pnd.geo");
33 
34 
35  //create and add detectors
36  FairModule *Cave= new PndCave("CAVE");
37  Cave->SetGeometryFileName("pndcaveVAC.geo");
38  // Cave->SetGeometryFileName("pndcave.geo");
39  fRun->AddModule(Cave);
40 
41  // FairModule *Pipe= new PndPipe("PIPE");
42  // Pipe->SetGeometryFileName("beampipe_201112.root");
43  // fRun->AddModule(Pipe);
44 
45 
46  FairModule *Magnet= new PndMagnet("MAGNET");
47  Magnet->SetGeometryFileName("FullSolenoid.root");
48  fRun->AddModule(Magnet);
49 
50  FairModule *Dipole= new PndMagnet("MAGNET");
51  Dipole->SetGeometryFileName("dipole.geo");
52  fRun->AddModule(Dipole);
53 
54 
55 
56  /*FairDetector *Stt= new PndStt("STT", kFALSE);
57  Stt->SetGeometryFileName("straws_skewed_blocks.geo");
58  fRun->AddModule(Stt);*/
59 
60  // FairDetector *Mvd = new PndMvdDetector("MVD", kFALSE);
61  // Mvd->SetGeometryFileName("MVD_v1.0_woPassiveTraps.root");
62  // fRun->AddModule(Mvd);
63 
64  /* PndEmc *Emc = new PndEmc("EMC",kFALSE);
65  Emc->SetGeometryFileNameDouble("emc_module1245.dat","emc_module3new.root"); // if you want to use new geometry for FwEndCap
66  fRun->AddModule(Emc);
67 
68  FairDetector *Tof = new PndTof("TOF",kFALSE);
69  Tof->SetGeometryFileName("tofbarrel.geo");
70  fRun->AddModule(Tof);
71 
72  FairDetector *Drc = new PndDrc("DIRC", kFALSE);
73  Drc->SetGeometryFileName("dirc.geo");
74  fRun->AddModule(Drc);
75 
76  PndMdt *Muo = new PndMdt("MDT",kFALSE);
77  Muo->SetGeometryFileName("muopars.root");
78  Muo->SetMdtVersion("torino");
79  fRun->AddModule(Muo);*/
80 
81 
82 
83  PndLmdDetector *Lum = new PndLmdDetector("LUM", kTRUE);
84  Lum->SetExclusiveSensorType("LumActive"); //ignore MVD
85  Lum->SetGeometryFileName("../macro/lmd/geo/Test-Dipol-Design.root"); //sensors with trap shape
86  // Lum->SetGeometryFileName("../macro/lmd/geo/HV_MAPS-Design.root"); // new sensors
88  fRun->AddModule(Lum);
89 
90 
91  //particle generator
92  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
93  // primGen->SmearVertexXY(kTRUE);
94  // primGen->SmearAngle(kTRUE);
95  // primGen->SmearVertexZ(kTRUE);
96  // primGen->SetBeamAngularDivergence(0.0003);// sigmaTheta~0.3 mrad
97  // primGen->SetBeam(0., 0., 2*0.08, 2*0.08); //sigmaX=sigmaY=0.8 mm ["square"shape of beam ]
98  // primGen->SetTarget(0.,0.1); // sigmaZ=1mm, gaus
99 
100  fRun->SetGenerator(primGen);
101 
102  // Box Generator
103 
104  FairBoxGenerator *fBox = new FairBoxGenerator(particle, trkNum);
105  fBox->SetPRange(mom,mom);
106  // fBox->SetThetaRange(0.13,0.7); // 2... 12 mrad
107  //fBox->SetThetaRange(0.13,0.65); // 2... 11 mrad
108  fBox->SetThetaRange(0.229183, 0.458366); //4 ... 8 mrad
109  //fBox->SetThetaRange(0.458366, 0.458366); //!!! 8 mrad
110  //fBox->SetThetaRange(0.3, 0.3);//TEST
111  // fBox->SetPhiRange(0,360.);
112  fBox->SetPhiRange(0.5,359.5); //FOR missed track check
113  // fBox->SetPhiRange(0.,0.);
114  // fBox->SetPhiRange(0,0);//TEST
115  primGen->AddGenerator(fBox);
116 
117 
118  // //EvtGen Generator
119  // PndEvtGenDirect *EvtGen = new PndEvtGenDirect("pbarpSystem","PBARSYSTEMTO4PIPHSP.DEC",mom);
120  // primGen->AddGenerator(EvtGen);
121 
122 
123  // Urqmd Generator
124  // FairUrqmdGenerator* urqmdGen = new FairUrqmdGenerator("../../input/00-03fm.100ev.f14");
125  // primGen->AddGenerator(urqmdGen);
126 
127  // DPM Generator
128  // PndDpmGenerator* dpmGen = new PndDpmGenerator("DpmInput/el_100k_aida/el_6_2GeV.root");
129  // primGen->AddGenerator(dpmGen);
130 
131 
132  //reading the new field map in the old format
133  fRun->SetBeamMom(mom);
134 
135  // PndMultiField *fField= new PndMultiField();
136  PndMultiField *fField= new PndMultiField("FULL");
137 
138  // PndTransMap *map_t = new PndTransMap("TransMap_v1", "R");
139  // PndDipoleMap *map_d1 = new PndDipoleMap("DipoleMap1_v1", "R");
140  // PndDipoleMap *map_d2 = new PndDipoleMap("DipoleMap2_v1", "R");
141  // PndSolenoidMap *map_s1 = new PndSolenoidMap("SolenoidMap1", "R");
142  // PndSolenoidMap *map_s2 = new PndSolenoidMap("SolenoidMap2", "R");
143  // PndSolenoidMap *map_s3 = new PndSolenoidMap("SolenoidMap3", "R");
144  // PndSolenoidMap *map_s4 = new PndSolenoidMap("SolenoidMap4", "R");
145 
146  // fField->AddField(map_t);
147  // fField->AddField(map_d1);
148  // fField->AddField(map_d2);
149  // fField->AddField(map_s1);
150  // fField->AddField(map_s2);
151  // fField->AddField(map_s3);
152  // fField->AddField(map_s4);
153 
154  fRun->SetField(fField);
155 
156  if(nEvents<101)
157  fRun->SetStoreTraj(kTRUE); // toggle this for use with EVE
158  else
159  fRun->SetStoreTraj(kFALSE);
160 
161  // fRun->SetStoreTraj(kTRUE);
162  fRun->Init();
163 
164  // -Trajectories Visualization (TGeoManager Only )
165  // -----------------------------------------------
166 
167  // Set cuts for storing the trajectpries
168 // FairTrajFilter* trajFilter = FairTrajFilter::Instance();
169 // trajFilter->SetStepSizeCut(0.01); // 1 cm
170 // trajFilter->SetVertexCut(-200., -200., -200, 200., 200., 200.);
171 // trajFilter->SetMomentumCutP(10e-3); // p_lab > 10 MeV
172 // trajFilter->SetEnergyCut(0., 1.02); // 0 < Etot < 1.04 GeV
173 // trajFilter->SetStorePrimaries(kTRUE);
174 // trajFilter->SetStoreSecondaries(kTRUE);
175 
176 
177  // Fill the Parameter containers for this run
178  //-------------------------------------------
179  FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
180  Bool_t kParameterMerged=kTRUE;
181  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
182  output->open(parOutput.Data(),"RECREATE");
183  rtdb->setOutput(output);
184  PndMultiFieldPar* Par = (PndMultiFieldPar*) rtdb->getContainer("PndMultiFieldPar");
185  if (fField) { Par->SetParameters(fField); }
186  Par->setInputVersion(fRun->GetRunId(),1);
187  Par->setChanged();
188 
189  // Transport nEvents
190  // -----------------
191 
192  fRun->Run(nEvents);
193 
194  rtdb->saveOutput();
195  rtdb->print();
196 
197 
198  timer.Stop();
199  Double_t rtime = timer.RealTime();
200  Double_t ctime = timer.CpuTime();
201  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
202  return 0;
203 }
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 SetExclusiveSensorType(const TString sens)
void SetParameters(FairField *field)
TString storePath
Double_t mom
Definition: plot_dirc.C:14
FairBoxGenerator * fBox
FairParRootFileIo * output
Definition: sim_emc_apd.C:120
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
const int particle
TString parOutput
FairRunAna * fRun
Definition: hit_dirc.C:58
Double_t
FairModule * Dipole
Definition: sim_emc_apd.C:40
FairModule * Cave
Definition: sim_emc_apd.C:32
Int_t nEvents
Definition: hit_dirc.C:11
unsigned int seed
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
TString simOutput
PndMultiFieldPar * Par
Definition: sim_emc_apd.C:115
void SetVerboseLevel(Int_t level)
Double_t rtime
Definition: hit_dirc.C:113
FairModule * Magnet
Definition: sim_emc_apd.C:36
Definition: PndCave.h:8