FairRoot/PandaRoot
Functions
sim_hypGe_TestGeoCableTest.C File Reference

Go to the source code of this file.

Functions

int sim_hypGe_TestGeoCableTest (Int_t nEvents, Int_t WhichDetector, Double_t Energy, Bool_t addSecTar, Double_t CableThickness)
 

Function Documentation

int sim_hypGe_TestGeoCableTest ( Int_t  nEvents,
Int_t  WhichDetector,
Double_t  Energy,
Bool_t  addSecTar,
Double_t  CableThickness 
)

Definition at line 3 of file sim_hypGe_TestGeoCableTest.C.

References Bool_t, boxGen, boxGen2, Cave, ctime, Double_t, fRun, gDebug, Hyp, HypGe, kParameterMerged, nam, nEvents, outFile, output, primGen, printf(), rtdb, rtime, PndHypGe::SetPathGeo(), PndBoxGenerator::SetPhiRange(), PndBoxGenerator::SetPRange(), PndHyp::SetSensorVol(), PndBoxGenerator::SetThetaRange(), PndBoxGenerator::SetXYZ(), timer, and TString.

4 {
5  // Load basic libraries
6  // If it does not work, please check the path of the libs and put it by hands
7  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
8  gSystem->Load("libHypGe");
9  gSystem->Load("libHyp");
10 
11  //create cable geometry
12  //gROOT->ProcessLine(".L ../Geometry/hypGeCableAbsorptionTest.C");
13  //TString CableFilename = hypGeCableAbsorptionTest(CableThickness);
14 
15  FairRunSim *fRun = new FairRunSim();
16 
17  TStopwatch timer;
18  timer.Start();
19  gDebug=0;
20 
21  //Choose geometry
22  TString outFile="$SIMDATADIR/GeantTest/"; // If no SIMDATADIR, same folder as the macro
23  TString GeoFile;
24 
25  GeoFile = "hypGeGeoGeantTestGeometry.root";
26  outFile += "hypGeGeoGeantTestGeometry_";
27 
28  // Set the number of events
29 
30  // Set the gamma energy
31 
32  // choose Co60
33  bool isCo60 = false;
34  //compose the name of the output file and the simparams file
35 
36  if (!isCo60)
37  {
38  outFile += Energy*1000;
39  outFile += "MeV_";
40  }
41  else
42  {
43  outFile += "Co60_";
44  }
45  outFile += nEvents;
46  outFile += "Evts";
47  if (addSecTar)
48  {
49  outFile += "withSecTar";
50  }
51 
52  outFile += "Cable_";
53  outFile += CableThickness;
54  outFile += "cm";
55 
56  TString SimparamsFile;
57  SimparamsFile=outFile;
58  outFile +=".root";
59  SimparamsFile += "__Simparams.root";
60 
61  //TString inFile="/d/panda02/urqmd_smm/pbarC_3_GeV.root";
62  //TString inFile="/u/asanchez/razhyp_gt12.dat";
63  // set the MC version used
64  // ------------------------
65 
66  fRun->SetName("TGeant4");
67 
68  fRun->SetOutputFile(outFile);
69  // Set Material file Name
70  //-----------------------
71 
72  fRun->SetMaterials("media_pnd_hypGe.geo");
73 
74  // Create and add detectors
75  //-------------------------
76 
77  FairModule *Cave= new PndCave("CAVE");
78  Cave->SetGeometryFileName("pndcave_vacuum.geo");
79  fRun->AddModule(Cave);
80 
81  PndHypGe *HypGe= new PndHypGe("HYPGE",kTRUE);
82  TString nam = gSystem->Getenv("VMCWORKDIR");
83  HypGe->SetPathGeo(nam.Data());
84  HypGe->SetGeometryFileName(GeoFile);
85  fRun->AddModule(HypGe);
86 
87  if (addSecTar)
88  {
89  PndHyp *Hyp= new PndHyp("HYP",kFALSE);
90  Hyp->SetAbsorverVol("Absorber"); // absorber layer
91  Hyp->SetSensorVol("Sensor"); // silicon sensor
92  Hyp->SetGeometryFileName("SekTarget_open_varAbs4_3Q_HYPbe_1mm.root");
93  fRun->AddModule(Hyp);
94  }
95 
96  //get cable geometry filename and add cable geometry to scene
97 
98  TString CableGeoFile = "hypGeGeoCableAbsorptionTest_";
99  CableGeoFile += CableThickness;
100 
101  CableGeoFile += "cm.root";
102 
103  cout << CableGeoFile<< endl;
104  //FairModule *Cable = new FairModule("Cable","Cable");
105  //Cable->SetGeometryFileName(CableGeoFile);
106  //fRun->AddModule(Cable);
107 
108 
109 
110  PndHyp *Cable = new PndHyp("Cable",kFALSE);
111  Cable->SetGeometryFileName(CableGeoFile);
112  fRun->AddModule(Cable);
113  //FairDetector *Drc = new FairDrc("DIRC", kTRUE);
114  //Drc->SetGeometryFileName("dirc.geo");
115  //fRun->AddModule(Drc);
116 
117  // FairModule *Magnet= new FairMagnet("MAGNET");
118  // Magnet->SetGeometryFileName("magnet.geo");
119  // fRun->AddModule(Magnet);
120 
121  // FairDetector *Emc = new FairEmc("EMC",kTRUE);
122  // Emc->SetGeometryFileName("emc_module123.dat");
123  // fRun->AddModule(Emc);
124 
125  //TGeoNode *top = gGeoManager->GetTopNode();
126  //top->Draw("ogl");
127  // Create and Set Event Generator
128  //-------------------------------
129 
130 
131  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
132  fRun->SetGenerator(primGen);
133 
134  // Box Generator:
135  // FairBoxGenerator* boxGen = new FairBoxGenerator(211, 1);
136  // 13 = muon; 1 = multipl. // 211 = pi+
137  // first number: PDG particle code: 2nd number: particle multiplicity per event
138 
139 
140  PndBoxGenerator* boxGen = new PndBoxGenerator(22, 1);
141  if (!isCo60)
142  boxGen->SetPRange(Energy,Energy); // GeV/c
143  else
144  boxGen->SetPRange(0.001172,0.001172); //set first line of Co60 in GeV/c
145  // boxGen->SetPtRange(1.,1.); // GeV/c
146  boxGen->SetPhiRange(0., 0.); // Azimuth angle range [degree]
147  boxGen->SetThetaRange(180., 180.); // Polar angle in lab system range [degree]
148  //boxGen->SetCosTheta(); // Set uniform ditribution in cos(theta)
149  boxGen->SetXYZ(0., 0., -55.); // vertex coordinates [cm]
150  primGen->AddGenerator(boxGen);
151 
152  if (isCo60)
153  {
154  PndBoxGenerator* boxGen2 = new PndBoxGenerator(22, 1);
155  boxGen2->SetPRange(0.001332,0.001332); // GeV/c
156  //boxGen2->SetPtRange(1.,1.); // GeV/c
157  boxGen2->SetPhiRange(0., 360.); // Azimuth angle range [degree]
158  boxGen2->SetThetaRange(90., 180.); // Polar angle in lab system range [degree]
159  //boxGen2->SetCosTheta(); // Set uniform ditribution in cos(theta)
160  boxGen2->SetXYZ(0., 0., -55.); // vertex coordinates [cm]
161  primGen->AddGenerator(boxGen2);
162  }
163 
164 
165 /*
166  PndBoxGenerator* boxGen2 = new PndBoxGenerator(-211, 1);
167  boxGen2->SetPRange(0.09,0.1); // GeV/c
168  // boxGen->SetPtRange(1.,1.); // GeV/c
169  boxGen2->SetPhiRange(0., 360.); // Azimuth angle range [degree]
170  boxGen2->SetThetaRange(120., 180.); // Polar angle in lab system range [degree]
171  boxGen2->SetCosTheta(); // Set uniform ditribution in cos(theta)
172  boxGen2->SetXYZ(0., 0., -76.); // vertex coordinates [cm]
173  */
174  //primGen->AddGenerator(boxGen);
175  /*
176  TChain *t =new TChain("data");
177  t->Add(inFile);
178  PndUrqmdSmmGenerator* AsciiGen = new PndUrqmdSmmGenerator(t);
179  primGen->SetTarget(-76.,0.);
180  primGen->AddGenerator(AsciiGen);
181  */
182 
183  /*FairAsciiGenerator* AsciiGen = new FairAsciiGenerator(inFile);
184  //primGen->SetTarget(-150.,0.);
185  primGen->AddGenerator(AsciiGen);
186  */
187 
188  fRun->SetStoreTraj(kTRUE); // to store particle trajectories
189 
190 
191  //magnetic field: no field when commented put
192  //FairFieldConst *fMagField=new FairFieldConst();
193  //fMagField->SetField(0.,0.,20.); // values are in kG
194  //fMagField->SetFieldRegion(-50, 50,-50, 50, -100, 100);
195  // values are in cm (xmin,xmax,ymin,ymax,zmin,zmax)
196  //fRun->SetField(fMagField);
197 
198 
199 
200 
201  fRun->Init();
202 
203  // Fill the Parameter containers for this run
204  //-------------------------------------------
205 
206  FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
207  Bool_t kParameterMerged=kTRUE;
208 
209 
210  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
211  output->open(SimparamsFile);
212  rtdb->setOutput(output);
213  rtdb->saveOutput();
214  rtdb->print();
215 
216 
217  // Transport nEvents
218  // -----------------
219 
220  fRun->Run(nEvents);
221 
222  timer.Stop();
223 
224  Double_t rtime = timer.RealTime();
225  Double_t ctime = timer.CpuTime();
226  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
227 
228  return 0;
229 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
PndHypGe * HypGe
Definition: sim_hypGe.C:47
void SetThetaRange(Double32_t thetamin=0, Double32_t thetamax=90)
Definition: PndHyp.h:30
Bool_t kParameterMerged
Definition: sim_emc_apd.C:113
TString outFile
Definition: hit_dirc.C:17
PndBoxGenerator * boxGen2
Definition: sim_pid.C:96
void SetXYZ(Double32_t x=0, Double32_t y=0, Double32_t z=0)
PndHyp * Hyp
Definition: runSimHF_ptr.C:73
FairParRootFileIo * output
Definition: sim_emc_apd.C:120
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
void SetSensorVol(TString VolSi)
Definition: PndHyp.h:195
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
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
void SetPRange(Double32_t pmin=0, Double32_t pmax=10)
Double_t rtime
Definition: hit_dirc.C:113
TString nam
Definition: sim_hypGe.C:48
void SetPhiRange(Double32_t phimin=0, Double32_t phimax=360)
void SetPathGeo(TString pgeo)
Definition: PndHypGe.h:136
Definition: PndCave.h:8