FairRoot/PandaRoot
runSimHF_ptr.C
Go to the documentation of this file.
1 // Macro created A.Sanchez
2 // It creates a geant simulation file for hyp
3 {
4  TStopwatch timer;
5  timer.Start();
6  gDebug=0;
7  // Load basic libraries
8  // If it does not work, please check the path of the libs and put it by hands
9  //gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
10  //basiclibs();
11 
12  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
13  //rootlogon();
14 
15  gSystem->Load("librazhyp");
16  gSystem->Load("libHyp");
17 
18  FairRunSim *fRun = new FairRunSim();
19 
20 
21 
22  //--Second xi minus momentum solution.
23 
24  //TString inFile= "data/xibximin2AStpRate.dat";//data/ximinAsciiStpRate.dat";
25  //TString inFile= "data/ximinAsciiStpRate.dat";
26 
27  //--- second step -- HF from vertexes ----
28 
29  TString inFile= "/home/lorente/work/FairFeb14/pandaroot/macro/hyp/Alicia/hypBupV1T_Decay_gam.root";
30 
31 //home/lorente/work/FairFeb14/pandaroot/macro/hyp/Alicia/hypBupV1T_Decay.root";//hypBupV1T_Geo2Decay.root";
32 
33 
34  // set the MC version used
35 
36  // -- UrqmdSmm background events
37  // Int_t nEvents =99480;
38  //TString inFile= "carbon_onlyXi_2_5.root";
39 
40  // ------------------------
41 
42  fRun->SetName("TGeant4");
43 
44  //fRun->SetOutputFile("./sim_hypgeantcheck.root");
45 
46  // ----------first step XXb production -----------------------
47  //fRun->SetOutputFile("Sim_hypFSG41TXXb_Geo2.root");
48  // ---------- second step HF decay from secondary vertexes -------
49  fRun->SetOutputFile("bup_test.root");//Bup_hypFSG41TXm.root");
50 
51 
52  // Set Material file Name
53  //-----------------------
54 
55  //fRun->SetMaterials("media_pnd_hyp.geo");
56  //new media for hyp
57  fRun->SetMaterials("media_pnd.geo");
58 
59  // Create and add detectors
60  //-------------------------
61 
62  FairModule *Cave= new PndCave("CAVE");
63  Cave->SetGeometryFileName("pndcave.geo");
64  fRun->AddModule(Cave);
65  /*
66  FairModule *Magnet= new FairMagnet("MAGNET");
67  Magnet->SetGeometryFileName("magnet.geo");
68  fRun->AddModule(Magnet);
69  */
70 
71 
72 
73  PndHyp *Hyp = new PndHyp("HYP",kTRUE);
74  //FairDetector *Hyp = new PndHyp("HYP",kTRUE);
75 
76  //Hyp->SetGeometryFileName("HypST_block.geo");
77  //fRun->AddModule(Hyp);
78  //--blocks
79  //---Layers (si+abs)
80  //Hyp->SetGeometryFileName("HypST_prueba2.geo");
81  //fRun->AddModule(Hyp);
82  //--layers C+Si
83  // Hyp->SetGeometryFileName("HypST_prueba23.geo");
84  //fRun->AddModule(Hyp);
85  //--layers C+si+hyppipe
86  //Hyp->SetGeometryFileName("HypST_prueba24pipe.geo");
87  //Hyp->SetGeometryFileName("HypST_newxy3C.geo");
88 
89 
90 
91  // --- root geometry ------
92  /* Hyp->SetAbsorberVol("stglAb"); // absorber layer
93  Hyp->SetSensorVol("stglSi"); // silicon sensor
94  //Hyp->SetGeometryFileName("HYPST_assexy3C5Lay.root");
95  Hyp->SetGeometryFileName("HYPST_assexy3C5Lay_mvd.root");//HYPST_assexy3C5Lay_test.root");
96  */
97 
98  // xxxxxxxx Sebastian asymmetric geo root xxxxxxxxxxx
99 
100  Hyp->SetAbsorberVol("Absorber"); // absorber layer
101  Hyp->SetSensorVol("Sensor"); // silicon sensor
102  Hyp->SetGeoVersion("List");
103  Hyp->SetListMat("HYPboron");
104  Hyp->SetListMat("HYPaluminium");
105  Hyp->SetListMat("Al97Mg3");
106  Hyp->SetListMat("titanium");
107  Hyp->SetListMat("HYPcarbon");
108  Hyp->SetListMat("siliconinactive");
109  Hyp->SetGeometryFileName("TargetSystem_Ti_AbsWindow_addSens.root");//SekTarget_open_varAbs4Si5_3Q_HYPbe_1mm_MVD.root");
110 
111 
112  // ---------------------------------
113 
114  //Hyp->SetTreeFName("hypBupV1T_Geo2Decay.root");
115  Hyp->SetHypSDtoFile(true,false);
116  fRun->AddModule(Hyp);
117 
118  gROOT->LoadMacro("$VMCWORKDIR/gconfig/SetFragments.C");
119  FragConfig(fRun);
120 
121  //fRun->SetUserDecay(kTRUE);
122 
123  // Create and Set Event Generator
124  //-------------------------------
125 
126  FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
127  fRun->SetGenerator(primGen);
128 
129 
130 
131 
132  // Background events UrqmdSmm
133  /* PndUrqmdSmmGenerator* AsciiGen = new PndUrqmdSmmGenerator(inFile);
134 
135  primGen->SetTarget(-55.5,0.);
136  primGen->AddGenerator(AsciiGen);*/
137 
138  // *** with Ascii inFile ***first step
139  //FairAsciiGenerator* AsciiGen = new FairAsciiGenerator(inFile);
140  // primGen->SetTarget(-55.5,0.);
141  //primGen->AddGenerator(AsciiGen);
142 
143  // *** with root inFile ***second step
145  partGen->GammaEmissPar(kTRUE);
146  partGen->SetPRange(1.,1.);
147  partGen->SetPhiRange(0,360);
148  partGen->SetThetaRange(0,180);
149  primGen->AddGenerator(partGen);
150 
151 
152 
153 
155  fMagField->SetField(0, 0 ,10. ); // values are in kG
156  // MinX=-75, MinY=-40,MinZ=-12 ,MaxX=75, MaxY=40 ,MaxZ=124 ); // values are in cm
157  fMagField->SetFieldRegion(-50, 50,-50, 50, -200, 200);
158  fRun->SetField(fMagField);
159 
160 
161  /*PndMultiField *fField= new PndMultiField();
162  PndTransMap *map= new PndTransMap("TransMap", "R");
163  PndDipoleMap *map1= new PndDipoleMap("DipoleMap", "R");
164  PndSolenoidMap *map2= new PndSolenoidMap("SolenoidMap", "R");
165  fField->AddField(map);
166  fField->AddField(map1);
167  fField->AddField(map2);
168  fRun->SetField(fField);*/
169 
170  fRun->SetStoreTraj(kTRUE); // to store particle trajectories
171 
172 
173  fRun->Init();
174 
175 
176  // Fill the Parameter containers for this run
177  //-------------------------------------------
178  // cout<<" gGeoManager "<<gGeoManager<<endl;
179  FairRuntimeDb *rtdb=fRun->GetRuntimeDb();
180 
181  // PndMultiFieldPar* fieldPar = (PndMultiFieldPar*) rtdb->getContainer("PndMultiFieldPar");
182  // if ( fField ) { fieldPar->SetParameters(fField); }
183  // fieldPar->setInputVersion(fRun->GetRunId(),1);
184  // fieldPar->setChanged();
185 
186  PndConstPar* fieldPar = (PndConstPar*) rtdb->getContainer("PndConstPar");
187  if ( fMagField ) { fieldPar->SetParameters(fMagField); }
188  fieldPar->setInputVersion(fRun->GetRunId(),1);
189  fieldPar->setChanged();
190 
192  FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged);
193  //output->open("simparams.root");
194  //output->open("Sim_hypFS1TG4XXb_Geo2params.root");
195  output->open("test_params.root");//Bup_hypFS1TG4Xmparams.root");
196  rtdb->setOutput(output);
197  rtdb->saveOutput();
198  rtdb->print();
199 
200  // Transport nEvents
201  // -----------------
202  // Set the number of events
203  Int_t nEvents =60;//50505;
204 
205  fRun->Run(nEvents);
206 
207  timer.Stop();
208 
209  Double_t rtime = timer.RealTime();
210  Double_t ctime = timer.CpuTime();
211  printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
212  // delete fRun;
213  //exit(0);
214 }
215 
216 
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
void SetListMat(TString mat="carbon")
Definition: PndHyp.h:222
FairRunSim * fRun
Definition: runSimHF_ptr.C:18
Bool_t kParameterMerged
Definition: runSimHF_ptr.C:191
Definition: PndHyp.h:30
gDebug
Definition: runSimHF_ptr.C:6
TString inFile
Definition: runSimHF_ptr.C:29
FragConfig(fRun)
PndHyp * Hyp
Definition: runSimHF_ptr.C:73
Double_t rtime
Definition: runSimHF_ptr.C:209
PndHypBupGenerator * partGen
Definition: runSimHF_ptr.C:144
void SetPRange(Double32_t pmin=0, Double32_t pmax=10)
FairParRootFileIo * output
Definition: runSimHF_ptr.C:192
void SetFieldRegion(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
void SetSensorVol(TString VolSi)
Definition: PndHyp.h:195
PndConstField * fMagField
Definition: runSimHF_ptr.C:154
void SetHypSDtoFile(bool onf, bool val)
Definition: PndHyp.h:177
Double_t
Double_t ctime
Definition: runSimHF_ptr.C:210
void SetField(Double_t bX, Double_t bY, Double_t bZ)
TStopwatch timer
Definition: hit_dirc.C:51
void SetAbsorberVol(TString VolAb)
Definition: PndHyp.h:199
FairModule * Cave
Definition: runSimHF_ptr.C:62
void SetParameters(FairField *field)
Definition: PndConstPar.cxx:54
void SetPhiRange(Double32_t phimin=0, Double32_t phimax=360)
void SetGeoVersion(TString vers="standard")
Definition: PndHyp.h:210
Int_t nEvents
Definition: runSimHF_ptr.C:203
void SetThetaRange(Double32_t thetamin=0, Double32_t thetamax=90)
FairRuntimeDb * rtdb
Definition: runSimHF_ptr.C:179
FairPrimaryGenerator * primGen
Definition: runSimHF_ptr.C:126
PndConstPar * fieldPar
Definition: runSimHF_ptr.C:186
Definition: PndCave.h:8