FairRoot/PandaRoot
Functions
sim_BARREL_1000sep.C File Reference

Go to the source code of this file.

Functions

int sim_BARREL_1000sep (Int_t fileId=0, Int_t nEvents=1000, Int_t pid=13, Int_t nStations=3)
 

Function Documentation

int sim_BARREL_1000sep ( Int_t  fileId = 0,
Int_t  nEvents = 1000,
Int_t  pid = 13,
Int_t  nStations = 3 
)

Definition at line 1 of file sim_BARREL_1000sep.C.

References Bool_t, Cave, ctime, Dipole, Double_t, fBox, fBox2, fField, fRun, gDebug, Gem, kParameterMerged, Mvd, nEvents, output, parOutput, pid(), Pipe, primGen, printf(), rtdb, rtime, Stt, timer, and TString.

1  {
2  TTimeStamp* timeStamp = new TTimeStamp();
3  Int_t newSeed = 1000*(Int_t)(timeStamp->AsDouble())+timeStamp-(Int_t)(timeStamp->AsDouble());
4  gRandom->SetSeed(newSeed);
5 
6  if ( nStations != 3 && nStations != 4 ) {
7  cout << "WRONG number of stations, only 3 or 4 allowed." << endl;
8  return;
9  }
10 
11  TStopwatch timer;
12  timer.Start();
13  gDebug=0;
14  // Load basic libraries
15  // gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
16  // rootlogon();
17 
18  TString parOutput = Form("params_22Part_n%d_f%d_sep.root",nEvents,fileId);
19  TString outputFile = Form("points_22Part_n%d_f%d_sep.root",nEvents,fileId);
20 
21  FairRunSim *fRun = new FairRunSim();
22 
23  // set the MC version used
24  // ------------------------
25 
26  fRun->SetName("TGeant3");
27 
28  fRun->SetOutputFile(outputFile.Data());
29 
30  // Set Material file Name
31  //-----------------------
32 
33  fRun->SetMaterials("media_pnd.geo");
34 
35  // Create and add detectors
36  //-------------------------
37 
38  FairModule *Cave= new PndCave("CAVE");
39  Cave->SetGeometryFileName("pndcave.geo");
40  fRun->AddModule(Cave);
41 
42  FairModule *Dipole= new PndMagnet("MAGNET");
43  Dipole->SetGeometryFileName("dipole.geo");
44  fRun->AddModule(Dipole);
45 
46  FairModule *Pipe= new PndPipe("PIPE");
47  fRun->AddModule(Pipe);
48 
49  //------------------------- MVD -----------------
50  FairDetector *Mvd = new PndMvdDetector("MVD", kTRUE);
51  // Mvd->SetGeometryFileName("MVD_v1.0_woPassiveTraps.root");
52  Mvd->SetGeometryFileName("Mvd-2.1_FullVersion.root"); // only sensors, update follows
53  fRun->AddModule(Mvd);
54  //------------------------- STT -----------------
55  FairDetector *Stt= new PndStt("STT", kTRUE);
56  if ( nStations == 3 )
57  Stt->SetGeometryFileName("straws_skewed_blocks_35cm_pipe.geo");
58  if ( nStations == 4 )
59  Stt->SetGeometryFileName("straws_skewed_blocks_pipe_120cm.geo");
60  fRun->AddModule(Stt);
61  //------------------------- GEM -----------------
62  FairDetector *Gem = new PndGemDetector("GEM", kTRUE);
63  Gem->SetGeometryFileName(Form("gem_%dStations.root",nStations));
64  fRun->AddModule(Gem);
65  //------------------------- DRC -----------------
66 // PndDrc *Drc = new PndDrc("DIRC", kTRUE);
67 // Drc->SetRunCherenkov(kFALSE); // for fast sim Cherenkov -> kFALSE
68 // fRun->AddModule(Drc);
69 // //------------------------- EMC -----------------
70 // PndEmc *Emc = new PndEmc("EMC",kTRUE);
71 // Emc->SetGeometryFileNameDouble("emc_module1245.dat","emc_module3new.root");
72 // fRun->AddModule(Emc);
73  //------------------------- TOF -----------------
74  // FairDetector *Tof = new PndTof("TOF",kTRUE);
75  // Tof->SetGeometryFileName("tofbarrel.geo");
76  //fRun->AddModule(Tof);
77  /* //------------------------- MDT -----------------
78  PndMdt *Muo = new PndMdt("MDT",kTRUE);
79  Muo->SetBarrel("torino");
80  Muo->SetEndcap("torino");
81  Muo->SetMuonFilter("torino");
82  Muo->SetMdtMagnet(kTRUE);
83  Muo->SetMdtMFIron(kTRUE);
84  fRun->AddModule(Muo);*/
85  //======================================================
86 
87  // Create and Set Event Generator
88  //-------------------------------
89 
90  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
91  fRun->SetGenerator(primGen);
92 
93  FairBoxGenerator *fBox = new FairBoxGenerator(pid, 2);
94  fBox->SetPRange(.3,10.);
95  fBox->SetThetaRange(2.,100.);
96  fBox->SetPhiRange( 0.,360);
97  // fBox->SetCosTheta();
98  primGen->AddGenerator(fBox);
99  FairBoxGenerator *fBox2 = new FairBoxGenerator(-pid, 2);
100  fBox2->SetPRange(.3,10.);
101  fBox2->SetThetaRange(2.,100.);
102  fBox2->SetPhiRange( 0.,360);
103  // fBox2->SetCosTheta();
104  primGen->AddGenerator(fBox2);
105 
106  fRun->SetBeamMom(15);
107  //---------------------Create and Set the Field(s)----------
108  PndMultiField *fField= new PndMultiField("FULL");
109  fRun->SetField(fField);
110 
111 
112  fRun->SetStoreTraj(kFALSE); // toggle this for use with EVE
113  fRun->SetRadLenRegister(kFALSE); // toggle for material budget study
114 
115  fRun->Init();
116 
117  // Fill the Parameter containers for this run
118  //-------------------------------------------
119  FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
120  Bool_t kParameterMerged=kTRUE;
121  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
122  output->open(parOutput.Data(),"RECREATE");
123  rtdb->setOutput(output);
124 
125  // Transport nEvents
126  // -----------------
127 
128  fRun->Run(nEvents);
129 
130  rtdb->saveOutput();
131  rtdb->print();
132 
133 
134  timer.Stop();
135  Double_t rtime = timer.RealTime();
136  Double_t ctime = timer.CpuTime();
137  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
138 
139  cout << " Test passed" << endl;
140  cout << " All ok " << endl;
141  //exit(0);
142 
143  return 0;
144 }
PndMultiField * fField
Definition: sim_emc_apd.C:97
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
Bool_t kParameterMerged
Definition: sim_emc_apd.C:113
int pid()
FairDetector * Mvd
Definition: sim_emc_apd.C:51
FairBoxGenerator * fBox
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
FairDetector * Gem
Definition: runJohan.C:71
FairDetector * Stt
Definition: sim_emc_apd.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
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
Definition: PndStt.h:34
FairBoxGenerator * fBox2
Definition: simforpid.C:111
FairModule * Pipe
Definition: sim_emc_apd.C:44
Double_t rtime
Definition: hit_dirc.C:113
Definition: PndCave.h:8