FairRoot/PandaRoot
runLumiPixel0SimDPMDirect.C
Go to the documentation of this file.
1 //###################################
2 // # Lmd DPM-Direct Sim macro
3 // # for DPM+FairPrimaryGenerator generation
4 // # 23/10/2013
5 // # author: A.Karavdina
6 //###################################
7 int runLumiPixel0SimDPMDirect(const int nEvents=10, const int startEvent=0, const double mom=15, TString storePath="tmpOutputDPM",
8  const int verboseLevel=0, const int seed, const int mode = 1, const double th_min = 0.12)
9 {
10  // gRandom->SetSeed(seed);
11  // Int_t mode = 1;
12  TStopwatch timer;
13  timer.Start();
14  gDebug=0;
15 
16  //output1
17  TString simOutput=storePath+"/Lumi_MC_";
18  simOutput += startEvent;
19  simOutput += ".root";
20  TString parOutput=storePath+"/Lumi_Params_";
21  parOutput += startEvent;
22  parOutput += ".root";
23  // //Load basic libraries
24  // gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
25  // gSystem->Load("libSds");
26  // gSystem->Load("libLmd");
27  FairRunSim *fRun = new FairRunSim();
28  //cout<<"All libraries succsesfully loaded!"<<endl;
29 
30  //set the MC version used
31  fRun->SetName("TGeant4");
32  //fRun->SetName("TGeant3");
33 
34  fRun->SetOutputFile(simOutput);
35 
36 
37  //set material
38  fRun->SetMaterials("media_pnd.geo");
39 
40  // // //create and add detectors
41 // // //------------------------- CAVE -----------------
42 
43  FairModule *Cave= new PndCave("CAVE");
44  Cave->SetGeometryFileName("pndcave.geo");
45  //Cave->SetGeometryFileName("pndcaveVAC.geo"); //vac cave is not really necessary
46  //Cave->SetGeometryFileName("../macro/lmd/geo/pndcaveVAC.geo"); //LMD is working in vacuum!
47  fRun->AddModule(Cave);
48  //------------------------- Magnet -----------------
49  FairModule *Magnet= new PndMagnet("MAGNET");
50  // Magnet->SetGeometryFileName("FullSuperconductingSolenoid_v831.root");
51  Magnet->SetGeometryFileName("FullSolenoid_V842.root");
52  fRun->AddModule(Magnet);
53  FairModule *Dipole= new PndMagnet("MAGNET");
54  Dipole->SetGeometryFileName("dipole.geo");
55  fRun->AddModule(Dipole);
56  //------------------------- Pipe -----------------
57  FairModule *Pipe= new PndPipe("PIPE");
58  // Pipe->SetGeometryFileName("../macro/lmd/geo/beampipe_201303.root");
59  Pipe->SetGeometryFileName("beampipe_201309.root");
60  fRun->AddModule(Pipe);
61 
62  PndLmdDetector *Lum = new PndLmdDetector("LUM", kTRUE);
63  Lum->SetExclusiveSensorType("LumActive"); //ignore MVD
64  // Lum->SetGeometryFileName("../macro/lmd/geo/HV_MAPS-Design-29052013.root"); // LMD including box etc
65  Lum->SetGeometryFileName("Luminosity-Detector.root");
67  fRun->AddModule(Lum);
68 
69  //Other PANDA systems ----
70  // //------------------------- STT -----------------
71  // FairDetector *Stt= new PndStt("STT", kTRUE);
72  // Stt->SetGeometryFileName("straws_skewed_blocks_35cm_pipe.geo");
73  // fRun->AddModule(Stt);
74  // //------------------------- MVD -----------------
75  // FairDetector *Mvd = new PndMvdDetector("MVD", kTRUE);
76  // Mvd->SetGeometryFileName("Mvd-2.1_FullVersion.root");
77  // fRun->AddModule(Mvd);
78  // //------------------------- GEM -----------------
79  // FairDetector *Gem = new PndGemDetector("GEM", kTRUE);
80  // Gem->SetGeometryFileName("gem_3Stations.root");
81  // fRun->AddModule(Gem);
82  // //------------------------- EMC -----------------
83  // PndEmc *Emc = new PndEmc("EMC",kTRUE);
84  // Emc->SetGeometryVersion(1);
85  // Emc->SetStorageOfData(kFALSE);
86  // fRun->AddModule(Emc);
87  // //------------------------- SCITIL -----------------
88  // FairDetector *SciT = new PndSciT("SCIT",kTRUE);
89  // SciT->SetGeometryFileName("barrel-SciTil_07022013.root");
90  // fRun->AddModule(SciT);
91  // //------------------------- DRC -----------------
92  // PndDrc *Drc = new PndDrc("DIRC", kTRUE);
93  // Drc->SetGeometryFileName("dirc_l0_p0_updated.root");
94  // Drc->SetRunCherenkov(kFALSE);
95  // fRun->AddModule(Drc);
96  // //------------------------- DISC -----------------
97  // PndDsk* Dsk = new PndDsk("DSK", kTRUE);
98  // Dsk->SetStoreCerenkovs(kFALSE);
99  // Dsk->SetStoreTrackPoints(kFALSE);
100  // fRun->AddModule(Dsk);
101  // //------------------------- MDT -----------------
102  // PndMdt *Muo = new PndMdt("MDT",kTRUE);
103  // Muo->SetBarrel("fast");
104  // Muo->SetEndcap("fast");
105  // Muo->SetMuonFilter("fast");
106  // Muo->SetForward("fast");
107  // Muo->SetMdtMagnet(kTRUE);
108  // Muo->SetMdtMFIron(kTRUE);
109  // fRun->AddModule(Muo);
110  // //------------------------- FTS -----------------
111  // FairDetector *Fts= new PndFts("FTS", kTRUE);
112  // Fts->SetGeometryFileName("fts.geo");
113  // fRun->AddModule(Fts);
114  // //------------------------- FTOF -----------------
115  // FairDetector *FTof = new PndFtof("FTOF",kTRUE);
116  // FTof->SetGeometryFileName("ftofwall.root");
117  // fRun->AddModule(FTof);
118  // //------------------------- RICH ----------------
119  // FairDetector *Rich= new PndRich("RICH",kFALSE);
120  // Rich->SetGeometryFileName("rich_v2_shift.geo");
121  // fRun->AddModule(Rich);
122  // //[END] Other PANDA systems ---
123 
124  // //Other PANDA systems ----
125  // //------------------------- STT -----------------
126  // PndStt *Stt= new PndStt("STT", kFALSE);
127  // Stt->SetGeometryFileName("straws_skewed_blocks_35cm_pipe.geo");
128  // fRun->AddModule(Stt);
129  // //------------------------- MVD -----------------
130  // PndMvdDetector *Mvd = new PndMvdDetector("MVD", kFALSE);
131  // Mvd->SetGeometryFileName("Mvd-2.1_FullVersion.root");
132  // fRun->AddModule(Mvd);
133  // //------------------------- GEM -----------------
134  // PndGemDetector *Gem = new PndGemDetector("GEM", kFALSE);
135  // Gem->SetGeometryFileName("gem_3Stations.root");
136  // fRun->AddModule(Gem);
137  // //------------------------- EMC -----------------
138  // PndEmc *Emc = new PndEmc("EMC",kFALSE);
139  // Emc->SetGeometryVersion(1);
140  // Emc->SetStorageOfData(kFALSE);
141  // fRun->AddModule(Emc);
142  // //------------------------- SCITIL -----------------
143  // PndSciT *SciT = new PndSciT("SCIT",kFALSE);
144  // SciT->SetGeometryFileName("barrel-SciTil_07022013.root");
145  // fRun->AddModule(SciT);
146  // //------------------------- DRC -----------------
147  // PndDrc *Drc = new PndDrc("DIRC", kFALSE);
148  // Drc->SetGeometryFileName("dirc_l0_p0_updated.root");
149  // Drc->SetRunCherenkov(kFALSE);
150  // fRun->AddModule(Drc);
151  // //------------------------- DISC -----------------
152  // PndDsk* Dsk = new PndDsk("DSK", kFALSE);
153  // Dsk->SetStoreCerenkovs(kFALSE);
154  // Dsk->SetStoreTrackPoints(kFALSE);
155  // fRun->AddModule(Dsk);
156  // //------------------------- MDT -----------------
157  // PndMdt *Muo = new PndMdt("MDT",kFALSE);
158  // Muo->SetBarrel("fast");
159  // Muo->SetEndcap("fast");
160  // Muo->SetMuonFilter("fast");
161  // Muo->SetForward("fast");
162  // Muo->SetMdtMagnet(kTRUE);
163  // Muo->SetMdtMFIron(kTRUE);
164  // fRun->AddModule(Muo);
165  // //------------------------- FTS -----------------
166  // PndFts *Fts= new PndFts("FTS",kFALSE);
167  // Fts->SetGeometryFileName("fts.geo");
168  // fRun->AddModule(Fts);
169  // //------------------------- FTOF -----------------
170  // PndFtof *FTof = new PndFtof("FTOF",kFALSE);
171  // FTof->SetGeometryFileName("ftofwall.root");
172  // fRun->AddModule(FTof);
173  // //------------------------- RICH ----------------
174  // PndRich *Rich= new PndRich("RICH",kFALSE);
175  // Rich->SetGeometryFileName("rich_v2_shift.geo");
176  // fRun->AddModule(Rich);
177  // //[END] Other PANDA systems ---
178 
179 
180  //particle generator
181  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
182 
183  //DPM
184  PndDpmDirect *dpmGen = new PndDpmDirect(mom,mode,seed,th_min);
185  primGen->AddGenerator(dpmGen);
186  fRun->SetGenerator(primGen);
187 
188  //reading the new field map in the old format
189  fRun->SetBeamMom(mom);
190 
191  PndMultiField *fField= new PndMultiField("AUTO");
192 
193  // //TMP: read mag.field maps one by one to make sure that 1.5 GeV/c case is treated correctly
194  // PndMultiField *fField= new PndMultiField();
195  // PndTransMap *map_t = new PndTransMap("TransMap", "R");
196  // PndDipoleMap *map_d1 = new PndDipoleMap("DipoleMap1", "R");
197  // PndDipoleMap *map_d2 = new PndDipoleMap("DipoleMap2", "R");
198  // fField->AddField(map_t);
199  // fField->AddField(map_d1);
200  // fField->AddField(map_d2);
201  // PndSolenoidMap *map_s1 = new PndSolenoidMap("SolenoidMap1", "R");
202  // PndSolenoidMap *map_s2 = new PndSolenoidMap("SolenoidMap2", "R");
203  // PndSolenoidMap *map_s3 = new PndSolenoidMap("SolenoidMap3", "R");
204  // PndSolenoidMap *map_s4 = new PndSolenoidMap("SolenoidMap4", "R");
205  // fField->AddField(map_s1);
206  // fField->AddField(map_s2);
207  // fField->AddField(map_s3);
208  // fField->AddField(map_s4);
209 
210  fRun->SetField(fField);
211 
212  //TEST!!!
213  if(nEvents<10)
214  fRun->SetStoreTraj(kTRUE); // toggle this for use with EVE
215  else
216  fRun->SetStoreTraj(kFALSE);
217 
218 
219  //FairLogger
220  // get handle
221  FairLogger *logger = FairLogger::GetLogger();
222  //
223  // log to screen and to file
224  logger->SetLogToScreen(kTRUE);
225  logger->SetLogToFile(kFALSE);
226 
227  logger->SetLogVerbosityLevel("LOW");
228 
229  // Set different levels of verbosity. In the example everything >=INFO goes to the
230  // file and everything >= ERROR is printed on the screen
231  // LogLevels are (FATAL, ERROR, WARNING, INFO, DEBUG, DEBUG1, DEBUG2, DEBUG3, DEBUG4)
232  logger->SetLogScreenLevel("ERROR"); //Only FATAL and ERROR to screen
233 
234 
235  fRun->Init();
236 
237 
238  // // Fill the Parameter containers for this run
239  // //-------------------------------------------
240  FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
241  Bool_t kParameterMerged=kTRUE;
242  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
243  output->open(parOutput.Data(),"RECREATE");
244  rtdb->setOutput(output);
245 
246  // PndMultiFieldPar* Par = (PndMultiFieldPar*) rtdb->getContainer("PndMultiFieldPar");
247  // if (fField) { Par->SetParameters(fField); }
248  // Par->setInputVersion(fRun->GetRunId(),1);
249  // Par->setChanged();
250 
251  // Transport nEvents
252  // -----------------
253 
254  fRun->Run(nEvents);
255 
256  rtdb->saveOutput();
257  rtdb->print();
258 
259 
260  timer.Stop();
261  Double_t rtime = timer.RealTime();
262  Double_t ctime = timer.CpuTime();
263  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
264  return 0;
265 }
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)
PndDpmGenerator * dpmGen
Int_t startEvent
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
Int_t mode
Definition: autocutx.C:47
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
int runLumiPixel0SimDPMDirect(const int nEvents=10, const int startEvent=0, const double mom=15, TString storePath="tmpOutputDPM", const int verboseLevel=0, const int seed, const int mode=1, const double th_min=0.12)
TString simOutput
void SetVerboseLevel(Int_t level)
FairModule * Pipe
Definition: sim_emc_apd.C:44
Double_t rtime
Definition: hit_dirc.C:113
FairModule * Magnet
Definition: sim_emc_apd.C:36
Definition: PndCave.h:8